Examples of DropboxException


Examples of org.apache.camel.component.dropbox.util.DropboxException

    public DropboxResult move(String remotePath, String newRemotePath) throws DropboxException {
        DropboxResult result = null;
        try {
            DropboxAPIFacade.client.move(remotePath, newRemotePath);
        } catch (DbxException e) {
            throw new DropboxException(remotePath + " does not exist or can't obtain metadata");
        }
        result = new DropboxMoveResult();
        result.setResultEntries(remotePath + "-" + newRemotePath);
        return result;
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

    private void downloadFilesInFolder(String path, Map<String, ByteArrayOutputStream> resultEntries) throws DropboxException {
        DbxEntry.WithChildren listing = null;
        try {
            listing = DropboxAPIFacade.client.getMetadataWithChildren(path);
        } catch (DbxException e) {
            throw new DropboxException(path + " does not exist or can't obtain metadata");
        }
        if (listing.children == null) {
            LOG.info("downloading a single file...");
            downloadSingleFile(path, resultEntries);
            return;
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DbxEntry.File downloadedFile;
        try {
            downloadedFile = DropboxAPIFacade.client.getFile(path, null, baos);
        } catch (DbxException e) {
            throw new DropboxException(path + " does not exist or can't obtain metadata");
        } catch (IOException e) {
            throw new DropboxException(path + " can't obtain a stream");
        }
        if (downloadedFile != null) {
            resultEntries.put(path, baos);
            LOG.info("downloaded path:" + path + " - baos size:" + baos.size());
        }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

        }
    }

    private static void validateCommonProperties(DropboxConfiguration configuration) throws DropboxException {
        if (configuration.getAccessToken() == null || configuration.getAccessToken().equals("")) {
            throw new DropboxException("option <accessToken> is not present or not valid!");
        }
        if (configuration.getClientIdentifier() == null || configuration.getClientIdentifier().equals("")) {
            throw new DropboxException("option <clientIdentifier> is not present or not valid!");
        }
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

            validateRemotePathForPut(configuration.getRemotePath());
        } else //in case remote path is not set, local path is even the remote path so it must be validated as UNIX
            validatePathInUnix(configuration.getLocalPath());
        }
        if (configuration.getUploadMode() == null) {
            throw new DropboxException("option <uploadMode> is not present or not valid!");
        }
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

        validateRemotePath(configuration.getNewRemotePath());
    }

    private static void validateLocalPath(String localPath) throws DropboxException {
        if (localPath == null || localPath.equals("")) {
            throw new DropboxException("option <localPath> is not present or not valid!");
        }
        File file = new File(localPath);
        if (!file.exists()) {
            throw new DropboxException("option <localPath> is not an existing file or directory!");
        }
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

        }
    }

    private static void validateRemotePath(String remotePath) throws DropboxException {
        if (remotePath == null || !remotePath.startsWith(DROPBOX_FILE_SEPARATOR)) {
            throw new DropboxException("option <remotePath> is not valid!");
        }
        validatePathInUnix(remotePath);
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

        validatePathInUnix(remotePath);
    }

    private static void validateRemotePathForPut(String remotePath) throws DropboxException {
        if (!remotePath.startsWith(DROPBOX_FILE_SEPARATOR)) {
            throw new DropboxException("option <remotePath> is not valid!");
        }
        validatePathInUnix(remotePath);
    }
View Full Code Here

Examples of org.apache.camel.component.dropbox.util.DropboxException

    private static void validatePathInUnix(String path) throws DropboxException {
        Pattern pattern = Pattern.compile("/*?(\\S+)/*?", Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(path);
        if (!matcher.matches()) {
            throw new DropboxException(path + " is not a valid path, must be in UNIX form!");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.