Class PathPrefixerAvoidResolve

Object
AnchorBean<PathPrefixer>
PathPrefixer
PathPrefixerAvoidResolve
Direct Known Subclasses:
DirectoryStructure, FromDescriptiveName, IfIncrementingNumberRequested, IncrementingNumber, LastDirectoryAsPrefix, PathRegEx

public abstract class PathPrefixerAvoidResolve extends PathPrefixer
A file-path-resolver that adds additional methods that perform the same function but output a relative-path rather than an absolute path after fully resolving paths

This is useful for combining with the MultiRootedFilePathPrefixer. This results in relative-paths keeping the same root, as when passed in.

Author:
Owen Feehan
  • Constructor Details

    • PathPrefixerAvoidResolve

      protected PathPrefixerAvoidResolve(String prefix)
      Creates with a prefix.
      Parameters:
      prefix - a string prefixed to each output-path (see property description).
    • PathPrefixerAvoidResolve

      public PathPrefixerAvoidResolve()
  • Method Details

    • rootDirectoryPrefix

      public DirectoryWithPrefix rootDirectoryPrefix(Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException
      Description copied from class: PathPrefixer
      Provides a prefix that becomes the root-folder. The prefix should be an absolute path.
      Specified by:
      rootDirectoryPrefix in class PathPrefixer
      Parameters:
      experimentIdentifier - if defined, an identifier for the experiment, to be included in the directory root.
      context - the context in which prefixing of paths occurs.
      Returns:
      a directory with an associated prefix.
      Throws:
      PathPrefixerException - if unable to successfully determine a prefix.
    • outFilePrefix

      public DirectoryWithPrefix outFilePrefix(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException
      Description copied from class: PathPrefixer
      Provides a prefix which can be prepended to all output files. The prefix should be an absolute path.
      Specified by:
      outFilePrefix in class PathPrefixer
      Parameters:
      path - an input to derive a prefix from
      experimentIdentifier - if defined, an identifier for the experiment, to be included in the directory root.
      context - the context in which prefixing of paths occurs.
      Returns:
      a directory with an associated prefix.
      Throws:
      PathPrefixerException - if unable to successfully determine a prefix.
    • rootDirectoryPrefixAvoidResolve

      public DirectoryWithPrefix rootDirectoryPrefixAvoidResolve(Optional<String> experimentIdentifier)
      Provides a prefix that becomes the root-folder. It avoids resolving relative-paths.

      This is an alternative method to rootDirectoryPrefix that avoids resolving the out-path prefix against the file system

      Parameters:
      experimentIdentifier - if defined, an identifier for the experiment, to be included in the directory root.
      Returns:
      a prefixer
    • outFilePrefixAvoidResolve

      public DirectoryWithPrefix outFilePrefixAvoidResolve(NamedPath path, Optional<String> experimentIdentifier, PathPrefixerContext context) throws PathPrefixerException
      Provides a prefix which can be prepended to all output files. It avoids resolving relative-paths.
      Parameters:
      path - an input-path to match against
      experimentIdentifier - if defined, an identifier for the experiment, to be included in the directory root.
      context - the path-prefixer context.
      Returns:
      a prefixer.
      Throws:
      PathPrefixerException - if a prefix cannot be successfully derived.
    • outFilePrefixFromPath

      public abstract DirectoryWithPrefix outFilePrefixFromPath(NamedPath path, Path root, PathPrefixerContext context) throws PathPrefixerException
      Determines the out-file prefix from a path.
      Parameters:
      path - path to calculate prefix from with associated descriptive-name
      root - root of prefix
      context - the path-prefixer context.
      Returns:
      folder/filename for prefixing.
      Throws:
      PathPrefixerException - if a prefix cannot be successfully derived.
    • getPrefix

      public String getPrefix()
      A string prefixed to each output-path.

      This is typically a directory which to output the experiment-directory and files, but it may also be a combination of a directory and a file-name prefix.

      If empty, first the bean will try to use any output-directory set in the input context if it exists, or otherwise use the system temp directory.

    • setPrefix

      public void setPrefix(String prefix)
      A string prefixed to each output-path.

      This is typically a directory which to output the experiment-directory and files, but it may also be a combination of a directory and a file-name prefix.

      If empty, first the bean will try to use any output-directory set in the input context if it exists, or otherwise use the system temp directory.