org.apache.camel.component.file
Interface GenericFileOperations<T>

All Known Subinterfaces:
RemoteFileOperations<T>
All Known Implementing Classes:
FileOperations, FtpOperations, FtpsOperations, SftpOperations

public interface GenericFileOperations<T>


Method Summary
 boolean buildDirectory(String directory, boolean absolute)
          Builds the directory structure.
 void changeCurrentDirectory(String path)
          Change the current remote directory
 void changeToParentDirectory()
          Change the current remote directory to the parent
 boolean deleteFile(String name)
          Deletes the file name by name, relative to the current directory
 boolean existsFile(String name)
          Determines whether the files exists or not
 String getCurrentDirectory()
          Gets the current remote directory
 List<T> listFiles()
          List the files in the current directory
 List<T> listFiles(String path)
          List the files in the given remote directory
 boolean renameFile(String from, String to)
          Renames the file
 boolean retrieveFile(String name, Exchange exchange)
          Retrieves the file
 void setEndpoint(GenericFileEndpoint<T> endpoint)
          Sets the endpoint as some implementations need access to the endpoint and how its configured.
 boolean storeFile(String name, Exchange exchange)
          Stores the content as a new remote file (upload)
 

Method Detail

setEndpoint

void setEndpoint(GenericFileEndpoint<T> endpoint)
Sets the endpoint as some implementations need access to the endpoint and how its configured.

Parameters:
endpoint - the endpoint

deleteFile

boolean deleteFile(String name)
                   throws GenericFileOperationFailedException
Deletes the file name by name, relative to the current directory

Parameters:
name - name of the file
Returns:
true if deleted, false if not
Throws:
GenericFileOperationFailedException - can be thrown

existsFile

boolean existsFile(String name)
                   throws GenericFileOperationFailedException
Determines whether the files exists or not

Parameters:
name - name of the file
Returns:
true if exists, false if not
Throws:
GenericFileOperationFailedException - can be thrown

renameFile

boolean renameFile(String from,
                   String to)
                   throws GenericFileOperationFailedException
Renames the file

Parameters:
from - original name
to - the new name
Returns:
true if renamed, false if not
Throws:
GenericFileOperationFailedException - can be thrown

buildDirectory

boolean buildDirectory(String directory,
                       boolean absolute)
                       throws GenericFileOperationFailedException
Builds the directory structure. Will test if the folder already exists.

Parameters:
directory - the directory path to build as a relative string name
absolute - wether the directory is an absolute or relative path
Returns:
true if build or already exists, false if not possible (could be lack of permissions)
Throws:
GenericFileOperationFailedException - can be thrown

retrieveFile

boolean retrieveFile(String name,
                     Exchange exchange)
                     throws GenericFileOperationFailedException
Retrieves the file

Parameters:
name - name of the file
exchange - stream to write the content of the file into
Returns:
true if file has been retrieved, false if not
Throws:
GenericFileOperationFailedException - can be thrown

storeFile

boolean storeFile(String name,
                  Exchange exchange)
                  throws GenericFileOperationFailedException
Stores the content as a new remote file (upload)

Parameters:
name - name of new file
exchange - with the content content of the file
Returns:
true if the file was stored, false if not
Throws:
GenericFileOperationFailedException - can be thrown

getCurrentDirectory

String getCurrentDirectory()
                           throws GenericFileOperationFailedException
Gets the current remote directory

Returns:
the current directory path
Throws:
GenericFileOperationFailedException - can be thrown

changeCurrentDirectory

void changeCurrentDirectory(String path)
                            throws GenericFileOperationFailedException
Change the current remote directory

Parameters:
path - the path to change to
Throws:
GenericFileOperationFailedException - can be thrown

changeToParentDirectory

void changeToParentDirectory()
                             throws GenericFileOperationFailedException
Change the current remote directory to the parent

Throws:
GenericFileOperationFailedException - can be thrown

listFiles

List<T> listFiles()
                  throws GenericFileOperationFailedException
List the files in the current directory

Returns:
a list of backing objects representing the files
Throws:
GenericFileOperationFailedException - can be thrown

listFiles

List<T> listFiles(String path)
                  throws GenericFileOperationFailedException
List the files in the given remote directory

Parameters:
path - the remote directory
Returns:
a list of backing objects representing the files
Throws:
GenericFileOperationFailedException - can be thrown


Apache CAMEL