diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/AcceptAllEntryListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/AcceptAllEntryListFilter.java index 735caee080..deb9c1abf1 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/AcceptAllEntryListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/AcceptAllEntryListFilter.java @@ -21,6 +21,7 @@ package org.springframework.integration.file.entries; * Simple NOOP implementation for {@link org.springframework.integration.file.entries.EntryListFilter} implementation. * Suitable as a default in implementations. * + * @author Iwein Fuld * @author Josh Long * @param */ diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/CompositeEntryListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/CompositeEntryListFilter.java index 4321610e80..0ee88f6033 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/CompositeEntryListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/CompositeEntryListFilter.java @@ -20,7 +20,15 @@ import org.springframework.util.Assert; import java.util.*; - +/** + * Simple {@link org.springframework.integration.file.entries.EntryListFilter} that predicates its matches + * against any of many configured {@link org.springframework.integration.file.entries.EntryListFilter} + * + * @author Iwein Fuld + * @author Josh Long + * + * @param + */ public class CompositeEntryListFilter implements EntryListFilter { private final Set> fileFilters; diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/PatternMatchingEntryListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/PatternMatchingEntryListFilter.java index 590748618a..fe9778f77b 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/entries/PatternMatchingEntryListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/entries/PatternMatchingEntryListFilter.java @@ -23,11 +23,12 @@ import java.util.regex.Pattern; /** - * experimental - *

+ * + * * Filters a listing of entries (T) by qualifying their 'name' (as determined by {@link org.springframework.integration.file.entries.EntryNamer}) * against a regular expression (an instance of {@link java.util.regex.Pattern}) * + * @author Iwein Fuld * @author Josh Long * @param the type of entry */ @@ -59,7 +60,7 @@ public class PatternMatchingEntryListFilter extends AbstractEntryListFilter - implements FtpClientFactory { +/** + * + * base class for the other {@link org.springframework.integration.ftp.FtpClientFactory} implementations. + * Most of this came out of the {@link DefaultFtpClientFactory} and was refactored into a base class + * + * @author Iwein Fuld + * + * @param + */ +abstract public class AbstractFtpClientFactory implements FtpClientFactory { private static final Log logger = LogFactory.getLog(FtpClientFactory.class); private static final String DEFAULT_REMOTE_WORKING_DIRECTORY = "/"; protected FTPClientConfig config; diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/DefaultFtpsClientFactory.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/DefaultFtpsClientFactory.java index 6156cf3c06..5ae418c770 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/DefaultFtpsClientFactory.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/DefaultFtpsClientFactory.java @@ -19,9 +19,10 @@ import java.util.Properties; /** - * provides a working FTPS implementation - * + * provides a working FTPS implementation. Based heavily on {@link org.springframework.integration.ftp.DefaultFtpClientFactory} + * * @author Josh Long + * @author Iwein Fuld */ public class DefaultFtpsClientFactory extends AbstractFtpClientFactory { private Boolean useClientMode; diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizer.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizer.java index eefa39bf0e..c3c65ab150 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizer.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizer.java @@ -21,6 +21,7 @@ import java.util.Collection; /** * An FTP-adapter implementation of {@link org.springframework.integration.file.AbstractInboundRemoteFileSystemSychronizer} * + * @author Iwein Fuld * @author Josh Long */ public class FtpInboundRemoteFileSystemSynchronizer diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizingMessageSource.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizingMessageSource.java index d42bac6770..d4ba7c2ebd 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizingMessageSource.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpInboundRemoteFileSystemSynchronizingMessageSource.java @@ -7,6 +7,7 @@ import org.springframework.integration.file.AbstractInboundRemoteFileSystemSynch /** * a {@link org.springframework.integration.core.MessageSource} implementation for FTP * + * @author Iwein Fuld * @author Josh Long */ public class FtpInboundRemoteFileSystemSynchronizingMessageSource diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java index 0767252fd9..b20af82b8b 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean.java @@ -20,6 +20,7 @@ import java.io.File; /** * Factory to make building the namespace easier * + * @author Iwein Fuld * @author Josh Long */ public class FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpSendingMessageHandlerFactoryBean.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpSendingMessageHandlerFactoryBean.java index 13c6f107bf..9e1476ddec 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpSendingMessageHandlerFactoryBean.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpSendingMessageHandlerFactoryBean.java @@ -13,6 +13,7 @@ import org.springframework.core.io.ResourceLoader; /** * A factory bean implementation that handles constructing an outbound FTP adapter. * + * @author Iwein Fuld * @author Josh Long */ public class FtpSendingMessageHandlerFactoryBean extends AbstractFactoryBean diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpsSendingMessageHandlerFactoryBean.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpsSendingMessageHandlerFactoryBean.java index 18177bc4ce..8a309907ea 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpsSendingMessageHandlerFactoryBean.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/FtpsSendingMessageHandlerFactoryBean.java @@ -4,8 +4,15 @@ import javax.net.ssl.KeyManager; import javax.net.ssl.TrustManager; -public class FtpsSendingMessageHandlerFactoryBean - extends FtpSendingMessageHandlerFactoryBean { +/** + * Sends files to a remote FTPS file system. Based heavily on {@link org.springframework.integration.ftp.FtpSendingMessageHandler} + * + * @author Josh Long + * @author Iwein Fuld + */ + +public class FtpsSendingMessageHandlerFactoryBean extends FtpSendingMessageHandlerFactoryBean { + /** * Sets whether the connection is implicit. Local testing reveals this to be a good choice. */ diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/impl/FtpsRemoteFileSystemSynchronizingMessageSourceFactoryBean.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/impl/FtpsRemoteFileSystemSynchronizingMessageSourceFactoryBean.java new file mode 100644 index 0000000000..ce47821db8 --- /dev/null +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/impl/FtpsRemoteFileSystemSynchronizingMessageSourceFactoryBean.java @@ -0,0 +1,117 @@ +package org.springframework.integration.ftp.impl; + +import org.apache.commons.lang.SystemUtils; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPFile; + +import org.springframework.beans.factory.config.AbstractFactoryBean; + +import org.springframework.context.ResourceLoaderAware; + +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceEditor; +import org.springframework.core.io.ResourceLoader; + +import org.springframework.integration.file.entries.CompositeEntryListFilter; +import org.springframework.integration.file.entries.EntryListFilter; +import org.springframework.integration.file.entries.PatternMatchingEntryListFilter; +import org.springframework.integration.ftp.*; + +import org.springframework.util.StringUtils; + +import java.io.File; +import java.io.IOException; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.TrustManager; + + +/** + * Factory to make building the namespace easier + * + * @author Iwein Fuld + * @author Josh Long + */ +public class FtpsRemoteFileSystemSynchronizingMessageSourceFactoryBean extends FtpRemoteFileSystemSynchronizingMessageSourceFactoryBean { + /** + * Sets whether the connection is implicit. Local testing reveals this to be a good choice. + */ + protected volatile Boolean implicit = Boolean.FALSE; + + /** + * "TLS" or "SSL" + */ + protected volatile String protocol; + + /** + * "P" + */ + protected volatile String prot; + private KeyManager keyManager; + private TrustManager trustManager; + protected volatile String authValue; + private Boolean sessionCreation; + private Boolean useClientMode; + private Boolean needClientAuth; + private Boolean wantsClientAuth; + private String[] cipherSuites; + + public FtpsRemoteFileSystemSynchronizingMessageSourceFactoryBean() { + this.defaultFtpInboundFolderName = "ftpsInbound"; + this.clientMode = FTPClient.PASSIVE_LOCAL_DATA_CONNECTION_MODE; + } + + public void setKeyManager(KeyManager keyManager) { + this.keyManager = keyManager; + } + + public void setTrustManager(TrustManager trustManager) { + this.trustManager = trustManager; + } + + public void setImplicit(Boolean implicit) { + this.implicit = implicit; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public void setProt(String prot) { + this.prot = prot; + } + + public void setAuthValue(String authValue) { + this.authValue = authValue; + } + + public void setSessionCreation(Boolean sessionCreation) { + this.sessionCreation = sessionCreation; + } + + public void setUseClientMode(Boolean useClientMode) { + this.useClientMode = useClientMode; + } + + public void setNeedClientAuth(Boolean needClientAuth) { + this.needClientAuth = needClientAuth; + } + + public void setWantsClientAuth(Boolean wantsClientAuth) { + this.wantsClientAuth = wantsClientAuth; + } + + protected AbstractFtpClientFactory defaultClientFactory() + throws Exception { + DefaultFtpsClientFactory factory = ClientFactorySupport.ftpsClientFactory(this.host, Integer.parseInt(this.port), this.remoteDirectory, this.username, this.password, this.fileType, + this.clientMode, this.prot, this.protocol, this.authValue, this.implicit, this.trustManager, this.keyManager, this.sessionCreation, this.useClientMode, this.wantsClientAuth, + this.needClientAuth, this.cipherSuites); + + return factory; + } + + public void setCipherSuites(String[] cipherSuites) { + this.cipherSuites = cipherSuites; + } +} diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java index d087868c1a..2770d5d3f0 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/config/SftpNamespaceHandler.java @@ -28,7 +28,8 @@ import org.w3c.dom.Element; /** - * Provides namespace support for using SFTP + * Provides namespace support for using SFTP. + * This is very largely based on the FTP support by Iwein Fuld. * * @author Josh Long */