Package com.dropbox.core

Examples of com.dropbox.core.DbxEntry


        DropboxResult result = new DropboxFileUploadResult();
        //a map representing for each path the result of the put operation
        Map<String, DropboxResultCode> resultEntries = null;
        //in case the remote path is not specified, the remotePath = localPath
        String dropboxPath = remotePath == null ? localPath : remotePath;
        DbxEntry entry = null;
        try {
            entry = DropboxAPIFacade.client.getMetadata(dropboxPath);
        } catch (DbxException e) {
            throw new DropboxException(dropboxPath + " does not exist or can't obtain metadata");
        }
        File fileLocalPath = new File(localPath);
        //verify uploading of a single file
        if (fileLocalPath.isFile()) {
            //check if dropbox file exists
            if (entry != null && !entry.isFile()) {
                throw new DropboxException(dropboxPath + " exists on dropbox and is not a file!");
            }
            //in case the entry not exists on dropbox check if the filename should be appended
            if (entry == null) {
                if (dropboxPath.endsWith(DROPBOX_FILE_SEPARATOR)) {
                    dropboxPath = dropboxPath + fileLocalPath.getName();
                }
            }
            resultEntries = new HashMap<String, DropboxResultCode>(1);
            try {
                DbxEntry.File uploadedFile = putSingleFile(fileLocalPath, dropboxPath, mode);
                if (uploadedFile == null) {
                    resultEntries.put(dropboxPath, DropboxResultCode.KO);
                } else {
                    resultEntries.put(dropboxPath, DropboxResultCode.OK);
                }

            } catch (Exception ex) {
                resultEntries.put(dropboxPath, DropboxResultCode.KO);
            } finally {
                result.setResultEntries(resultEntries);
            }
            return result;
        } else {       //verify uploading of a list of files inside a dir
            LOG.info("uploading a dir...");
            //check if dropbox folder exists
            if (entry != null && !entry.isFolder()) {
                throw new DropboxException(dropboxPath + " exists on dropbox and is not a folder!");
            }
            if (!dropboxPath.endsWith(DROPBOX_FILE_SEPARATOR)) {
                dropboxPath = dropboxPath + DROPBOX_FILE_SEPARATOR;
            }
View Full Code Here


      try {

        Item parentItem = item.getParent();
        String parentPath = buildPath(parentItem);
        String path = parentPath + SEPARATOR + handler.getLocalEncryptedTitle(item);
        DbxEntry entry;

        if (item.isType(ItemType.FOLDER)) {
          entry = client.createFolder(path);
        } else {
          byte[] data = handler.getLocalEncryptedBinary(item);
View Full Code Here

TOP

Related Classes of com.dropbox.core.DbxEntry

Copyright © 2018 www.massapicom. 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.