Package org.apache.camel.component.file
Class FileOperations
java.lang.Object
org.apache.camel.component.file.FileOperations
- All Implemented Interfaces:
GenericFileOperations<File>
File operations for
File.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbuildDirectory(File dir, Set<PosixFilePermission> permissions, boolean absolute, boolean stepwise) booleanbuildDirectory(String directory, boolean absolute) Builds the directory structure.voidchangeCurrentDirectory(String path) Change the current remote directoryvoidChange the current remote directory to the parentbooleandeleteFile(String name) Deletes the file name by name, relative to the current directorybooleanexistsFile(String name) Determines whether the files exists or notGets the current remote directoryFile[]List the files in the current directoryFile[]List the files in the given remote directoryCreates a new instance ofGenericFilevoidreleaseRetrievedFileResources(org.apache.camel.Exchange exchange) Releases the resources consumed by a retrieved filebooleanrenameFile(String from, String to) Renames the filebooleanretrieveFile(String name, org.apache.camel.Exchange exchange, long size) Retrieves the filevoidsetEndpoint(GenericFileEndpoint<File> endpoint) Sets the endpoint as some implementations need access to the endpoint and how its configured.booleanStores the content as a new remote file (upload)
-
Constructor Details
-
FileOperations
public FileOperations() -
FileOperations
-
-
Method Details
-
newGenericFile
Description copied from interface:GenericFileOperationsCreates a new instance ofGenericFile- Specified by:
newGenericFilein interfaceGenericFileOperations<File>
-
setEndpoint
Description copied from interface:GenericFileOperationsSets the endpoint as some implementations need access to the endpoint and how its configured.- Specified by:
setEndpointin interfaceGenericFileOperations<File>- Parameters:
endpoint- the endpoint
-
deleteFile
Description copied from interface:GenericFileOperationsDeletes the file name by name, relative to the current directory- Specified by:
deleteFilein interfaceGenericFileOperations<File>- Parameters:
name- name of the file- Returns:
- true if deleted, false if not
- Throws:
GenericFileOperationFailedException- can be thrown
-
renameFile
Description copied from interface:GenericFileOperationsRenames the file- Specified by:
renameFilein interfaceGenericFileOperations<File>- Parameters:
from- original nameto- the new name- Returns:
- true if renamed, false if not
- Throws:
GenericFileOperationFailedException- can be thrown
-
existsFile
Description copied from interface:GenericFileOperationsDetermines whether the files exists or not- Specified by:
existsFilein interfaceGenericFileOperations<File>- Parameters:
name- name of the file- Returns:
- true if exists, false if not
- Throws:
GenericFileOperationFailedException- can be thrown
-
buildDirectory
protected boolean buildDirectory(File dir, Set<PosixFilePermission> permissions, boolean absolute, boolean stepwise) -
buildDirectory
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException Description copied from interface:GenericFileOperationsBuilds the directory structure. Will test if the folder already exists.- Specified by:
buildDirectoryin interfaceGenericFileOperations<File>- Parameters:
directory- the directory path to build as a relative string nameabsolute- whether 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
-
listFiles
Description copied from interface:GenericFileOperationsList the files in the current directory- Specified by:
listFilesin interfaceGenericFileOperations<File>- Returns:
- a list of backing objects representing the files
- Throws:
GenericFileOperationFailedException- can be thrown
-
listFiles
Description copied from interface:GenericFileOperationsList the files in the given remote directory- Specified by:
listFilesin interfaceGenericFileOperations<File>- Parameters:
path- the remote directory- Returns:
- a list of backing objects representing the files
- Throws:
GenericFileOperationFailedException- can be thrown
-
changeCurrentDirectory
Description copied from interface:GenericFileOperationsChange the current remote directory- Specified by:
changeCurrentDirectoryin interfaceGenericFileOperations<File>- Parameters:
path- the path to change to- Throws:
GenericFileOperationFailedException- can be thrown
-
changeToParentDirectory
Description copied from interface:GenericFileOperationsChange the current remote directory to the parent- Specified by:
changeToParentDirectoryin interfaceGenericFileOperations<File>- Throws:
GenericFileOperationFailedException- can be thrown
-
getCurrentDirectory
Description copied from interface:GenericFileOperationsGets the current remote directory- Specified by:
getCurrentDirectoryin interfaceGenericFileOperations<File>- Returns:
- the current directory path
- Throws:
GenericFileOperationFailedException- can be thrown
-
retrieveFile
public boolean retrieveFile(String name, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException Description copied from interface:GenericFileOperationsRetrieves the file- Specified by:
retrieveFilein interfaceGenericFileOperations<File>- Parameters:
name- name of the fileexchange- stream to write the content of the file intosize- the total file size to retrieve, if possible to determine- Returns:
- true if file has been retrieved, false if not
- Throws:
GenericFileOperationFailedException- can be thrown
-
releaseRetrievedFileResources
public void releaseRetrievedFileResources(org.apache.camel.Exchange exchange) throws GenericFileOperationFailedException Description copied from interface:GenericFileOperationsReleases the resources consumed by a retrieved file- Specified by:
releaseRetrievedFileResourcesin interfaceGenericFileOperations<File>- Parameters:
exchange- exchange with the content of the file- Throws:
GenericFileOperationFailedException- can be thrown
-
storeFile
public boolean storeFile(String fileName, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException Description copied from interface:GenericFileOperationsStores the content as a new remote file (upload)- Specified by:
storeFilein interfaceGenericFileOperations<File>- Parameters:
fileName- name of new fileexchange- with the content content of the filesize- the total file size to store, if possible to determine- Returns:
- true if the file was stored, false if not
- Throws:
GenericFileOperationFailedException- can be thrown
-