Package org.apache.camel.component.file
Interface GenericFileOperations<T>
- All Known Implementing Classes:
FileOperations
public interface GenericFileOperations<T>
-
Method Summary
Modifier and TypeMethodDescriptionboolean
buildDirectory
(String directory, boolean absolute) Builds the directory structure.void
changeCurrentDirectory
(String path) Change the current remote directoryvoid
Change the current remote directory to the parentboolean
deleteFile
(String name) Deletes the file name by name, relative to the current directoryboolean
existsFile
(String name) Determines whether the files exists or notGets the current remote directoryT[]
List the files in the current directoryT[]
List the files in the given remote directoryCreates a new instance ofGenericFile
void
releaseRetrievedFileResources
(org.apache.camel.Exchange exchange) Releases the resources consumed by a retrieved fileboolean
renameFile
(String from, String to) Renames the fileboolean
retrieveFile
(String name, org.apache.camel.Exchange exchange, long size) Retrieves the filevoid
setEndpoint
(GenericFileEndpoint<T> endpoint) Sets the endpoint as some implementations need access to the endpoint and how its configured.boolean
Stores the content as a new remote file (upload)
-
Method Details
-
newGenericFile
GenericFile<T> newGenericFile()Creates a new instance ofGenericFile
-
setEndpoint
Sets the endpoint as some implementations need access to the endpoint and how its configured.- Parameters:
endpoint
- the endpoint
-
deleteFile
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
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
Renames the file- Parameters:
from
- original nameto
- 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 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
-
retrieveFile
boolean retrieveFile(String name, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException Retrieves the 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
void releaseRetrievedFileResources(org.apache.camel.Exchange exchange) throws GenericFileOperationFailedException Releases the resources consumed by a retrieved file- Parameters:
exchange
- exchange with the content of the file- Throws:
GenericFileOperationFailedException
- can be thrown
-
storeFile
boolean storeFile(String name, org.apache.camel.Exchange exchange, long size) throws GenericFileOperationFailedException Stores the content as a new remote file (upload)- Parameters:
name
- 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
-
getCurrentDirectory
Gets the current remote directory- Returns:
- the current directory path
- Throws:
GenericFileOperationFailedException
- can be thrown
-
changeCurrentDirectory
Change the current remote directory- Parameters:
path
- the path to change to- Throws:
GenericFileOperationFailedException
- can be thrown
-
changeToParentDirectory
Change the current remote directory to the parent- Throws:
GenericFileOperationFailedException
- can be thrown
-
listFiles
List the files in the current directory- Returns:
- a list of backing objects representing the files
- Throws:
GenericFileOperationFailedException
- can be thrown
-
listFiles
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
-