First review

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f8283d91
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f8283d91
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f8283d91

Branch: refs/heads/camel-2.18.x
Commit: f8283d913301b12834e7780acdd3af970e3838e5
Parents: a25d10d
Author: Edoardo Causarano <edoardo.causar...@gmail.com>
Authored: Thu Nov 24 09:39:49 2016 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Nov 25 10:02:21 2016 +0100

----------------------------------------------------------------------
 .../dropbox/core/DropboxAPIFacade.java          | 22 +++++-----
 .../dropbox/dto/DropboxMoveResult.java          | 12 ------
 .../component/dropbox/dto/DropboxResult.java    | 42 --------------------
 3 files changed, 11 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f8283d91/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
----------------------------------------------------------------------
diff --git 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
index 10c62d6..a4bf887 100755
--- 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
+++ 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/core/DropboxAPIFacade.java
@@ -54,7 +54,7 @@ public final class DropboxAPIFacade {
 
     /**
      * @param client the DbxClient performing dropbox low level operations
-     * @return the singleton instance of this class
+     * @param exchange the current Exchange
      */
     public DropboxAPIFacade(DbxClient client, Exchange exchange) {
         this.client = client;
@@ -69,14 +69,14 @@ public final class DropboxAPIFacade {
      *             in case of "add" the new file will be renamed in case
      *             a file with the same name already exists on dropbox.
      *             in case of "force" the file already existing with the same 
name will be overridden.
-     * @return a DropboxResult object reporting for each remote path the 
result of the operation.
+     * @return a result object reporting for each remote path the result of 
the operation.
      * @throws DropboxException
      */
     public DropboxFileUploadResult put(String localPath, String remotePath, 
DropboxUploadMode mode) throws DropboxException {
         //in case the remote path is not specified, the remotePath = localPath
         String dropboxPath = remotePath == null ? localPath : remotePath;
 
-        DbxEntry entry = null;
+        DbxEntry entry;
         try {
             entry = client.getMetadata(dropboxPath);
         } catch (DbxException e) {
@@ -125,7 +125,7 @@ public final class DropboxAPIFacade {
                 throw new DropboxException(localPath + " doesn't contain any 
files");
             }
 
-            HashMap<String, DropboxResultCode> resultMap = new HashMap<String, 
DropboxResultCode>(listFiles.size());
+            HashMap<String, DropboxResultCode> resultMap = new 
HashMap<>(listFiles.size());
             for (File file : listFiles) {
                 String absPath = file.getAbsolutePath();
                 int indexRemainingPath = localPath.length();
@@ -173,7 +173,7 @@ public final class DropboxAPIFacade {
      * The query param can be null.
      * @param remotePath  the remote path where starting the search from
      * @param query a space-separated list of substrings to search for. A file 
matches only if it contains all the substrings
-     * @return a DropboxResult object containing all the files found.
+     * @return a result object containing all the files found.
      * @throws DropboxException
      */
     public DropboxSearchResult search(String remotePath, String query) throws 
DropboxException {
@@ -201,7 +201,7 @@ public final class DropboxAPIFacade {
      * Delete every files and subdirectories inside the remote directory.
      * In case the remotePath is a file, delete the file.
      * @param remotePath  the remote location to delete
-     * @return a DropboxResult object with the result of the delete operation.
+     * @return a result object with the result of the delete operation.
      * @throws DropboxException
      */
     public DropboxDelResult del(String remotePath) throws DropboxException {
@@ -217,7 +217,7 @@ public final class DropboxAPIFacade {
      * Rename a remote path with the new path location.
      * @param remotePath the existing remote path to be renamed
      * @param newRemotePath the new remote path substituting the old one
-     * @return a DropboxResult object with the result of the move operation.
+     * @return a result object with the result of the move operation.
      * @throws DropboxException
      */
     public DropboxMoveResult move(String remotePath, String newRemotePath) 
throws DropboxException {
@@ -232,7 +232,7 @@ public final class DropboxAPIFacade {
     /**
      * Get the content of every file inside the remote path.
      * @param remotePath the remote path where to download from
-     * @return a DropboxResult object with the content (ByteArrayOutputStream) 
of every files inside the remote path.
+     * @return a result object with the content (ByteArrayOutputStream) of 
every files inside the remote path.
      * @throws DropboxException
      */
     public DropboxFileDownloadResult get(String remotePath) throws 
DropboxException {
@@ -256,7 +256,7 @@ public final class DropboxAPIFacade {
             if (listing == null) {
                 return Collections.emptyMap();
             } else if (listing.children == null) {
-                LOG.info("downloading a single file...");
+                LOG.debug("downloading a single file...");
                 Map.Entry<String, Object> entry = downloadSingleFile(path);
                 return Collections.singletonMap(entry.getKey(), 
entry.getValue());
             }
@@ -267,7 +267,7 @@ public final class DropboxAPIFacade {
                         Map.Entry<String, Object> singleFile = 
downloadSingleFile(entry.path);
                         result.put(singleFile.getKey(), singleFile.getValue());
                     } catch (DropboxException e) {
-                        LOG.warn("can't download from " + entry.path);
+                        LOG.warn("Cannot download from path={}, reason={}. 
This exception is ignored.", entry.path, e.getMessage());
                     }
                 } else {
                     Map<String, Object> filesInFolder = 
downloadFilesInFolder(entry.path);
@@ -285,7 +285,7 @@ public final class DropboxAPIFacade {
             OutputStreamBuilder target = 
OutputStreamBuilder.withExchange(exchange);
             DbxEntry.File downloadedFile = client.getFile(path, null, target);
             if (downloadedFile != null) {
-                LOG.info("downloaded path:" + path);
+                LOG.debug("downloaded path={}", path);
                 return new AbstractMap.SimpleEntry<>(path, target.build());
             } else {
                 return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/f8283d91/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxMoveResult.java
----------------------------------------------------------------------
diff --git 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxMoveResult.java
 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxMoveResult.java
index 091b405..11fe175 100755
--- 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxMoveResult.java
+++ 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxMoveResult.java
@@ -35,16 +35,4 @@ public class DropboxMoveResult {
     public String getNewPath() {
         return newPath;
     }
-
-    /*
-      Object payload contained in Exchange
-      Exchange Header and Body contains the mode path
-      @param exchange
-     */
-//    @Override
-//    public void populateExchange(Exchange exchange) {
-//        String movedPath = (String)resultEntries;
-//        exchange.getIn().setHeader(DropboxResultHeader.MOVED_PATH.name(), 
movedPath);
-//        exchange.getIn().setBody(movedPath);
-//    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/f8283d91/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxResult.java
----------------------------------------------------------------------
diff --git 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxResult.java
 
b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxResult.java
deleted file mode 100755
index 3d6fe8c..0000000
--- 
a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxResult.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.dropbox.dto;
-
-import java.io.OutputStream;
-import java.util.Map;
-
-import org.apache.camel.Exchange;
-
-public abstract class DropboxResult {
-
-    protected Object resultEntries;
-
-    /**
-     * Populate the camel exchange with the results from dropbox method 
invocations.
-     * @param exchange
-     */
-    public abstract void populateExchange(Exchange exchange);
-
-//    public Map<String, OutputStream> getResultEntries()  {
-//        return resultEntries;
-//    }
-
-    public void setResultEntries(Map<String, OutputStream> resultEntries) {
-        this.resultEntries = resultEntries;
-    }
-
-}

Reply via email to