Class FilesProviderWithDirectory

Object
AnchorBean<FilesProvider>
FilesProvider
FilesProviderWithDirectory
Direct Known Subclasses:
FilesProviderWithDirectoryString, FilesProviderWithDirectoryUnary, SingleFile

public abstract class FilesProviderWithDirectory extends FilesProvider
Base class for implementations of FilesProvider which do have an associated directory.
Author:
Owen Feehan
  • Constructor Details

    • FilesProviderWithDirectory

      public FilesProviderWithDirectory()
  • Method Details

    • create

      public final List<File> create(InputManagerParameters parameters) throws FilesProviderException
      Description copied from class: FilesProvider
      Creates or provides a list of files.
      Specified by:
      create in class FilesProvider
      Parameters:
      parameters - parameters influencing how input-files are obtained.
      Returns:
      the list of files from the provider
      Throws:
      FilesProviderException - if list of files cannot be successfully established.
    • rootDirectory

      public Optional<Path> rootDirectory(InputContextParameters inputContext)
      Description copied from class: FilesProvider
      A root directory for these files, if it exists.

      Any file that is part of the collection returned by this provider, must exist inside this directory (either directly or in any nested subdirectories).

      Specified by:
      rootDirectory in class FilesProvider
      Parameters:
      inputContext - the input-context.
      Returns:
      a path to this directory.
    • getDirectoryAsPath

      public abstract Path getDirectoryAsPath(InputContextParameters inputContext)
      The associated directory with the list of files.
      Parameters:
      inputContext - the input-context.
      Returns:
      the associated directory, as a path.
    • matchingFilesForDirectory

      public abstract List<File> matchingFilesForDirectory(Path directory, InputManagerParameters parameters) throws FilesProviderException
      The matching files for this provider that exist in a particular directory.

      This directory may or may not be searched recursively, depending on implementation.

      Parameters:
      directory - the directory.
      parameters - parameters passed to an InputManager to generate input-objects.
      Returns:
      a newly created list of matching files.
      Throws:
      FilesProviderException - if the operation is unable to complete successfully.
    • getDirectoryAsPathEnsureAbsolute

      public Path getDirectoryAsPathEnsureAbsolute(InputContextParameters inputContext)
      Like getDirectoryAsPath(org.anchoranalysis.io.input.InputContextParameters) but converts any relative path to absolute one.
      Parameters:
      inputContext - the input-context.
      Returns:
      an absolute path.