You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/11/25 09:04:28 UTC

[14/20] camel git commit: Fix obvious mistakes (how can I test all this without going insane?!)

Fix obvious mistakes (how can I test all this without going insane?!)


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

Branch: refs/heads/camel-2.18.x
Commit: c00048badb58a173b38e37743397d7ddb7d9df81
Parents: 07c7638
Author: Edoardo Causarano <ed...@gmail.com>
Authored: Fri Nov 18 14:50:25 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Nov 25 10:01:55 2016 +0100

----------------------------------------------------------------------
 components/camel-dropbox/pom.xml                |  12 +++
 .../dropbox/core/DropboxAPIFacade.java          | 101 +++++++++----------
 .../dropbox/dto/DropboxFileDownloadResult.java  |  41 ++++----
 .../DropboxScheduledPollGetConsumer.java        |  39 ++++---
 .../DropboxScheduledPollSearchConsumer.java     |  32 +++---
 .../producer/DropboxDelProducer.java            |  46 ++++-----
 .../producer/DropboxGetProducer.java            |  57 +++++------
 .../producer/DropboxMoveProducer.java           |  47 +++++----
 .../producer/DropboxPutProducer.java            |  32 +++---
 .../producer/DropboxSearchProducer.java         |  35 +++----
 .../dropbox/util/DropboxException.java          |   4 +
 11 files changed, 227 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/pom.xml b/components/camel-dropbox/pom.xml
index c5f46f8..4ed701a 100755
--- a/components/camel-dropbox/pom.xml
+++ b/components/camel-dropbox/pom.xml
@@ -107,6 +107,18 @@
                 <artifactId>camel-maven-plugin</artifactId>
                 <version>${project.version}</version>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/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 ec5d485..76e435b 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
@@ -1,18 +1,18 @@
-/*
-  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.
+/**
+ * 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.core;
 
@@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.util.*;
 
 import static org.apache.camel.component.dropbox.util.DropboxConstants.DROPBOX_FILE_SEPARATOR;
@@ -43,20 +42,18 @@ public final class DropboxAPIFacade {
 
     private static final transient Logger LOG = LoggerFactory.getLogger(DropboxAPIFacade.class);
 
-    private DbxClient client;
+    private final DbxClient client;
+
     private final Exchange exchange;
 
-    private DropboxAPIFacade(Exchange exchange) {
-        this.exchange = exchange;
-    }
 
     /**
-     * Return a singleton instance of this class
      * @param client the DbxClient performing dropbox low level operations
      * @return the singleton instance of this class
      */
