Repository: camel Updated Branches: refs/heads/master 7d7bcb9dc -> b12fa5149
CAMEL-7999: component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b12fa514 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b12fa514 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b12fa514 Branch: refs/heads/master Commit: b12fa5149179a5577a6d9bdea0eec4e95fda75cd Parents: 9fb60cd Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Feb 26 13:10:26 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Feb 26 13:10:35 2015 +0100 ---------------------------------------------------------------------- .../component/file/remote/FtpComponent.java | 2 + .../file/remote/RemoteFileConfiguration.java | 41 +++++++++++++++++--- ...ponentConfigurationAndDocumentationTest.java | 2 +- 3 files changed, 38 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b12fa514/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java index 9aeee72..7222031 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java @@ -49,6 +49,8 @@ public class FtpComponent extends RemoteFileComponent<FTPFile> { FtpEndpoint<FTPFile> answer = new FtpEndpoint<FTPFile>(uri, this, config); extractAndSetFtpClientConfigParameters(parameters, answer); extractAndSetFtpClientParameters(parameters, answer); + config.setDirectory(remaining); + config.setDirectoryName(remaining); return answer; } http://git-wip-us.apache.org/repos/asf/camel/blob/b12fa514/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java index 6114aee..a8590e9 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java @@ -19,6 +19,7 @@ package org.apache.camel.component.file.remote; import java.net.URI; import org.apache.camel.component.file.GenericFileConfiguration; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.util.ObjectHelper; @@ -39,17 +40,19 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { // component name is implied as the protocol, eg ftp/ftps etc private String protocol; - @UriPath + @UriPath @Metadata(required = "true") private String host; @UriPath private int port; + @UriPath(name = "directoryName") + private String directoryName; @UriParam private String username; @UriParam private String password; - @UriParam(defaultValue = "false") + @UriParam private boolean binary; - @UriParam(defaultValue = "false") + @UriParam private boolean passiveMode; @UriParam(defaultValue = "10000") private int connectTimeout = 10000; @@ -57,7 +60,7 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { private int timeout = 30000; @UriParam private int soTimeout; - @UriParam(defaultValue = "false") + @UriParam private boolean throwExceptionOnConnectFailed; @UriParam private String siteCommand; @@ -65,11 +68,11 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { private boolean stepwise = true; @UriParam(defaultValue = "Auto") private PathSeparator separator = PathSeparator.Auto; - @UriParam(defaultValue = "false") + @UriParam private boolean streamDownload; @UriParam(defaultValue = "true") private boolean useList = true; - @UriParam(defaultValue = "false") + @UriParam private boolean ignoreFileNotFoundOrPermissionError; public RemoteFileConfiguration() { @@ -122,6 +125,9 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { return host; } + /** + * Hostname of the FTP server + */ public void setHost(String host) { this.host = host; } @@ -130,6 +136,9 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { return port; } + /** + * Port of the FTP server + */ public void setPort(int port) { // only set port if provided with a positive number if (port > 0) { @@ -141,6 +150,9 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { return password; } + /** + * Password to use for login + */ public void setPassword(String password) { this.password = password; } @@ -149,6 +161,9 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { return protocol; } + /** + * The ftp protocol to use + */ public void setProtocol(String protocol) { this.protocol = protocol; } @@ -157,10 +172,24 @@ public abstract class RemoteFileConfiguration extends GenericFileConfiguration { return username; } + /** + * Username to use for login + */ public void setUsername(String username) { this.username = username; } + public String getDirectoryName() { + return directoryName; + } + + /** + * The starting directory + */ + public void setDirectoryName(String directoryName) { + this.directoryName = directoryName; + } + public boolean isBinary() { return binary; } http://git-wip-us.apache.org/repos/asf/camel/blob/b12fa514/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpComponentConfigurationAndDocumentationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpComponentConfigurationAndDocumentationTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpComponentConfigurationAndDocumentationTest.java index e424012..de8945c 100644 --- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpComponentConfigurationAndDocumentationTest.java +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpComponentConfigurationAndDocumentationTest.java @@ -42,7 +42,7 @@ public class FtpComponentConfigurationAndDocumentationTest extends CamelTestSupp String json = compConf.createParameterJsonSchema(); assertNotNull(json); - assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"type\": \"string\"")); + assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"required\": \"true\", \"type\": \"string\"")); assertTrue(json.contains("\"port\": { \"kind\": \"path\", \"type\": \"integer\"")); assertTrue(json.contains("\"maximumReconnectAttempts\": { \"kind\": \"parameter\", \"type\": \"integer\"")); assertTrue(json.contains("\"dataTimeout\": { \"kind\": \"parameter\", \"type\": \"integer\""));