@ComponentProfile(summary="Put a file on a FTP/SFTP server; uses PUT only", tag="producer,ftp,ftps,sftp", recommended=FileTransferConnection.class) public class RelaxedFtpProducer extends ProduceOnlyProducerImp
This differs from the standard FtpProducer
as it does not use a staging area to upload file, nor does it rename the file
from the staging directory into the destination directory once the upload is complete. It simply writes directly to the specified
directory.
If the remote system starts processing the file before upload is complete then you may encounter undefined behaviour in your back-end system. If the remote file is deleted before upload is complete, then depending on the server, this may not generate any errors, and you will have a partial file that the adapter thinks was successfully delivered. There are lots of ways in which this can go wrong. It is not recommended that you use this FtpProducer unless there are very specific reasons to; e.g. the remote FTP server does not support the RNFR and RNTO command.
The destination returned by the ProduceDestination implementation should be in the form in the URL form dictated by the
FileTransferConnection
flavour including the directory from which you wish to write to. Simply specifying the IP Address
or DNS name of the remote ftp server will cause files to be written without specifying a directory (which if you are not in an
ftp chroot jail might be a very bad thing).
This implementation does not support RequestReply.
FileNameCreator
,
FtpConnection
,
FileTransferConnection
,
ProduceDestination
In the adapter configuration file this class is aliased as relaxed-ftp-producer which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
RelaxedFtpProducer() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
FileNameCreator |
getFilenameCreator() |
void |
init()
Initialises the component.
|
void |
prepare()
Prepare for initialisation.
|
void |
produce(AdaptrisMessage msg,
ProduceDestination destination)
Produce the
AdaptrisMessage to the supplied ProduceDestination , over-riding any configured destinations. |
void |
setFilenameCreator(FileNameCreator creator) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
produce, request, request, request, request
getDestination, setDestination
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isTrackingEndpoint
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely.
Throwing a RuntimeException
may cause unintended consequences
ComponentLifecycle.close()
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
sComponentLifecycle.init()
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.
CoreException
- wrapping any underlying Exception
sComponentLifecycle.start()
public void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing a
RuntimeException
may cause unintended consequences
ComponentLifecycle.stop()
public void produce(AdaptrisMessage msg, ProduceDestination destination) throws ProduceException
AdaptrisMessageSender
AdaptrisMessage
to the supplied ProduceDestination
, over-riding any configured destinations.msg
- the AdaptrisMessage
to producedestination
- the ProduceDestination
to produce toProduceException
- wrapping any underlying ExceptionsAdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public FileNameCreator getFilenameCreator()
public void setFilenameCreator(FileNameCreator creator)