Author: davsclaus Date: Fri Jan 30 09:10:59 2009 New Revision: 739213 URL: http://svn.apache.org/viewvc?rev=739213&view=rev Log: CAMEL-1241: Renamed the ftp/sftp components. Moved ftp/sftp configuration to where they belong.
Added: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileComponent.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileComponent.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (contents, props changed) - copied, changed from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java Removed: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileComponent.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileComponent.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/ftp camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/sftp camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileComponent.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileComponent.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileComponent.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java Fri Jan 30 09:10:59 2009 @@ -24,15 +24,14 @@ import org.apache.commons.net.ftp.FTPFile; /** - * Standard FTP Remote File Component + * FTP Component */ -public class FtpRemoteFileComponent extends RemoteFileComponent<FTPFile> { +public class FtpComponent extends RemoteFileComponent<FTPFile> { - public FtpRemoteFileComponent() { - super(); + public FtpComponent() { } - public FtpRemoteFileComponent(CamelContext context) { + public FtpComponent(CamelContext context) { super(context); } @@ -48,10 +47,10 @@ // lets make sure we create a new configuration as each endpoint can customize its own version // must pass on baseUri to the configuration (see above) - FtpRemoteFileConfiguration config = new FtpRemoteFileConfiguration(new URI(baseUri)); + FtpConfiguration config = new FtpConfiguration(new URI(baseUri)); - FtpRemoteFileOperations operations = new FtpRemoteFileOperations(); - return new FtpRemoteFileEndpoint(uri, this, operations, config); + FtpOperations operations = new FtpOperations(); + return new FtpEndpoint(uri, this, operations, config); } protected void afterPropertiesSet(GenericFileEndpoint<FTPFile> endpoint) throws Exception { Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java Fri Jan 30 09:10:59 2009 @@ -18,15 +18,21 @@ import java.net.URI; -public class FtpRemoteFileConfiguration extends RemoteFileConfiguration { +import org.apache.commons.net.ftp.FTPClientConfig; + +/** + * FTP configuration + */ +public class FtpConfiguration extends RemoteFileConfiguration { public static final int DEFAULT_FTP_PORT = 21; + private FTPClientConfig ftpClientConfig; - public FtpRemoteFileConfiguration() { + public FtpConfiguration() { setProtocol("ftp"); } - public FtpRemoteFileConfiguration(URI uri) { + public FtpConfiguration(URI uri) { super(uri); } @@ -35,4 +41,12 @@ setPort(DEFAULT_FTP_PORT); } + public FTPClientConfig getFtpClientConfig() { + return ftpClientConfig; + } + + public void setFtpClientConfig(FTPClientConfig ftpClientConfig) { + this.ftpClientConfig = ftpClientConfig; + } + } Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConfiguration.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java Fri Jan 30 09:10:59 2009 @@ -19,13 +19,16 @@ import org.apache.camel.Processor; import org.apache.commons.net.ftp.FTPFile; -public class FtpRemoteFileEndpoint extends RemoteFileEndpoint<FTPFile> { +/** + * FTP endpoint + */ +public class FtpEndpoint extends RemoteFileEndpoint<FTPFile> { - public FtpRemoteFileEndpoint() { - this.operations = new FtpRemoteFileOperations(); + public FtpEndpoint() { + this.operations = new FtpOperations(); } - public FtpRemoteFileEndpoint(String uri, FtpRemoteFileComponent component, FtpRemoteFileOperations operations, + public FtpEndpoint(String uri, FtpComponent component, FtpOperations operations, RemoteFileConfiguration configuration) { super(uri, component, operations, configuration); } Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java Fri Jan 30 09:10:59 2009 @@ -37,15 +37,15 @@ /** * FTP remote file operations */ -public class FtpRemoteFileOperations implements RemoteFileOperations<FTPFile> { - private static final transient Log LOG = LogFactory.getLog(FtpRemoteFileOperations.class); +public class FtpOperations implements RemoteFileOperations<FTPFile> { + private static final transient Log LOG = LogFactory.getLog(FtpOperations.class); private final FTPClient client; - public FtpRemoteFileOperations() { + public FtpOperations() { this.client = new FTPClient(); } - public FtpRemoteFileOperations(FTPClient client) { + public FtpOperations(FTPClient client) { this.client = client; } @@ -58,9 +58,11 @@ int port = config.getPort(); String username = config.getUsername(); - if (config.getFtpClientConfig() != null) { - LOG.trace("Configuring FTPFile with config: " + config.getFtpClientConfig()); - client.configure(config.getFtpClientConfig()); + FtpConfiguration ftpConfig = (FtpConfiguration) config; + + if (ftpConfig.getFtpClientConfig() != null) { + LOG.trace("Configuring FTPFile with config: " + ftpConfig.getFtpClientConfig()); + client.configure(ftpConfig.getFtpClientConfig()); } LOG.trace("Connecting to " + config.remoteServerInformation()); Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java Fri Jan 30 09:10:59 2009 @@ -19,7 +19,6 @@ import java.net.URI; import org.apache.camel.component.file.GenericFileConfiguration; -import org.apache.commons.net.ftp.FTPClientConfig; /** * Configuration of the FTP server @@ -32,10 +31,6 @@ private String password; private boolean binary; private boolean passiveMode; - private String knownHostsFile; - private String privateKeyFile; - private String privateKeyFilePassphrase; - private FTPClientConfig ftpClientConfig; public RemoteFileConfiguration() { } @@ -76,7 +71,8 @@ } public void setPort(int port) { - if (port != -1) { // use default + // only set port if provided with a positive number + if (port > 0) { this.port = port; } } @@ -126,35 +122,4 @@ this.passiveMode = passiveMode; } - public String getKnownHostsFile() { - return knownHostsFile; - } - - public void setKnownHostsFile(String knownHostsFile) { - this.knownHostsFile = knownHostsFile; - } - - public String getPrivateKeyFile() { - return privateKeyFile; - } - - public void setPrivateKeyFile(String privateKeyFile) { - this.privateKeyFile = privateKeyFile; - } - - public String getPrivateKeyFilePassphrase() { - return privateKeyFilePassphrase; - } - - public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) { - this.privateKeyFilePassphrase = privateKeyFilePassphrase; - } - - public FTPClientConfig getFtpClientConfig() { - return ftpClientConfig; - } - - public void setFtpClientConfig(FTPClientConfig ftpClientConfig) { - this.ftpClientConfig = ftpClientConfig; - } } Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileComponent.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileComponent.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileComponent.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java Fri Jan 30 09:10:59 2009 @@ -24,32 +24,33 @@ import org.apache.camel.component.file.GenericFileEndpoint; /** - * SFTP Remote File Component + * Secure FTP Component */ -public class SftpRemoteFileComponent extends RemoteFileComponent<ChannelSftp.LsEntry> { +public class SftpComponent extends RemoteFileComponent<ChannelSftp.LsEntry> { - public SftpRemoteFileComponent() { - super(); + public SftpComponent() { } - public SftpRemoteFileComponent(CamelContext context) { + public SftpComponent(CamelContext context) { super(context); } @Override protected GenericFileEndpoint<ChannelSftp.LsEntry> buildFileEndpoint(String uri, String remaining, Map parameters) throws Exception { - // get the uri part before the options as they can be non URI valid such - // as the expression using $ chars + // get the base uri part before the options as they can be non URI valid such as the expression using $ chars + // and the URI constructor will regard $ as an illegal character and we dont want to enforce end users to + // to espace the $ for the expression (file language) + String baseUri = uri; if (uri.indexOf("?") != -1) { - uri = uri.substring(0, uri.indexOf("?")); + baseUri = uri.substring(0, uri.indexOf("?")); } // lets make sure we create a new configuration as each endpoint can // customize its own version - SftpRemoteFileConfiguration config = new SftpRemoteFileConfiguration(new URI(uri)); + SftpConfiguration config = new SftpConfiguration(new URI(baseUri)); - SftpRemoteFileOperations operations = new SftpRemoteFileOperations(); - return new SftpRemoteFileEndpoint(uri, this, operations, config); + SftpOperations operations = new SftpOperations(); + return new SftpEndpoint(uri, this, operations, config); } protected void afterPropertiesSet(GenericFileEndpoint<ChannelSftp.LsEntry> endpoint) throws Exception { Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java Fri Jan 30 09:10:59 2009 @@ -18,15 +18,21 @@ import java.net.URI; -public class SftpRemoteFileConfiguration extends RemoteFileConfiguration { +/** + * Secure FTP configuration + */ +public class SftpConfiguration extends RemoteFileConfiguration { public static final int DEFAULT_SFTP_PORT = 22; + private String knownHostsFile; + private String privateKeyFile; + private String privateKeyFilePassphrase; - public SftpRemoteFileConfiguration() { + public SftpConfiguration() { setProtocol("sftp"); } - public SftpRemoteFileConfiguration(URI uri) { + public SftpConfiguration(URI uri) { super(uri); } @@ -35,4 +41,27 @@ setPort(DEFAULT_SFTP_PORT); } + public String getKnownHostsFile() { + return knownHostsFile; + } + + public void setKnownHostsFile(String knownHostsFile) { + this.knownHostsFile = knownHostsFile; + } + + public String getPrivateKeyFile() { + return privateKeyFile; + } + + public void setPrivateKeyFile(String privateKeyFile) { + this.privateKeyFile = privateKeyFile; + } + + public String getPrivateKeyFilePassphrase() { + return privateKeyFilePassphrase; + } + + public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) { + this.privateKeyFilePassphrase = privateKeyFilePassphrase; + } } Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java Fri Jan 30 09:10:59 2009 @@ -24,7 +24,7 @@ import org.apache.camel.util.ObjectHelper; /** - * SFTP consumer + * Secure FTP consumer */ public class SftpConsumer extends RemoteFileConsumer<ChannelSftp.LsEntry> { Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java Fri Jan 30 09:10:59 2009 @@ -20,13 +20,16 @@ import org.apache.camel.Processor; -public class SftpRemoteFileEndpoint extends RemoteFileEndpoint<ChannelSftp.LsEntry> { +/** + * Secure FTP endpoint + */ +public class SftpEndpoint extends RemoteFileEndpoint<ChannelSftp.LsEntry> { - public SftpRemoteFileEndpoint() { - this.operations = new SftpRemoteFileOperations(); + public SftpEndpoint() { + this.operations = new SftpOperations(); } - public SftpRemoteFileEndpoint(String uri, SftpRemoteFileComponent component, RemoteFileOperations<ChannelSftp.LsEntry> operations, + public SftpEndpoint(String uri, SftpComponent component, RemoteFileOperations<ChannelSftp.LsEntry> operations, RemoteFileConfiguration configuration) { super(uri, component, operations, configuration); } Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Copied: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (from r739174, camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java) URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?p2=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java&p1=camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java&r1=739174&r2=739213&rev=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Fri Jan 30 09:10:59 2009 @@ -44,8 +44,8 @@ /** * SFTP remote file operations */ -public class SftpRemoteFileOperations implements RemoteFileOperations<ChannelSftp.LsEntry> { - private static final transient Log LOG = LogFactory.getLog(SftpRemoteFileOperations.class); +public class SftpOperations implements RemoteFileOperations<ChannelSftp.LsEntry> { + private static final transient Log LOG = LogFactory.getLog(SftpOperations.class); private ChannelSftp channel; private Session session; @@ -81,18 +81,20 @@ protected Session createSession(final RemoteFileConfiguration configuration) throws JSchException { final JSch jsch = new JSch(); - if (isNotEmpty(configuration.getPrivateKeyFile())) { - LOG.debug("Using private keyfile: " + configuration.getPrivateKeyFile()); - if (isNotEmpty(configuration.getPrivateKeyFilePassphrase())) { - jsch.addIdentity(configuration.getPrivateKeyFile(), configuration.getPrivateKeyFilePassphrase()); + SftpConfiguration sftpConfig = (SftpConfiguration) configuration; + + if (isNotEmpty(sftpConfig.getPrivateKeyFile())) { + LOG.debug("Using private keyfile: " + sftpConfig.getPrivateKeyFile()); + if (isNotEmpty(sftpConfig.getPrivateKeyFilePassphrase())) { + jsch.addIdentity(sftpConfig.getPrivateKeyFile(), sftpConfig.getPrivateKeyFilePassphrase()); } else { - jsch.addIdentity(configuration.getPrivateKeyFile()); + jsch.addIdentity(sftpConfig.getPrivateKeyFile()); } } - if (isNotEmpty(configuration.getKnownHostsFile())) { - LOG.debug("Using knownhosts file: " + configuration.getKnownHostsFile()); - jsch.setKnownHosts(configuration.getKnownHostsFile()); + if (isNotEmpty(sftpConfig.getKnownHostsFile())) { + LOG.debug("Using knownhosts file: " + sftpConfig.getKnownHostsFile()); + jsch.setKnownHosts(sftpConfig.getKnownHostsFile()); } final Session session = jsch.getSession(configuration.getUsername(), configuration.getHost(), configuration.getPort()); Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/ftp URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/ftp?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/ftp (original) +++ camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/ftp Fri Jan 30 09:10:59 2009 @@ -15,5 +15,5 @@ # limitations under the License. # -class=org.apache.camel.component.file.remote.FtpRemoteFileComponent +class=org.apache.camel.component.file.remote.FtpComponent strategy.factory.class=org.apache.camel.component.file.strategy.GenericFileProcessStrategyFactory Modified: camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/sftp URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/sftp?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/sftp (original) +++ camel/trunk/components/camel-ftp/src/main/resources/META-INF/services/org/apache/camel/component/sftp Fri Jan 30 09:10:59 2009 @@ -15,5 +15,5 @@ # limitations under the License. # -class=org.apache.camel.component.file.remote.SftpRemoteFileComponent +class=org.apache.camel.component.file.remote.SftpComponent strategy.factory.class=org.apache.camel.component.file.remote.strategy.RemoteFileProcessStrategyFactory Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpDirectoryToBinaryFilesTest.java Fri Jan 30 09:10:59 2009 @@ -34,7 +34,7 @@ private String getFtpUrl() { return "ftp://ad...@localhost:" + getPort() + "/incoming/?password=admin&directory=true" - + "&binary=true&consumer.useFixedDelay=false&setNames=true&recursive=false&consumer.delay=5000"; + + "&binary=true&consumer.useFixedDelay=false&recursive=false&consumer.delay=5000"; } @Override Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpSetNamesWithMultiDirectoriesTest.java Fri Jan 30 09:10:59 2009 @@ -35,7 +35,7 @@ // must user "consumer." prefix on the parameters to the file component private String getFtpUrl() { return "ftp://ad...@localhost:" + getPort() + "/incoming?password=admin&binary=true" - + "&consumer.delay=2000&recursive=true&setNames=true"; + + "&consumer.delay=2000&recursive=true"; } @Override Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpServerTestSupport.java Fri Jan 30 09:10:59 2009 @@ -31,7 +31,6 @@ */ public abstract class FtpServerTestSupport extends ContextTestSupport { - // TODO: Figure out to set the home dir of the ftpServer from java public static final String FTP_ROOT_DIR = "./res/home/"; protected FtpServer ftpServer; @@ -90,7 +89,10 @@ // save to file, do not append FileOutputStream fos = new FileOutputStream(file, false); - fos.write(("" + getPort()).getBytes()); - fos.close(); + try { + fos.write(("" + getPort()).getBytes()); + } finally { + fos.close(); + } } } Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java (original) +++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java Fri Jan 30 09:10:59 2009 @@ -30,8 +30,8 @@ public void testFtpConfigurationDefaults() { Endpoint endpoint = context.getEndpoint("ftp://hostname"); - assertIsInstanceOf(FtpRemoteFileEndpoint.class, endpoint); - FtpRemoteFileEndpoint ftpEndpoint = (FtpRemoteFileEndpoint) endpoint; + assertIsInstanceOf(FtpEndpoint.class, endpoint); + FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint; RemoteFileConfiguration config = (RemoteFileConfiguration) ftpEndpoint.getConfiguration(); assertEquals("ftp", config.getProtocol()); @@ -45,8 +45,8 @@ public void testSftpConfigurationDefaults() { Endpoint endpoint = context.getEndpoint("sftp://hostname"); - assertIsInstanceOf(SftpRemoteFileEndpoint.class, endpoint); - SftpRemoteFileEndpoint sftpEndpoint = (SftpRemoteFileEndpoint) endpoint; + assertIsInstanceOf(SftpEndpoint.class, endpoint); + SftpEndpoint sftpEndpoint = (SftpEndpoint) endpoint; RemoteFileConfiguration config = (RemoteFileConfiguration) sftpEndpoint.getConfiguration(); assertEquals("sftp", config.getProtocol()); @@ -60,8 +60,8 @@ public void testFtpExplicitConfiguration() { Endpoint endpoint = context.getEndpoint("ftp://u...@hostname:1021/some/file?password=secret&binary=true&directory=false"); - assertIsInstanceOf(FtpRemoteFileEndpoint.class, endpoint); - FtpRemoteFileEndpoint ftpEndpoint = (FtpRemoteFileEndpoint) endpoint; + assertIsInstanceOf(FtpEndpoint.class, endpoint); + FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint; RemoteFileConfiguration config = (RemoteFileConfiguration) ftpEndpoint.getConfiguration(); assertEquals("ftp", config.getProtocol()); @@ -75,8 +75,8 @@ public void testSftpExplicitConfiguration() { Endpoint endpoint = context.getEndpoint("sftp://u...@hostname:1021/some/file?password=secret&binary=true&directory=false"); - assertIsInstanceOf(SftpRemoteFileEndpoint.class, endpoint); - SftpRemoteFileEndpoint sftpEndpoint = (SftpRemoteFileEndpoint) endpoint; + assertIsInstanceOf(SftpEndpoint.class, endpoint); + SftpEndpoint sftpEndpoint = (SftpEndpoint) endpoint; RemoteFileConfiguration config = (RemoteFileConfiguration) sftpEndpoint.getConfiguration(); assertEquals("sftp", config.getProtocol()); @@ -109,9 +109,9 @@ public void testSftpKnownHostsFileConfiguration() { Endpoint endpoint = context.getEndpoint("sftp://u...@hostname:1021/some/file?password=secret&binary=true&directory=false&knownHostsFile=/home/janstey/.ssh/known_hosts"); - assertIsInstanceOf(SftpRemoteFileEndpoint.class, endpoint); - SftpRemoteFileEndpoint sftpEndpoint = (SftpRemoteFileEndpoint) endpoint; - RemoteFileConfiguration config = (RemoteFileConfiguration) sftpEndpoint.getConfiguration(); + assertIsInstanceOf(SftpEndpoint.class, endpoint); + SftpEndpoint sftpEndpoint = (SftpEndpoint) endpoint; + SftpConfiguration config = (SftpConfiguration) sftpEndpoint.getConfiguration(); assertEquals("sftp", config.getProtocol()); assertEquals("hostname", config.getHost()); Modified: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml?rev=739213&r1=739212&r2=739213&view=diff ============================================================================== --- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml (original) +++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml Fri Jan 30 09:10:59 2009 @@ -23,7 +23,7 @@ "> <!-- START SNIPPET: e1 --> - <bean id="myFTPEndpoint" class="org.apache.camel.component.file.remote.FtpRemoteFileEndpoint"> + <bean id="myFTPEndpoint" class="org.apache.camel.component.file.remote.FtpEndpoint"> <property name="camelContext" ref="camel"/> <property name="configuration" ref="ftpConfig"/> <property name="consumerProperties"> @@ -33,7 +33,7 @@ </property> </bean> - <bean id="ftpConfig" class="org.apache.camel.component.file.remote.FtpRemoteFileConfiguration"> + <bean id="ftpConfig" class="org.apache.camel.component.file.remote.FtpConfiguration"> <property name="host" value="localhost"/> <property name="port" value="20125"/> <property name="username" value="admin"/>