org.springframework.integration.adapter.ftp
Class FtpSource

java.lang.Object
  extended by org.springframework.integration.adapter.file.AbstractDirectorySource
      extended by org.springframework.integration.adapter.ftp.FtpSource
All Implemented Interfaces:
MessageDeliveryAware, MessageSource<java.lang.Object>

public class FtpSource
extends AbstractDirectorySource

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  java.lang.String host
           
private  java.io.File localWorkingDirectory
           
private  org.apache.commons.logging.Log logger
           
private  java.lang.String password
           
private  int port
           
private  java.lang.String remoteWorkingDirectory
           
private  java.lang.String username
           
 
Fields inherited from class org.springframework.integration.adapter.file.AbstractDirectorySource
FILE_INFO_PROPERTY
 
Constructor Summary
FtpSource(MessageCreator<java.io.File,?> messageCreator)
           
 
Method Summary
protected  void disconnect()
          Disconnects from the directory
protected  void establishConnection()
          Connects to the directory, if necessary.
protected  void populateSnapshot(java.util.Map<java.lang.String,FileInfo> snapshot)
          Constructs the snapshot by iterating files.
protected  java.io.File retrieveNextFile()
          Returns the next file, based on the backlog data.
 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 setUsername(java.lang.String username)
           
 
Methods inherited from class org.springframework.integration.adapter.file.AbstractDirectorySource
getDirectoryContentManager, getMessageCreator, onFailure, onSend, receive
 
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

client

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

FtpSource

public FtpSource(MessageCreator<java.io.File,?> messageCreator)
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)

populateSnapshot

protected void populateSnapshot(java.util.Map<java.lang.String,FileInfo> snapshot)
                         throws java.io.IOException
Description copied from class: AbstractDirectorySource
Constructs the snapshot by iterating files.

Specified by:
populateSnapshot in class AbstractDirectorySource
Throws:
java.io.IOException

establishConnection

protected void establishConnection()
                            throws java.io.IOException
Description copied from class: AbstractDirectorySource
Connects to the directory, if necessary.

Specified by:
establishConnection in class AbstractDirectorySource
Throws:
java.io.IOException

retrieveNextFile

protected java.io.File retrieveNextFile()
                                 throws java.io.IOException
Description copied from class: AbstractDirectorySource
Returns the next file, based on the backlog data.

Specified by:
retrieveNextFile in class AbstractDirectorySource
Returns:
Throws:
java.io.IOException

disconnect

protected void disconnect()
Description copied from class: AbstractDirectorySource
Disconnects from the directory

Specified by:
disconnect in class AbstractDirectorySource