public class FtpClient extends AbstractEndpoint implements Producer, ReplyConsumer, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
| Modifier | Constructor and Description |
|---|---|
|
FtpClient()
Default constructor initializing endpoint configuration.
|
protected |
FtpClient(FtpEndpointConfiguration endpointConfiguration)
Default constructor using endpoint configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected static String |
addFileNameToTargetPath(String sourcePath,
String targetPath)
If the target path is a directory (ends with "/"), add the file name from the source path to the target path.
|
void |
afterPropertiesSet() |
protected void |
connectAndLogin()
Opens a new connection and performs login with user name and password if set.
|
SelectiveConsumer |
createConsumer()
Creates a message consumer for this endpoint.
|
Producer |
createProducer()
Creates a message producer for this endpoint for sending messages
to this endpoint.
|
protected FtpMessage |
deleteFile(DeleteCommand delete,
TestContext context)
Performs delete file operation.
|
void |
destroy() |
protected FtpMessage |
executeCommand(CommandType ftpCommand,
TestContext context) |
FtpEndpointConfiguration |
getEndpointConfiguration() |
org.apache.commons.net.ftp.FTPClient |
getFtpClient()
Gets the apache ftp client.
|
protected InputStream |
getLocalFileInputStream(String path,
String dataType,
TestContext context)
Constructs local file input stream.
|
protected boolean |
isDirectory(String remoteFilePath)
Check file path type directory or file.
|
protected FtpMessage |
listFiles(ListCommand list,
TestContext context)
Perform list files operation and provide file information as response.
|
Message |
receive(String selector,
TestContext context) |
Message |
receive(String selector,
TestContext context,
long timeout) |
Message |
receive(TestContext context) |
Message |
receive(TestContext context,
long timeout) |
protected FtpMessage |
retrieveFile(GetCommand command,
TestContext context)
Performs retrieve file operation.
|
void |
send(Message message,
TestContext context) |
void |
setCorrelationManager(CorrelationManager<Message> correlationManager)
Sets the correlation manager.
|
void |
setFtpClient(org.apache.commons.net.ftp.FTPClient ftpClient)
Sets the apache ftp client.
|
protected FtpMessage |
storeFile(PutCommand command,
TestContext context)
Performs store file operation.
|
getActor, getConsumerName, getName, getProducerName, setActor, setBeanName, setNamepublic FtpClient()
protected FtpClient(FtpEndpointConfiguration endpointConfiguration)
endpointConfiguration - public FtpEndpointConfiguration getEndpointConfiguration()
getEndpointConfiguration in interface EndpointgetEndpointConfiguration in class AbstractEndpointpublic void send(Message message, TestContext context)
protected FtpMessage executeCommand(CommandType ftpCommand, TestContext context)
protected FtpMessage listFiles(ListCommand list, TestContext context)
list - context - protected FtpMessage deleteFile(DeleteCommand delete, TestContext context)
delete - context - protected boolean isDirectory(String remoteFilePath) throws IOException
remoteFilePath - IOExceptionprotected FtpMessage storeFile(PutCommand command, TestContext context)
command - context - protected InputStream getLocalFileInputStream(String path, String dataType, TestContext context) throws IOException
path - dataType - context - IOExceptionprotected FtpMessage retrieveFile(GetCommand command, TestContext context)
command - protected static String addFileNameToTargetPath(String sourcePath, String targetPath)
sourcePath="/some/dir/file.pdf"
targetPath="/other/dir/"
returns: "/other/dir/file.pdf"
protected void connectAndLogin()
throws IOException
IOExceptionpublic Message receive(TestContext context)
public Message receive(String selector, TestContext context)
receive in interface SelectiveConsumerpublic Message receive(TestContext context, long timeout)
public Message receive(String selector, TestContext context, long timeout)
receive in interface SelectiveConsumerpublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic Producer createProducer()
createProducer in interface Endpointpublic SelectiveConsumer createConsumer()
createConsumer in interface Endpointpublic void setFtpClient(org.apache.commons.net.ftp.FTPClient ftpClient)
ftpClient - public org.apache.commons.net.ftp.FTPClient getFtpClient()
public void setCorrelationManager(CorrelationManager<Message> correlationManager)
correlationManager - Copyright © 2008–2019 ConSol Software GmbH. All rights reserved.