INT-1614 removed FTPS schema and references from spring.handlers and spring.schema, removed dead tests and FTPS parsers, handlers and other FTPS-related artifacts
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp.config;
|
||||
|
||||
|
||||
/**
|
||||
* Parser for the FTPS inbound-channel-adapter
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class FtpsInboundChannelAdapterParser extends AbstractFtpInboundChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected String getClassName() {
|
||||
return "org.springframework.integration.ftp.config.FtpsInboundSynchronizingMessageSourceFactoryBean";
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp.config;
|
||||
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
|
||||
import org.springframework.integration.ftp.client.AbstractFtpClientFactory;
|
||||
import org.springframework.integration.ftp.client.DefaultFtpsClientFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Factory to make building the namespace easier.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
class FtpsInboundSynchronizingMessageSourceFactoryBean extends FtpInboundSynchronizingMessageSourceFactoryBean {
|
||||
|
||||
/**
|
||||
* 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 FtpsInboundSynchronizingMessageSourceFactoryBean() {
|
||||
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;
|
||||
}
|
||||
|
||||
public void setCipherSuites(String[] cipherSuites) {
|
||||
this.cipherSuites = cipherSuites;
|
||||
}
|
||||
|
||||
protected AbstractFtpClientFactory<?> initializeFactory(AbstractFtpClientFactory<?> factory) throws Exception {
|
||||
//super.initializeFactory(factory);
|
||||
DefaultFtpsClientFactory ftpsFactory = (DefaultFtpsClientFactory) factory;
|
||||
ftpsFactory.setCipherSuites(this.cipherSuites);
|
||||
ftpsFactory.setAuthValue(this.authValue);
|
||||
ftpsFactory.setTrustManager(this.trustManager);
|
||||
ftpsFactory.setKeyManager(this.keyManager);
|
||||
ftpsFactory.setNeedClientAuth(this.needClientAuth);
|
||||
ftpsFactory.setWantsClientAuth(this.wantsClientAuth);
|
||||
ftpsFactory.setSessionCreation(this.sessionCreation);
|
||||
ftpsFactory.setUseClientMode(this.useClientMode);
|
||||
if (StringUtils.hasText(this.prot)) {
|
||||
ftpsFactory.setProt(this.prot);
|
||||
}
|
||||
if (StringUtils.hasText(this.protocol)) {
|
||||
ftpsFactory.setProtocol(this.protocol);
|
||||
}
|
||||
if (this.implicit != null) {
|
||||
ftpsFactory.setImplicit(this.implicit);
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
|
||||
protected AbstractFtpClientFactory<?> createClientFactory(){
|
||||
return new DefaultFtpsClientFactory();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp.config;
|
||||
|
||||
/**
|
||||
* Provides namespace support for using FTP.
|
||||
* <p/>
|
||||
* This is *heavily* influenced by the good work done by Iwein before.
|
||||
*
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class FtpsNamespaceHandler extends FtpNamespaceHandler {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.registerBeanDefinitionParser("inbound-channel-adapter", new FtpsInboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("outbound-channel-adapter", new FtpsOutboundChannelAdapterParser());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp.config;
|
||||
|
||||
/**
|
||||
* Parser for the FTPS outbound-channel-adapter
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class FtpsOutboundChannelAdapterParser extends AbstractFtpOutboundChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected String getClassName() {
|
||||
return "org.springframework.integration.ftp.config.FtpsSendingMessageHandlerFactoryBean";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp.config;
|
||||
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.springframework.integration.ftp.client.AbstractFtpClientFactory;
|
||||
import org.springframework.integration.ftp.client.DefaultFtpsClientFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Sends files to a remote FTPS file system. Based heavily on {@link org.springframework.integration.ftp.outbound.FtpSendingMessageHandler}
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Iwein Fuld
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
class FtpsSendingMessageHandlerFactoryBean extends FtpSendingMessageHandlerFactoryBean {
|
||||
|
||||
/**
|
||||
* Sets whether the connection is implicit. Default is FALSE.
|
||||
*/
|
||||
protected volatile Boolean implicit = Boolean.FALSE;
|
||||
|
||||
/**
|
||||
* "TLS" or "SSL"
|
||||
*/
|
||||
protected volatile String protocol;
|
||||
|
||||
/**
|
||||
* "P"
|
||||
*/
|
||||
protected volatile String prot;
|
||||
|
||||
private volatile KeyManager keyManager;
|
||||
|
||||
private volatile TrustManager trustManager;
|
||||
|
||||
protected volatile String authValue;
|
||||
|
||||
private volatile Boolean sessionCreation;
|
||||
|
||||
private volatile Boolean useClientMode;
|
||||
|
||||
private volatile Boolean needClientAuth;
|
||||
|
||||
private volatile Boolean wantsClientAuth;
|
||||
|
||||
private volatile String[] cipherSuites;
|
||||
|
||||
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 setKeyManager(KeyManager keyManager) {
|
||||
this.keyManager = keyManager;
|
||||
}
|
||||
|
||||
public void setTrustManager(TrustManager trustManager) {
|
||||
this.trustManager = trustManager;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setCipherSuites(String[] cipherSuites) {
|
||||
this.cipherSuites = cipherSuites;
|
||||
}
|
||||
|
||||
protected AbstractFtpClientFactory<?> initializeClientFactory(AbstractFtpClientFactory<?> factory) {
|
||||
//super.initializeClientFactory(factory);
|
||||
DefaultFtpsClientFactory ftpsFactory = (DefaultFtpsClientFactory) factory;
|
||||
|
||||
ftpsFactory.setCipherSuites(this.cipherSuites);
|
||||
ftpsFactory.setAuthValue(this.authValue);
|
||||
ftpsFactory.setTrustManager(this.trustManager);
|
||||
ftpsFactory.setKeyManager(this.keyManager);
|
||||
ftpsFactory.setNeedClientAuth(this.needClientAuth);
|
||||
ftpsFactory.setWantsClientAuth(this.wantsClientAuth);
|
||||
ftpsFactory.setSessionCreation(this.sessionCreation);
|
||||
ftpsFactory.setUseClientMode(this.useClientMode);
|
||||
if (StringUtils.hasText(this.prot)) {
|
||||
ftpsFactory.setProt(this.prot);
|
||||
}
|
||||
if (StringUtils.hasText(this.protocol)) {
|
||||
ftpsFactory.setProtocol(this.protocol);
|
||||
}
|
||||
if (this.implicit != null) {
|
||||
ftpsFactory.setImplicit(this.implicit);
|
||||
}
|
||||
return ftpsFactory;
|
||||
}
|
||||
|
||||
protected AbstractFtpClientFactory<?> createClientFactory(){
|
||||
return new DefaultFtpsClientFactory();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1 @@
|
||||
http\://www.springframework.org/schema/integration/ftp=org.springframework.integration.ftp.config.FtpNamespaceHandler
|
||||
http\://www.springframework.org/schema/integration/ftps=org.springframework.integration.ftp.config.FtpsNamespaceHandler
|
||||
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
http\://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd=org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd
|
||||
http\://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd=org/springframework/integration/ftp/config/spring-integration-ftp-2.0.xsd
|
||||
http\://www.springframework.org/schema/integration/ftp/spring-integration-ftps-2.0.xsd=org/springframework/integration/ftp/config/spring-integration-ftps-2.0.xsd
|
||||
http\://www.springframework.org/schema/integration/ftp/spring-integration-ftps.xsd=org/springframework/integration/ftp/config/spring-integration-ftps-2.0.xsd
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/integration/ftps"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
xmlns:ftp="http://www.springframework.org/schema/integration/ftp"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
targetNamespace="http://www.springframework.org/schema/integration/ftps"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/integration"
|
||||
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-2.0.xsd"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/integration/ftp"
|
||||
schemaLocation="http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.0.xsd"/>
|
||||
|
||||
<xsd:element name="outbound-channel-adapter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Builds an outbound-channel-adapter that writes files to a remote FTPS endpoint.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="ftp:base-ftp-adapter-type">
|
||||
<xsd:attribute name="filename-generator" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Allows you to specify a reference to
|
||||
[org.springframework.integration.file.FileNameGenerator] implementation.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.file.FileNameGenerator"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="inbound-channel-adapter">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Builds an inbound-channel-adapter that synchronizes a local directory with the contents of a remote FTPS endpoint.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="ftp:base-ftp-adapter-type">
|
||||
<xsd:sequence>
|
||||
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="auto-create-directories" type="xsd:boolean"/>
|
||||
<xsd:attribute name="auto-delete-remote-files-on-sync" type="xsd:boolean"/>
|
||||
<xsd:attribute name="filename-pattern" type="xsd:string"/>
|
||||
<xsd:attribute name="filter" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.file.filters.FileListFilter"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-working-directory" type="xsd:string"/>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
@@ -33,9 +33,5 @@ public class FtpMessageHistoryTests {
|
||||
SourcePollingChannelAdapter adapter = ac.getBean("adapterFtp", SourcePollingChannelAdapter.class);
|
||||
assertEquals("adapterFtp", adapter.getComponentName());
|
||||
assertEquals("ftp:inbound-channel-adapter", adapter.getComponentType());
|
||||
|
||||
adapter = ac.getBean("adapterFtps", SourcePollingChannelAdapter.class);
|
||||
assertEquals("adapterFtps", adapter.getComponentName());
|
||||
assertEquals("ftp:inbound-channel-adapter", adapter.getComponentType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package org.springframework.integration.ftp;
|
||||
|
||||
/**
|
||||
* the goal here is to sketch out what a simple FTPS client looks like
|
||||
*/
|
||||
public class FtpsExample {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.springframework.integration.ftp;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* Simple component to test the inbound integration
|
||||
*
|
||||
* @author Josh Long
|
||||
*/
|
||||
|
||||
public class InboundFtpsFileServiceActivator {
|
||||
|
||||
@ServiceActivator
|
||||
public void onNewRemoteFTPFile(Message<File> file)
|
||||
throws Throwable {
|
||||
System.out.println(StringUtils.repeat("=", 100));
|
||||
System.out.println("A new file has appeared: " + file.getPayload().getAbsolutePath());
|
||||
|
||||
for (String h : file.getHeaders().keySet())
|
||||
System.out.println(String.format("%s = %s", h, file.getHeaders().get(h)));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
ClassPathXmlApplicationContext classPathXmlApplicationContext =
|
||||
new ClassPathXmlApplicationContext("inbound-ftps-context.xml");
|
||||
classPathXmlApplicationContext.start();
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.integration.ftp;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* This simple example demonstrates sending a file to a remote FTP server using the ftp:outbound-channel-adapter
|
||||
* <p/>
|
||||
* It reads files from a directory on your computer and systematically puts them on the remote FTP server,
|
||||
*
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class OutboundFtpsExample {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
new ClassPathXmlApplicationContext("outbound-ftps-context.xml");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,11 +4,10 @@
|
||||
xmlns:ftp="http://www.springframework.org/schema/integration/ftp"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:ftps="http://www.springframework.org/schema/integration/ftps"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration/ftps http://www.springframework.org/schema/integration/ftp/spring-integration-ftps.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<int:message-history/>
|
||||
|
||||
@@ -31,15 +30,6 @@
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftp:inbound-channel-adapter>
|
||||
|
||||
<ftps:inbound-channel-adapter id="adapterFtps"
|
||||
client-factory="ftpClientFactory"
|
||||
channel="ftpIn"
|
||||
auto-create-directories="true"
|
||||
auto-delete-remote-files-on-sync="false"
|
||||
filename-pattern=".*?java">
|
||||
<int:poller fixed-rate="1000"/>
|
||||
</ftps:inbound-channel-adapter>
|
||||
|
||||
<int:channel id="ftpIn">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ftp="http://www.springframework.org/schema/integration/ftp"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:file="http://www.springframework.org/schema/integration/file" xmlns:ftps="http://www.springframework.org/schema/integration/ftps"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/ftps http://www.springframework.org/schema/integration/ftp/spring-integration-ftps.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file-1.0.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder
|
||||
location="file://${user.home}/Desktop/ftp.properties"
|
||||
ignore-unresolvable="true"/>
|
||||
|
||||
<file:inbound-channel-adapter channel="ftpOutbound"
|
||||
filename-pattern=".*?jpg"
|
||||
directory="#{systemProperties['user.home']}/Desktop/imagesToSendViaFTP"
|
||||
auto-create-directory="true">
|
||||
<int:poller>
|
||||
<int:interval-trigger interval="1000" time-unit="MILLISECONDS"/>
|
||||
</int:poller>
|
||||
</file:inbound-channel-adapter>
|
||||
|
||||
<int:channel id="ftpOutbound"/>
|
||||
|
||||
<ftps:outbound-channel-adapter
|
||||
remote-directory="${ftp.remotedir}"
|
||||
channel="ftpOutbound"
|
||||
file-type="binary-file-type"
|
||||
host="${ftp.host}"
|
||||
username="${ftp.username}"
|
||||
password="${ftp.password}" port="21"
|
||||
client-mode="passive-local-data-connection-mode"
|
||||
/>
|
||||
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user