@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
Constructor and Description |
---|
RelaxedFtpProducer() |
Modifier and Type | Method and Description |
---|---|
void |
doProduce(AdaptrisMessage msg,
java.lang.String endpoint) |
java.lang.String |
endpoint(AdaptrisMessage msg)
Return the endpoint that will be derived from the message.
|
ProduceDestination |
getDestination()
Deprecated.
|
FileNameCreator |
getFilenameCreator() |
java.lang.String |
getFtpEndpoint()
The FTP endpoint in which to deposit files.
|
void |
prepare()
Prepare for initialisation.
|
void |
setDestination(ProduceDestination destination)
Deprecated.
|
void |
setFilenameCreator(FileNameCreator filenameCreator) |
void |
setFtpEndpoint(java.lang.String ftpEndpoint)
The FTP endpoint in which to deposit files.
|
produce, produce, request, request, request, request
createName
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
close, init, start, stop
createQualifier, isTrackingEndpoint
public void doProduce(AdaptrisMessage msg, java.lang.String endpoint) throws ProduceException
doProduce
in class ProduceOnlyProducerImp
ProduceException
AdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
AdaptrisMessageProducerImp
The purpose of this method is to mitigate the number of changes that need to happen because
ProduceDestination
is being deprecated; boilerplate code can still be present in the
parent super-classes w/o impacting concrete sub-classes "too much".
endpoint
in class AdaptrisMessageProducerImp
ProduceException
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination)
,
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination, long)
,
AdaptrisMessageSender.produce(AdaptrisMessage)
,
AdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public FileNameCreator getFilenameCreator()
public void setFilenameCreator(FileNameCreator filenameCreator)
@Deprecated public ProduceDestination getDestination()
@Deprecated public void setDestination(ProduceDestination destination)
public java.lang.String getFtpEndpoint()
Although nominal a URL, you can configure the following styles
FileTransferConnection
will be used to supply the username and
password. The destination directory will be /work
ftp://10.0.0.1/path/to/dir
, the username and password will be taken
from the corresponding connection. The destination directory will be
/path/to/dir/work
ftp://user:password@10.0.0.1/path/to/dir
.
The destination directory will be /path/to/dir/work
public void setFtpEndpoint(java.lang.String ftpEndpoint)
Although nominal a URL, you can configure the following styles
FileTransferConnection
will be used to supply the username and
password. The destination directory will be /work
ftp://10.0.0.1/path/to/dir
, the username and password will be taken
from the corresponding connection. The destination directory will be
/path/to/dir/work
ftp://user:password@10.0.0.1/path/to/dir
.
The destination directory will be /path/to/dir/work