- private void fetchData(String uri, SyncResult syncResult, long parentId) {\r
- PropFindMethod query = null;\r
- try {\r
- Log.d(TAG, "fetching " + uri);\r
- \r
- // remote request \r
- query = new PropFindMethod(uri);\r
- /* Commented code for ugly performance tests\r
- long responseDelay = System.currentTimeMillis();\r
- */\r
- getClient().executeMethod(query);\r
- /* Commented code for ugly performance tests\r
- responseDelay = System.currentTimeMillis() - responseDelay;\r
- Log.e(TAG, "syncing: RESPONSE TIME for " + uri + " contents, " + responseDelay + "ms");\r
- */\r
- MultiStatus resp = null;\r
- resp = query.getResponseBodyAsMultiStatus();\r
+ \r
+ \r
+ /**\r
+ * Synchronize the properties of files and folders contained in a remote folder given by remotePath.\r
+ * \r
+ * @param remotePath Remote path to the folder to synchronize.\r
+ * @param parentId Database Id of the folder to synchronize.\r
+ */\r
+ private void fetchData(String remotePath, long parentId) {\r
+ \r
+ if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult))\r
+ return;\r
+ \r
+ // perform folder synchronization\r
+ SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( remotePath, \r
+ mCurrentSyncTime, \r
+ parentId, \r
+ getStorageManager(), \r
+ getAccount(), \r
+ getContext()\r
+ );\r
+ RemoteOperationResult result = synchFolderOp.execute(getClient());\r
+ \r
+ \r
+ // synchronized folder -> notice to UI - ALWAYS, although !result.isSuccess\r
+ sendStickyBroadcast(true, remotePath, null);\r
+ \r
+ if (result.isSuccess()) {\r
+ // synchronize children folders \r
+ List<OCFile> children = synchFolderOp.getChildren();\r
+ fetchChildren(children); // beware of the 'hidden' recursion here!\r