org.springframework.integration.adapter.ftp
Class FtpSource

java.lang.Object
  extended by org.springframework.integration.adapter.ftp.FtpSource
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, MessageDeliveryAware, Source<java.lang.Object>

public class FtpSource
extends java.lang.Object
implements Source<java.lang.Object>, MessageDeliveryAware, org.springframework.beans.factory.InitializingBean

A source adapter for receiving files via FTP.

Author:
Marius Bogoevici, Mark Fisher

Field Summary
private  org.apache.commons.net.ftp.FTPClient client
           
private static java.lang.String DEFAULT_HOST
           
private static int DEFAULT_PORT
           
private static java.lang.String DEFAULT_REMOTE_WORKING_DIRECTORY
           
private  DirectoryContentManager directoryContentManager
           
private  java.lang.String host
           
private  java.io.File localWorkingDirectory
           
private  org.apache.commons.logging.Log logger
           
private  MessageCreator<java.io.File,?> messageCreator
           
private  java.lang.String password
           
private  int port
           
private  java.lang.String remoteWorkingDirectory
           
private  boolean textBased
           
private  java.lang.String username
           
 
Constructor Summary
FtpSource()
           
 
Method Summary
 void afterPropertiesSet()
           
private  void establishConnection()
           
 boolean isTextBased()
           
 void onFailure(MessagingException exception)
          Callback method invoked after a message delivery failure.
 void onSend(Message<?> message)
          Callback method invoked after a message is sent successfully.
 Message receive()
          Retrieve a message from this source or null if no message is available.
 void setHost(java.lang.String host)
           
 void setLocalWorkingDirectory(java.io.File localWorkingDirectory)
           
 void setPassword(java.lang.String password)
           
 void setPort(int port)
           
 void setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)
           
 void setTextBased(boolean textBased)
           
 void setUsername(java.lang.String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HOST

private static final java.lang.String DEFAULT_HOST
See Also:
Constant Field Values

DEFAULT_PORT

private static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_REMOTE_WORKING_DIRECTORY

private static final java.lang.String DEFAULT_REMOTE_WORKING_DIRECTORY
See Also:
Constant Field Values

logger

private final org.apache.commons.logging.Log logger

username

private volatile java.lang.String username

password

private volatile java.lang.String password

host

private volatile java.lang.String host

port

private volatile int port

remoteWorkingDirectory

private volatile java.lang.String remoteWorkingDirectory

localWorkingDirectory

private volatile java.io.File localWorkingDirectory

textBased

private volatile boolean textBased

messageCreator

private volatile MessageCreator<java.io.File,?> messageCreator

directoryContentManager

private final DirectoryContentManager directoryContentManager

client

private final org.apache.commons.net.ftp.FTPClient client
Constructor Detail

FtpSource

public FtpSource()
Method Detail

setHost

public void setHost(java.lang.String host)

setPort

public void setPort(int port)

setUsername

public void setUsername(java.lang.String username)

setPassword

public void setPassword(java.lang.String password)

setRemoteWorkingDirectory

public void setRemoteWorkingDirectory(java.lang.String remoteWorkingDirectory)

setLocalWorkingDirectory

public void setLocalWorkingDirectory(java.io.File localWorkingDirectory)

isTextBased

public boolean isTextBased()

setTextBased

public void setTextBased(boolean textBased)

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

receive

public final Message receive()
Description copied from interface: Source
Retrieve a message from this source or null if no message is available.

Specified by:
receive in interface Source<java.lang.Object>

establishConnection

private void establishConnection()
                          throws java.io.IOException
Throws:
java.io.IOException

onSend

public void onSend(Message<?> message)
Description copied from interface: MessageDeliveryAware
Callback method invoked after a message is sent successfully.

Specified by:
onSend in interface MessageDeliveryAware

onFailure

public void onFailure(MessagingException exception)
Description copied from interface: MessageDeliveryAware
Callback method invoked after a message delivery failure.

Specified by:
onFailure in interface MessageDeliveryAware