Class AbstractFileOperationProvider

java.lang.Object
org.apache.commons.vfs2.operations.AbstractFileOperationProvider
All Implemented Interfaces:
FileOperationProvider

public abstract class AbstractFileOperationProvider extends Object implements FileOperationProvider
Since:
0.1
  • Field Details

    • operations

      private final Collection<Class<? extends FileOperation>> operations
      Available operations. Operations could be registered for different schemes. Some operations can work only for "file" scheme, other - for "svnhttp(s)", "svn", "svnssh", but not for "file", etc. The Map has scheme as a key and Collection of operations that are available for that scheme.
  • Constructor Details

    • AbstractFileOperationProvider

      public AbstractFileOperationProvider()
  • Method Details

    • collectOperations

      public final void collectOperations(Collection<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 interface FileOperationProvider
      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(Collection<Class<? extends FileOperation>> availableOperations, Collection<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:
    • getOperation

      public final FileOperation getOperation(FileObject file, Class<? extends FileOperation> operationClass) throws FileSystemException
      Description copied from interface: FileOperationProvider
      Get implementation for a given FileObject and FileOperation interface.
      Specified by:
      getOperation in interface FileOperationProvider
      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, 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 Class<? extends FileOperation> lookupOperation(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(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.