org.apache.camel.component.file.remote
Class FtpOperations

java.lang.Object
  extended by org.apache.camel.component.file.remote.FtpOperations
All Implemented Interfaces:
org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>, RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Direct Known Subclasses:
FtpsOperations

public class FtpOperations
extends Object
implements RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>

FTP remote file operations


Field Summary
protected  org.apache.commons.net.ftp.FTPClient client
           
protected  org.apache.commons.net.ftp.FTPClientConfig clientConfig
           
protected  RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint
           
protected  org.slf4j.Logger log
           
 
Constructor Summary
FtpOperations(org.apache.commons.net.ftp.FTPClient client, org.apache.commons.net.ftp.FTPClientConfig clientConfig)
           
 
Method Summary
 boolean buildDirectory(String directory, boolean absolute)
           
 void changeCurrentDirectory(String path)
           
 void changeToParentDirectory()
           
 boolean connect(RemoteFileConfiguration configuration)
          Connects to the remote server
 boolean deleteFile(String name)
           
 void disconnect()
          Disconnects from the remote server
 boolean existsFile(String name)
           
protected  boolean fastExistsFile(String name)
           
 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 releaseRetreivedFileResources(org.apache.camel.Exchange exchange)
           
 boolean renameFile(String from, String to)
           
 boolean retrieveFile(String name, org.apache.camel.Exchange exchange)
           
 boolean sendNoop()
          Sends a noop command to the remote server
 boolean sendSiteCommand(String command)
          Sends a site command to the remote server
 void setEndpoint(org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint)
           
 boolean storeFile(String name, org.apache.camel.Exchange exchange)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.slf4j.Logger log

client

protected final org.apache.commons.net.ftp.FTPClient client

clientConfig

protected final org.apache.commons.net.ftp.FTPClientConfig clientConfig

endpoint

protected RemoteFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint
Constructor Detail

FtpOperations

public FtpOperations(org.apache.commons.net.ftp.FTPClient client,
                     org.apache.commons.net.ftp.FTPClientConfig clientConfig)
Method Detail

setEndpoint

public void setEndpoint(org.apache.camel.component.file.GenericFileEndpoint<org.apache.commons.net.ftp.FTPFile> endpoint)
Specified by:
setEndpoint in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>

connect

public boolean connect(RemoteFileConfiguration configuration)
                throws org.apache.camel.component.file.GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Connects to the remote server

Specified by:
connect in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Parameters:
configuration - configuration
Returns:
true if connected
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException - can be thrown

isConnected

public boolean isConnected()
                    throws org.apache.camel.component.file.GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Returns whether we are connected to the remote server or not

Specified by:
isConnected in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Returns:
true if connected, false if not
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException - can be thrown

disconnect

public void disconnect()
                throws org.apache.camel.component.file.GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Disconnects from the remote server

Specified by:
disconnect in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException - can be thrown

deleteFile

public boolean deleteFile(String name)
                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
deleteFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

renameFile

public boolean renameFile(String from,
                          String to)
                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
renameFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

buildDirectory

public boolean buildDirectory(String directory,
                              boolean absolute)
                       throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
buildDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

retrieveFile

public boolean retrieveFile(String name,
                            org.apache.camel.Exchange exchange)
                     throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
retrieveFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

releaseRetreivedFileResources

public void releaseRetreivedFileResources(org.apache.camel.Exchange exchange)
                                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
releaseRetreivedFileResources in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

storeFile

public boolean storeFile(String name,
                         org.apache.camel.Exchange exchange)
                  throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
storeFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

existsFile

public boolean existsFile(String name)
                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
existsFile in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

fastExistsFile

protected boolean fastExistsFile(String name)
                          throws org.apache.camel.component.file.GenericFileOperationFailedException
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

getCurrentDirectory

public String getCurrentDirectory()
                           throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
getCurrentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

changeCurrentDirectory

public void changeCurrentDirectory(String path)
                            throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
changeCurrentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

changeToParentDirectory

public void changeToParentDirectory()
                             throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
changeToParentDirectory in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

listFiles

public List<org.apache.commons.net.ftp.FTPFile> listFiles()
                                                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
listFiles in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

listFiles

public List<org.apache.commons.net.ftp.FTPFile> listFiles(String path)
                                                   throws org.apache.camel.component.file.GenericFileOperationFailedException
Specified by:
listFiles in interface org.apache.camel.component.file.GenericFileOperations<org.apache.commons.net.ftp.FTPFile>
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException

sendNoop

public boolean sendNoop()
                 throws org.apache.camel.component.file.GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Sends a noop command to the remote server

Specified by:
sendNoop in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Returns:
true if the noop was a success, false otherwise
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException - can be thrown

sendSiteCommand

public boolean sendSiteCommand(String command)
                        throws org.apache.camel.component.file.GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Sends a site command to the remote server

Specified by:
sendSiteCommand in interface RemoteFileOperations<org.apache.commons.net.ftp.FTPFile>
Parameters:
command - the command
Returns:
true if the command was a success, false otherwise
Throws:
org.apache.camel.component.file.GenericFileOperationFailedException - can be thrown

getFtpClient

protected org.apache.commons.net.ftp.FTPClient getFtpClient()


Apache Camel