Class AbstractFileOperationProvider
- java.lang.Object
-
- org.apache.commons.vfs2.operations.AbstractFileOperationProvider
-
- All Implemented Interfaces:
FileOperationProvider
public abstract class AbstractFileOperationProvider extends java.lang.Object implements FileOperationProvider
- Since:
- 0.1
-
-
Constructor Summary
Constructors Constructor Description AbstractFileOperationProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addOperation(java.lang.Class<? extends FileOperation> operationClass)
Add new FileOperation to list of known operations.void
collectOperations(java.util.Collection<java.lang.Class<? extends FileOperation>> operationsList, FileObject file)
Gather available operations for the specified FileObject and put them into specified operationsList.protected abstract void
doCollectOperations(java.util.Collection<java.lang.Class<? extends FileOperation>> availableOperations, java.util.Collection<java.lang.Class<? extends FileOperation>> resultList, FileObject file)
Gather available operations for the specified FileObject and put them into specified operationsList.FileOperation
getOperation(FileObject file, java.lang.Class<? extends FileOperation> operationClass)
Get implementation for a given FileObject and FileOperation interface.protected abstract FileOperation
instantiateOperation(FileObject file, java.lang.Class<? extends FileOperation> operationClass)
Get operation instance for specified FileOperation subclass.protected java.lang.Class<? extends FileOperation>
lookupOperation(java.lang.Class<? extends FileOperation> operationClass)
Find class implementing a specific operation interface.
-
-
-
Constructor Detail
-
AbstractFileOperationProvider
public AbstractFileOperationProvider()
-
-
Method Detail
-
collectOperations
public final void collectOperations(java.util.Collection<java.lang.Class<? extends FileOperation>> operationsList, FileObject file) throws FileSystemException
Gather available operations for the specified FileObject and put them into specified operationsList.- Specified by:
collectOperations
in interfaceFileOperationProvider
- Parameters:
operationsList
- the list of available operations for the specified FileObject. The operationList contains classes of available operations, e.g. Class objects.file
- the FileObject for which we want to get the list of available operations.- Throws:
FileSystemException
- if list of operations cannot be retrieved.
-
doCollectOperations
protected abstract void doCollectOperations(java.util.Collection<java.lang.Class<? extends FileOperation>> availableOperations, java.util.Collection<java.lang.Class<? extends FileOperation>> resultList, FileObject file) throws FileSystemException
Gather available operations for the specified FileObject and put them into specified operationsList.- Parameters:
availableOperations
- the list of available operations for the specified FileObject.resultList
- List to be filled with applicable operations.file
- the FileObject for which we want to get the list of available operations.- Throws:
FileSystemException
- if list of operations cannot be retrieved.- See Also:
collectOperations(Collection operationsList, FileObject file)
-
getOperation
public final FileOperation getOperation(FileObject file, java.lang.Class<? extends FileOperation> operationClass) throws FileSystemException
Description copied from interface:FileOperationProvider
Get implementation for a given FileObject and FileOperation interface.- Specified by:
getOperation
in interfaceFileOperationProvider
- Parameters:
file
- the FileObject for which we need a operation.operationClass
- the Class which instance we are needed.- Returns:
- the required operation instance.
- Throws:
FileSystemException
- if operation cannot be retrieved.
-
instantiateOperation
protected abstract FileOperation instantiateOperation(FileObject file, java.lang.Class<? extends FileOperation> operationClass) throws FileSystemException
Get operation instance for specified FileOperation subclass.- Parameters:
file
- the file this operation should act on.operationClass
- the class of an file operation interface to instantiate.- Returns:
- a new file operation
- Throws:
FileSystemException
- if operation cannot be instantiated.
-
lookupOperation
protected final java.lang.Class<? extends FileOperation> lookupOperation(java.lang.Class<? extends FileOperation> operationClass) throws FileSystemException
Find class implementing a specific operation interface.- Parameters:
operationClass
- the interface which is requested.- Returns:
- never returns null
- Throws:
FileSystemException
- if operationClass is not a known FileOperation interface.
-
addOperation
protected final void addOperation(java.lang.Class<? extends FileOperation> operationClass) throws FileSystemException
Add new FileOperation to list of known operations.- Parameters:
operationClass
- a class implementing FileOperation.- Throws:
FileSystemException
- if instances of the class cannot be assigned to FileOperation.
-
-