com.dropbox.client2.exception.DropboxException Java Examples
The following examples show how to use
com.dropbox.client2.exception.DropboxException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 6 votes |
private void createFileStructure() throws DropboxException { /** * Creates the following folders: * - /basePath * - /basePath/entries * - /basePath/photos * - /basePath/entries/deleted * - /basePath/photos/deleted */ List<String> folders = new ArrayList<>(); String basepath = getBaseFilePath(); folders.add(basepath); folders.add(basepath + ENTRIES); folders.add(basepath + DELETED_ENTRIES); folders.add(basepath + PHOTOS); folders.add(basepath + DELETED_PHOTOS); for (String folder : folders) createFolder(folder); }
Example #2
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 6 votes |
private void initialize(String token) { LogUtil.log(getClass().getSimpleName(), "initialize()"); AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET); AndroidAuthSession session = new AndroidAuthSession(appKeys, ACCESS_TYPE); mDBApi = new DropboxAPI<>(session); if ( token == null ) token = Settings.getDropboxSyncToken(); if ( token != null ) mDBApi.getSession().setOAuth2AccessToken(token); if (!doesFolderExist(getBaseFilePath())) { try { createFileStructure(); } catch (DropboxException e) { e.printStackTrace(); } } }
Example #3
Source File: DropboxFileDownloaderTest.java From endpoints-codelab-android with GNU General Public License v3.0 | 6 votes |
public void testRemoteFileMissing() { DropboxAPI<?> dropboxapi = new DropboxAPIStub() { public DropboxAPI.Entry metadata(String arg0, int arg1, String arg2, boolean arg3, String arg4) throws DropboxException { throw notFoundException(); } }; DropboxFileDownloader downloader = new DropboxFileDownloader( dropboxapi, dropboxFiles1); downloader.pullFiles(); assertEquals("Status should be SUCCESS", DropboxFileStatus.SUCCESS, downloader.getStatus()); assertEquals("Should have 1 file", 1, downloader.getFiles().size()); assertEquals("Status should be NOT_FOUND", DropboxFileStatus.NOT_FOUND, dbFile1.getStatus()); }
Example #4
Source File: DropboxFileDownloaderTest.java From endpoints-codelab-android with GNU General Public License v3.0 | 6 votes |
public void testRemoteFileDeleted() { DropboxAPI<?> dropboxapi = new DropboxAPIStub() { public DropboxAPI.Entry metadata(String arg0, int arg1, String arg2, boolean arg3, String arg4) throws DropboxException { return create_metadata(remoterev1, true); } }; DropboxFileDownloader downloader = new DropboxFileDownloader( dropboxapi, dropboxFiles1); downloader.pullFiles(); assertEquals("Status should be SUCCESS", DropboxFileStatus.SUCCESS, downloader.getStatus()); assertEquals("Should have 1 file", 1, downloader.getFiles().size()); assertEquals("Status should be NOT_FOUND", DropboxFileStatus.NOT_FOUND, dbFile1.getStatus()); }
Example #5
Source File: DropboxFileDownloaderTest.java From endpoints-codelab-android with GNU General Public License v3.0 | 6 votes |
public void testBothFilesMissing() { DropboxAPI<?> dropboxapi = new DropboxAPIStub() { public DropboxAPI.Entry metadata(String arg0, int arg1, String arg2, boolean arg3, String arg4) throws DropboxException { throw notFoundException(); } }; DropboxFileDownloader downloader = new DropboxFileDownloader( dropboxapi, dropboxFiles2); downloader.pullFiles(); assertEquals("Status should be SUCCESS", DropboxFileStatus.SUCCESS, downloader.getStatus()); assertEquals("Should have 2 files", 2, downloader.getFiles().size()); assertEquals("Status should be NOT_FOUND", DropboxFileStatus.NOT_FOUND, dbFile1.getStatus()); assertEquals("Status should be NOT_FOUND", DropboxFileStatus.NOT_FOUND, dbFile2.getStatus()); }
Example #6
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 5 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxFileInfo getThumbnail( String arg0, OutputStream arg1, com.dropbox.client2.DropboxAPI.ThumbSize arg2, com.dropbox.client2.DropboxAPI.ThumbFormat arg3, ProgressListener arg4) throws DropboxException { return null; }
Example #7
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 5 votes |
private boolean doesFolderExist(String path) { try { DropboxAPI.Entry metadata = getFileInfo(path); return metadata.isDir; } catch (DropboxException e) { e.printStackTrace(); return false; } }
Example #8
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 5 votes |
/** * Returns 1 if it does exist * Returns 0 if it does not exist * Returns -1 if there is any other error * * @param path * @return */ private int doesFileExist(String path) { try { DropboxAPI.Entry metadata = getFileInfo(path); return 1; } catch (DropboxException e) { e.printStackTrace(); if (e.toString().contains("404")) return 0; else return -1; } }
Example #9
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.UploadRequest putFileOverwriteRequest( String arg0, InputStream arg1, long arg2, ProgressListener arg3) throws DropboxException { return null; }
Example #10
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxLink media(String arg0, boolean arg1) throws DropboxException { return null; }
Example #11
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry metadata(String arg0, int arg1, String arg2, boolean arg3, String arg4) throws DropboxException { return null; }
Example #12
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry move(String arg0, String arg1) throws DropboxException { return null; }
Example #13
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry putFile(String arg0, InputStream arg1, long arg2, String arg3, ProgressListener arg4) throws DropboxException { return null; }
Example #14
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry putFileOverwrite(String arg0, InputStream arg1, long arg2, ProgressListener arg3) throws DropboxException { return null; }
Example #15
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public void delete(String arg0) throws DropboxException { }
Example #16
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.UploadRequest putFileRequest( String arg0, InputStream arg1, long arg2, String arg3, ProgressListener arg4) throws DropboxException { return null; }
Example #17
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry restore(String arg0, String arg1) throws DropboxException { return null; }
Example #18
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public List<com.dropbox.client2.DropboxAPI.Entry> revisions(String arg0, int arg1) throws DropboxException { return null; }
Example #19
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public List<com.dropbox.client2.DropboxAPI.Entry> search(String arg0, String arg1, int arg2, boolean arg3) throws DropboxException { return null; }
Example #20
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxLink share(String arg0) throws DropboxException { return null; }
Example #21
Source File: DropboxSyncManager.java From CameraV with GNU General Public License v3.0 | 4 votes |
public synchronized void uploadMediaAsync (IMedia media) { if (mDBApi != null) //if there is no active session, then ignore { if (llMediaQ == null) llMediaQ = new LinkedList<IMedia>(); llMediaQ.add(media); showNotification(); if (mThread == null || (!mThread.isAlive())) { mThread = new Thread () { public void run () { IMedia media = null; int numUploaded = 0; while (mDBApi != null && llMediaQ.peek() != null) { media = llMediaQ.pop(); try { Entry result = uploadMedia (media); if (result != null) numUploaded++; uploadMetadata(media,"j3m"); uploadMetadata(media,"csv"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DropboxException e) { // TODO Auto-generated catch block e.printStackTrace(); } } finishNotification(numUploaded); } }; mThread.start(); } } }
Example #22
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxInputStream getThumbnailStream( String arg0, com.dropbox.client2.DropboxAPI.ThumbSize arg1, com.dropbox.client2.DropboxAPI.ThumbFormat arg2) throws DropboxException { return null; }
Example #23
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxInputStream getFileStream( String arg0, String arg1) throws DropboxException { return null; }
Example #24
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.DropboxFileInfo getFile(String arg0, String arg1, OutputStream arg2, ProgressListener arg3) throws DropboxException { return null; }
Example #25
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry createFolder(String arg0) throws DropboxException { return null; }
Example #26
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Entry copy(String arg0, String arg1) throws DropboxException { return null; }
Example #27
Source File: DropboxAPIStub.java From endpoints-codelab-android with GNU General Public License v3.0 | 4 votes |
@Override public com.dropbox.client2.DropboxAPI.Account accountInfo() throws DropboxException { return null; }
Example #28
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 4 votes |
private DropboxAPI.Entry moveFile(String from, String to) throws DropboxException { checkNotNull(); return mDBApi.move(from, to); }
Example #29
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 4 votes |
public DropboxAPI.Entry overwriteFile(String dbPath, File localFile) throws DropboxException, FileNotFoundException { checkNotNull(); FileInputStream inputStream = new FileInputStream(localFile); return mDBApi.putFileOverwrite(dbPath, inputStream, localFile.length(), null); }
Example #30
Source File: DropboxSyncService.java From narrate-android with Apache License 2.0 | 4 votes |
public DropboxAPI.Entry uploadFile(String dbPath, File localFile) throws FileNotFoundException, DropboxException { checkNotNull(); FileInputStream inputStream = new FileInputStream(localFile); return mDBApi.putFile(dbPath, inputStream, localFile.length(), null, null); }