-    public static DropboxAPIFacade getInstance(DbxClient client, Exchange exchange) {
-        return new DropboxAPIFacade(exchange);
+    public DropboxAPIFacade(DbxClient client, Exchange exchange) {
+        this.client = client;
+        this.exchange = exchange;
     }
 
     /**
@@ -74,7 +71,7 @@ public final class DropboxAPIFacade {
         //in case the remote path is not specified, the remotePath = localPath
         String dropboxPath = remotePath == null ? localPath : remotePath;
 
-        DbxEntry entry;
+        DbxEntry entry = null;
         try {
             entry = client.getMetadata(dropboxPath);
         } catch (DbxException e) {
@@ -159,8 +156,7 @@ public final class DropboxAPIFacade {
             } else {
                 uploadMode = DbxWriteMode.add();
             }
-            uploadedFile = client.uploadFile(dropboxPath,
-                            uploadMode, inputFile.length(), inputStream);
+            uploadedFile = client.uploadFile(dropboxPath, uploadMode, inputFile.length(), inputStream);
             return uploadedFile;
         } finally {
             inputStream.close();
@@ -171,15 +167,16 @@ public final class DropboxAPIFacade {
      * Search inside a remote path including its sub directories.
      * The query param can be null.
      * @param remotePath  the remote path where starting the search from
-     * @param query a space-separated list of sub-strings to search for. A file matches only if it contains all the sub-strings
+     * @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.
      * @throws DropboxException
      */
     public DropboxSearchResult search(String remotePath, String query) throws DropboxException {
+        DbxEntry.WithChildren listing;
         if (query == null) {
             LOG.info("search no query");
             try {
-                DbxEntry.WithChildren listing = client.getMetadataWithChildren(remotePath);
+                listing = client.getMetadataWithChildren(remotePath);
                 return new DropboxSearchResult(listing.children);
             } catch (DbxException e) {
                 throw new DropboxException(remotePath + " does not exist or can't obtain metadata");
@@ -205,10 +202,10 @@ public final class DropboxAPIFacade {
     public DropboxDelResult del(String remotePath) throws DropboxException {
         try {
             client.delete(remotePath);
-            return new DropboxDelResult(remotePath);
         } catch (DbxException e) {
             throw new DropboxException(remotePath + " does not exist or can't obtain metadata");
         }
+        return new DropboxDelResult(remotePath);
     }
 
     /**
@@ -248,45 +245,43 @@ public final class DropboxAPIFacade {
     }
 
 
-    private Map<String, OutputStream> downloadFilesInFolder(String path) throws DropboxException {
+    private Map<String, Object> downloadFilesInFolder(String path) throws DropboxException {
         try {
             DbxEntry.WithChildren listing = client.getMetadataWithChildren(path);
-            if (listing.children == null) {
+            if (listing == null) {
+                return Collections.emptyMap();
+            } else if (listing.children == null) {
                 LOG.info("downloading a single file...");
-                Map.Entry<String, OutputStream> entry = downloadSingleFile(path);
-                if (entry != null) {
-                    return Collections.singletonMap(entry.getKey(), entry.getValue());
-                }
-            } else {
-                Map<String, OutputStream> result = new HashMap<String, OutputStream>();
-                for (DbxEntry entry : listing.children) {
-                    if (entry.isFile()) {
-                        try {
-                            Map.Entry<String, OutputStream> singleFile = downloadSingleFile(entry.path);
-                            result.put(singleFile.getKey(), singleFile.getValue());
-                        } catch (DropboxException e) {
-                            LOG.warn("can't download from " + entry.path);
-                        }
-                    } else {
-                        Map<String, OutputStream> filesInFolder = downloadFilesInFolder(entry.path);
-                        result.putAll(filesInFolder);
+                Map.Entry<String, Object> entry = downloadSingleFile(path);
+                return Collections.singletonMap(entry.getKey(), entry.getValue());
+            }
+            Map<String, Object> result = new HashMap<>();
+            for (DbxEntry entry : listing.children) {
+                if (entry.isFile()) {
+                    try {
+                        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);
                     }
+                } else {
+                    Map<String, Object> filesInFolder = downloadFilesInFolder(entry.path);
+                    result.putAll(filesInFolder);
                 }
-                return result;
             }
+            return result;
         } catch (DbxException e) {
-            throw new DropboxException(path + " does not exist or can't obtain metadata");
+            throw new DropboxException(e);
         }
-        return Collections.emptyMap();
     }
 
-    private Map.Entry<String, OutputStream> downloadSingleFile(String path) throws DropboxException {
+    private Map.Entry<String, Object> downloadSingleFile(String path) throws DropboxException {
         try {
             OutputStreamBuilder target = OutputStreamBuilder.withExchange(exchange);
             DbxEntry.File downloadedFile = client.getFile(path, null, target);
             if (downloadedFile != null) {
                 LOG.info("downloaded path:" + path);
-                return new AbstractMap.SimpleEntry<String, OutputStream>(path, target);
+                return new AbstractMap.SimpleEntry<>(path, target.build());
             } else {
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxFileDownloadResult.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxFileDownloadResult.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxFileDownloadResult.java
index 3b7d074..b2d2c21 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxFileDownloadResult.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/dto/DropboxFileDownloadResult.java
@@ -1,34 +1,33 @@
-/*
-  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.
+ /**
+ * 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.Collections;
-import java.util.Map;
+ import java.util.Collections;
+ import java.util.Map;
 
 public class DropboxFileDownloadResult {
 
-    private final Map<String, OutputStream> entries;
+    private final Map<String, Object> entries;
 
-    public DropboxFileDownloadResult(Map<String, OutputStream> entries) {
+    public DropboxFileDownloadResult(Map<String, Object> entries) {
         this.entries = entries;
     }
 
-    public Map<String, OutputStream> getEntries() {
+    public Map<String, Object> getEntries() {
         return Collections.unmodifiableMap(entries);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollGetConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollGetConsumer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollGetConsumer.java
index 317c4e4..ea16bee 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollGetConsumer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollGetConsumer.java
@@ -1,18 +1,18 @@
-/*
-  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.
+/**
+ * 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.integration.consumer;
 
@@ -24,7 +24,6 @@ import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
 import org.apache.camel.component.dropbox.dto.DropboxFileDownloadResult;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 
-import java.io.OutputStream;
 import java.util.Map;
 
 public class DropboxScheduledPollGetConsumer extends DropboxScheduledPollConsumer {
@@ -41,18 +40,18 @@ public class DropboxScheduledPollGetConsumer extends DropboxScheduledPollConsume
     @Override
     protected int poll() throws Exception {
         Exchange exchange = endpoint.createExchange();
-        DropboxFileDownloadResult result = DropboxAPIFacade.getInstance(configuration.getClient(), exchange)
+        DropboxFileDownloadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .get(configuration.getRemotePath());
 
-        Map<String, OutputStream> map = result.getEntries();
+        Map<String, Object> map = result.getEntries();
         if (map.size() == 1) {
-            for (Map.Entry<String, OutputStream> entry : map.entrySet()) {
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
                 exchange.getIn().setHeader(DropboxResultHeader.DOWNLOADED_FILE.name(), entry.getKey());
                 exchange.getIn().setBody(entry.getValue());
             }
         } else {
             StringBuilder pathsExtracted = new StringBuilder();
-            for (Map.Entry<String, OutputStream> entry : map.entrySet()) {
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
                 pathsExtracted.append(entry.getKey()).append("\n");
             }
             exchange.getIn().setHeader(DropboxResultHeader.DOWNLOADED_FILES.name(), pathsExtracted.toString());

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollSearchConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollSearchConsumer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollSearchConsumer.java
index 6d73f53..6d63136 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollSearchConsumer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/consumer/DropboxScheduledPollSearchConsumer.java
@@ -1,18 +1,18 @@
-/*
-  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.
+/**
+ * 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.integration.consumer;
 
@@ -39,7 +39,7 @@ public class DropboxScheduledPollSearchConsumer extends DropboxScheduledPollCons
     @Override
     protected int poll() throws Exception {
         Exchange exchange = endpoint.createExchange();
-        DropboxSearchResult result = DropboxAPIFacade.getInstance(configuration.getClient(), exchange)
+        DropboxSearchResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .search(configuration.getRemotePath(), configuration.getQuery());
 
         StringBuilder fileExtracted = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
index 82e840e..8d97b59 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxDelProducer.java
@@ -1,27 +1,27 @@
-/*
-  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.
+ /**
+ * 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.integration.producer;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.component.dropbox.DropboxConfiguration;
-import org.apache.camel.component.dropbox.DropboxEndpoint;
-import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
-import org.apache.camel.component.dropbox.dto.DropboxDelResult;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+ import org.apache.camel.Exchange;
+ import org.apache.camel.component.dropbox.DropboxConfiguration;
+ import org.apache.camel.component.dropbox.DropboxEndpoint;
+ import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
+ import org.apache.camel.component.dropbox.dto.DropboxDelResult;
+ import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 
 public class DropboxDelProducer extends DropboxProducer {
     
@@ -31,14 +31,14 @@ public class DropboxDelProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxDelResult result = DropboxAPIFacade
-            .getInstance(configuration.getClient(), exchange)
+        DropboxDelResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
             .del(configuration.getRemotePath());
 
             exchange.getIn().setHeader(DropboxResultHeader.DELETED_PATH.name(), result.getEntry());
             exchange.getIn().setBody(result.getEntry());
 
         log.info("Deleted: " + configuration.getRemotePath());
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
index 419b482..2754538 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxGetProducer.java
@@ -1,32 +1,31 @@
-/*
-  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.
+ /**
+ * 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.integration.producer;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.component.dropbox.DropboxConfiguration;
-import org.apache.camel.component.dropbox.DropboxEndpoint;
-import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
-import org.apache.camel.component.dropbox.dto.DropboxFileDownloadResult;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+ import org.apache.camel.Exchange;
+ import org.apache.camel.component.dropbox.DropboxConfiguration;
+ import org.apache.camel.component.dropbox.DropboxEndpoint;
+ import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
+ import org.apache.camel.component.dropbox.dto.DropboxFileDownloadResult;
+ import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
 
-import java.io.OutputStream;
-import java.util.Map;
+ import java.util.Map;
 
 public class DropboxGetProducer extends DropboxProducer {
     private static final transient Logger LOG = LoggerFactory.getLogger(DropboxGetProducer.class);
@@ -37,18 +36,18 @@ public class DropboxGetProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxFileDownloadResult result = DropboxAPIFacade.getInstance(configuration.getClient(), exchange)
+        DropboxFileDownloadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .get(configuration.getRemotePath());
 
-        Map<String, OutputStream> map = result.getEntries();
+        Map<String, Object> map = result.getEntries();
         if (map.size() == 1) {
-            for (Map.Entry<String, OutputStream> entry : map.entrySet()) {
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
                 exchange.getIn().setHeader(DropboxResultHeader.DOWNLOADED_FILE.name(), entry.getKey());
                 exchange.getIn().setBody(entry.getValue());
             }
         } else {
             StringBuilder pathsExtracted = new StringBuilder();
-            for (Map.Entry<String, OutputStream> entry : map.entrySet()) {
+            for (Map.Entry<String, Object> entry : map.entrySet()) {
                 pathsExtracted.append(entry.getKey()).append("\n");
             }
             exchange.getIn().setHeader(DropboxResultHeader.DOWNLOADED_FILES.name(), pathsExtracted.toString());

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
index b5c6db8..a4011d6 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxMoveProducer.java
@@ -1,38 +1,37 @@
-/*
-  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.
+ /**
+ * 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.integration.producer;
 
-import org.apache.camel.Exchange;
-import org.apache.camel.component.dropbox.DropboxConfiguration;
-import org.apache.camel.component.dropbox.DropboxEndpoint;
-import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
-import org.apache.camel.component.dropbox.dto.DropboxMoveResult;
-import org.apache.camel.component.dropbox.util.DropboxResultHeader;
+ import org.apache.camel.Exchange;
+ import org.apache.camel.component.dropbox.DropboxConfiguration;
+ import org.apache.camel.component.dropbox.DropboxEndpoint;
+ import org.apache.camel.component.dropbox.core.DropboxAPIFacade;
+ import org.apache.camel.component.dropbox.dto.DropboxMoveResult;
+ import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 
 public class DropboxMoveProducer extends DropboxProducer {
-    
+
     public DropboxMoveProducer(DropboxEndpoint endpoint, DropboxConfiguration configuration) {
         super(endpoint, configuration);
     }
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxMoveResult result = DropboxAPIFacade
-                .getInstance(configuration.getClient(), exchange)
+        DropboxMoveResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .move(configuration.getRemotePath(), configuration.getNewRemotePath());
 
         exchange.getIn().setHeader(DropboxResultHeader.MOVED_PATH.name(), result.getOldPath());

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
index 5d6dbd4..75b2b72 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxPutProducer.java
@@ -1,18 +1,18 @@
-/*
-  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.
+/**
+ * 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.integration.producer;
 
@@ -37,7 +37,7 @@ public class DropboxPutProducer extends DropboxProducer {
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxFileUploadResult result = DropboxAPIFacade.getInstance(configuration.getClient(), exchange)
+        DropboxFileUploadResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .put(configuration.getLocalPath(), configuration.getRemotePath(), configuration.getUploadMode());
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
index eb8f4c1..c51a371 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/integration/producer/DropboxSearchProducer.java
@@ -1,18 +1,19 @@
-/*
-  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.
+/**
+/**
+ * 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.integration.producer;
 
@@ -25,14 +26,14 @@ import org.apache.camel.component.dropbox.dto.DropboxSearchResult;
 import org.apache.camel.component.dropbox.util.DropboxResultHeader;
 
 public class DropboxSearchProducer extends DropboxProducer {
-    
+
     public DropboxSearchProducer(DropboxEndpoint endpoint, DropboxConfiguration configuration) {
         super(endpoint, configuration);
     }
 
     @Override
     public void process(Exchange exchange) throws Exception {
-        DropboxSearchResult result = DropboxAPIFacade.getInstance(configuration.getClient(), exchange)
+        DropboxSearchResult result = new DropboxAPIFacade(configuration.getClient(), exchange)
                 .search(configuration.getRemotePath(), configuration.getQuery());
 
         StringBuilder fileExtracted = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/camel/blob/c00048ba/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxException.java
----------------------------------------------------------------------
diff --git a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxException.java b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxException.java
index 453c388..7b1c738 100755
--- a/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxException.java
+++ b/components/camel-dropbox/src/main/java/org/apache/camel/component/dropbox/util/DropboxException.java
@@ -20,6 +20,10 @@ public class DropboxException extends Exception {
 
     private static final long serialVersionUID = 1L;
 
+    public DropboxException(Throwable e) {
+        super(e);
+    }
+
     public DropboxException(String message) {
         super(message);
     }