Class FtpConsumer
- java.lang.Object
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageConsumer
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,StateManagedComponent
- Direct Known Subclasses:
FtpRecursiveConsumer
@ComponentProfile(summary="Pickup messages from an FTP or SFTP server", tag="consumer,ftp,ftps,sftp", metadata={"originalname","fsFileSize","fsConsumeDir","_interlokMessageConsumedFrom"}, recommended=FileTransferConnection.class) public class FtpConsumer extends FtpConsumerImpl
FTP implementation of the AdaptrisMessageConsumer interface.The connection type for this consumer should always be a concrete implementation of
FileTransferConnection
.The destination should be in the form in the URL form dictated by the
FileTransferConnection
flavour or simply the IP Address/DNS name of the target Server. If the URL form is used, then it is possible to override the username, password, and port settings of the server, in all other cases the configuration specified in theFileTransferConnection
object will be used.In the event the proc-directory is not configured, then after processing the file, it is deleted. If proc-directory is configured, then the remote file will be renamed to this directory
The configuration of this consumer closely mirrors that of the FsConsumer though it does not, at the moment, share any common hierarchy with a key difference; although multiple file-filters can be configured only filters that work with the filepath will work. Other filter implementations (such as those based on size/last modified) may not work.
- See Also:
FtpConnection
,FileTransferConnection
In the adapter configuration file this class is aliased as ftp-consumer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.AdaptrisPollingConsumer
AdaptrisPollingConsumer.LockOperator
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ftp.FtpConsumerImpl
DEFAULT_FILE_FILTER_IMPL, DEFAULT_OLDER_THAN, fileFilter, ftpClient
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description FtpConsumer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
accept(java.lang.String path)
protected java.lang.String
configureWorkDir(java.lang.String path)
protected boolean
fetchAndProcess(java.lang.String fullPath)
java.lang.String
getProcDirectory()
The directory where files are moved to after processing.java.lang.String
getWipSuffix()
The suffix of the file to indicate it is being processed.java.lang.String
getWorkDirectory()
The working directory for the consumer.void
init()
Initialises the component.void
setProcDirectory(java.lang.String procDirectory)
The directory where files are moved to after processing.void
setWipSuffix(java.lang.String wipSuffix)
The suffix of the file to indicate it is being processed.void
setWorkDirectory(java.lang.String workDirectory)
The working directory for the consumer.-
Methods inherited from class com.adaptris.core.ftp.FtpConsumerImpl
additionalDebug, addStandardMetadata, consumeLocationKey, fileFilterImp, filterExpression, ftpURL, getFileFilterImp, getFilterExpression, getFtpEndpoint, getQuietInterval, handle, oldEnough, olderThanMs, prepareConsumer, processMessages, setFileFilterImp, setFilterExpression, setFtpEndpoint, setQuietInterval
-
Methods inherited from class com.adaptris.core.AdaptrisPollingConsumer
close, continueProcessingMessages, getMaxMessagesPerPoll, getPoller, getReacquireLockBetweenMessages, prepare, releaseLock, setMaxMessagesPerPoll, setPoller, setReacquireLockBetweenMessages, start, stop
-
Methods inherited from class com.adaptris.core.AdaptrisMessageConsumerImp
changeState, newThreadName, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classFtpConsumerImpl
- Throws:
CoreException
- wrapping any underlyingException
s- See Also:
ComponentLifecycle.init()
-
configureWorkDir
protected java.lang.String configureWorkDir(java.lang.String path)
- Overrides:
configureWorkDir
in classFtpConsumerImpl
-
accept
protected boolean accept(java.lang.String path) throws java.lang.Exception
- Overrides:
accept
in classFtpConsumerImpl
- Throws:
java.lang.Exception
-
fetchAndProcess
protected boolean fetchAndProcess(java.lang.String fullPath) throws java.lang.Exception
- Specified by:
fetchAndProcess
in classFtpConsumerImpl
- Throws:
java.lang.Exception
-
getWorkDirectory
public java.lang.String getWorkDirectory()
The working directory for the consumer. Files are consumed from here.
-
setWorkDirectory
public void setWorkDirectory(java.lang.String workDirectory)
The working directory for the consumer. Files are consumed from here.
-
getProcDirectory
public java.lang.String getProcDirectory()
The directory where files are moved to after processing. If null, the file will be deleted instead.
-
setProcDirectory
public void setProcDirectory(java.lang.String procDirectory)
The directory where files are moved to after processing. If null, the file will be deleted instead.
-
getWipSuffix
public java.lang.String getWipSuffix()
The suffix of the file to indicate it is being processed.
-
setWipSuffix
public void setWipSuffix(java.lang.String wipSuffix)
The suffix of the file to indicate it is being processed.
-
-