public class FtpOperations extends Object implements RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.net.ftp.FTPClient |
client |
protected FtpClientActivityListener |
clientActivityListener |
protected org.apache.commons.net.ftp.FTPClientConfig |
clientConfig |
protected FtpEndpoint<org.apache.commons.net.ftp.FTPFile> |
endpoint |
protected org.slf4j.Logger |
log |
| Constructor and Description |
|---|
FtpOperations(org.apache.commons.net.ftp.FTPClient client,
org.apache.commons.net.ftp.FTPClientConfig clientConfig) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
buildDirectory(String directory,
boolean absolute) |
void |
changeCurrentDirectory(String path) |
void |
changeToParentDirectory() |
boolean |
connect(RemoteFileConfiguration configuration,
org.apache.camel.Exchange exchange)
Connects to the remote server
|
boolean |
deleteFile(String name) |
void |
disconnect()
Disconnects from the remote server
|
protected boolean |
doConnect(RemoteFileConfiguration configuration,
org.apache.camel.Exchange exchange) |
protected void |
doDisconnect() |
boolean |
existsFile(String name) |
protected boolean |
fastExistsFile(String name) |
void |
forceDisconnect()
Forces a hard disconnect from the remote server and cause the client to be re-created on next poll.
|
org.apache.commons.net.ftp.FTPClient |
getClient() |
FtpClientActivityListener |
getClientActivityListener() |
String |
getCurrentDirectory() |
protected org.apache.commons.net.ftp.FTPClient |
getFtpClient() |
boolean |
isConnected()
Returns whether we are connected to the remote server or not
|
List<org.apache.commons.net.ftp.FTPFile> |
listFiles() |
List<org.apache.commons.net.ftp.FTPFile> |
listFiles(String path) |
void |
releaseRetrievedFileResources(org.apache.camel.Exchange exchange) |
boolean |
renameFile(String from,
String to) |
boolean |
retrieveFile(String name,
org.apache.camel.Exchange exchange,
long size) |
boolean |
sendNoop()
Sends a noop command to the remote server
|
boolean |
sendSiteCommand(String command)
Sends a site command to the remote server
|
void |
setClientActivityListener(FtpClientActivityListener clientActivityListener) |
void |
setEndpoint(org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint) |
boolean |
storeFile(String name,
org.apache.camel.Exchange exchange,
long size) |
protected final org.slf4j.Logger log
protected final org.apache.commons.net.ftp.FTPClient client
protected final org.apache.commons.net.ftp.FTPClientConfig clientConfig
protected FtpEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint
protected FtpClientActivityListener clientActivityListener
public FtpOperations(org.apache.commons.net.ftp.FTPClient client,
org.apache.commons.net.ftp.FTPClientConfig clientConfig)
public void setEndpoint(org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint)
setEndpoint in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>public FtpClientActivityListener getClientActivityListener()
public void setClientActivityListener(FtpClientActivityListener clientActivityListener)
public boolean connect(RemoteFileConfiguration configuration, org.apache.camel.Exchange exchange) throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationsconnect in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>configuration - configurationexchange - the exchange that trigger the connect (if any)org.apache.camel.component.file.GenericFileOperationFailedException - can be thrownprotected boolean doConnect(RemoteFileConfiguration configuration, org.apache.camel.Exchange exchange) throws org.apache.camel.component.file.GenericFileOperationFailedException
org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean isConnected()
throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationsisConnected in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedException - can be thrownpublic void disconnect()
throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationsdisconnect in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedException - can be thrownpublic void forceDisconnect()
throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationsforceDisconnect in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedException - can be thrownprotected void doDisconnect()
throws org.apache.camel.component.file.GenericFileOperationFailedException
org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean deleteFile(String name) throws org.apache.camel.component.file.GenericFileOperationFailedException
deleteFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean renameFile(String from, String to) throws org.apache.camel.component.file.GenericFileOperationFailedException
renameFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean buildDirectory(String directory, boolean absolute) throws org.apache.camel.component.file.GenericFileOperationFailedException
buildDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean retrieveFile(String name, org.apache.camel.Exchange exchange, long size) throws org.apache.camel.component.file.GenericFileOperationFailedException
retrieveFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic void releaseRetrievedFileResources(org.apache.camel.Exchange exchange)
throws org.apache.camel.component.file.GenericFileOperationFailedException
releaseRetrievedFileResources in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean storeFile(String name, org.apache.camel.Exchange exchange, long size) throws org.apache.camel.component.file.GenericFileOperationFailedException
storeFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean existsFile(String name) throws org.apache.camel.component.file.GenericFileOperationFailedException
existsFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionprotected boolean fastExistsFile(String name) throws org.apache.camel.component.file.GenericFileOperationFailedException
org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic String getCurrentDirectory() throws org.apache.camel.component.file.GenericFileOperationFailedException
getCurrentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic void changeCurrentDirectory(String path) throws org.apache.camel.component.file.GenericFileOperationFailedException
changeCurrentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic void changeToParentDirectory()
throws org.apache.camel.component.file.GenericFileOperationFailedException
changeToParentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic List<org.apache.commons.net.ftp.FTPFile> listFiles() throws org.apache.camel.component.file.GenericFileOperationFailedException
listFiles in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic List<org.apache.commons.net.ftp.FTPFile> listFiles(String path) throws org.apache.camel.component.file.GenericFileOperationFailedException
listFiles in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedExceptionpublic boolean sendNoop()
throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationssendNoop in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>org.apache.camel.component.file.GenericFileOperationFailedException - can be thrownpublic boolean sendSiteCommand(String command) throws org.apache.camel.component.file.GenericFileOperationFailedException
RemoteFileOperationssendSiteCommand in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>command - the commandorg.apache.camel.component.file.GenericFileOperationFailedException - can be thrownprotected org.apache.commons.net.ftp.FTPClient getFtpClient()
public org.apache.commons.net.ftp.FTPClient getClient()
Apache Camel