Class FilePathService

java.lang.Object
uk.ac.diamond.daq.scanning.FilePathService
All Implemented Interfaces:
IFilePathService

public class FilePathService extends Object implements IFilePathService
Implementation of the IFilePathService which determines the next path to write to.
  • Constructor Details

    • FilePathService

      public FilePathService()
  • Method Details

    • getNextPath

      public String getNextPath(String template) throws IOException, InvalidPathException
      Description copied from interface: IFilePathService
      Determine and return the next file path to write to. The file will be in the default output directory.
      Specified by:
      getNextPath in interface IFilePathService
      Parameters:
      template - for instance the sample name, may be null or empty string if no template is required.
      Returns:
      next file path
      Throws:
      IOException
      InvalidPathException
    • getNextPath

      public String getNextPath(String dir, String template) throws IOException, InvalidPathException
      Description copied from interface: IFilePathService
      Determine and return the next file path to write to within the given output directory.
      Specified by:
      getNextPath in interface IFilePathService
      Parameters:
      dir - directory to create the file in
      template - for instance the sample name, may be null or empty string if no template is required
      Returns:
      next file path
      Throws:
      IOException
      InvalidPathException
    • createFolderForLinkedFiles

      public String createFolderForLinkedFiles(String filename) throws Exception
      Description copied from interface: IFilePathService
      Creates and returns the path of a new folder in the same parent folder as file path with the same name as the given file, minus the file extension. This folder can be used to write linked files to for the given scan. If the filename given is a filepath, only the last segment will be used.
      Specified by:
      createFolderForLinkedFiles in interface IFilePathService
      Parameters:
      filename - the name of the file
      Returns:
      path of new folder
      Throws:
      Exception - if the folder cannot be created for any reason
    • getMostRecentPath

      public String getMostRecentPath()
      Description copied from interface: IFilePathService
      Returns the name of the path returned by the most recent call to
      invalid reference
      #getNextPath()
      . Note that this is not guaranteed to be the file for the current scan.
      Specified by:
      getMostRecentPath in interface IFilePathService
      Returns:
      last file path
    • getVisitDir

      public String getVisitDir()
      Description copied from interface: IFilePathService
      Returns the full path to the visit directory
      Specified by:
      getVisitDir in interface IFilePathService
      Returns:
      full path to the visit directory
    • getTempDir

      public String getTempDir()
      Description copied from interface: IFilePathService
      Returns the location of the directory to use for temporary files for the current visit. In GDA this is mapped to the tmp subdirectory of the current visit directory, the contents of which are deleted every 2 days.
      Specified by:
      getTempDir in interface IFilePathService
      Returns:
      location of temp directory for the current visit
    • getProcessedFilesDir

      public String getProcessedFilesDir()
      Description copied from interface: IFilePathService
      Returns the location of the directory in which to place processed files. TODO: remove this method and just use a subpath of /tmp
      Specified by:
      getProcessedFilesDir in interface IFilePathService
      Returns:
      processed files
    • getProcessingDir

      public String getProcessingDir()
      Description copied from interface: IFilePathService
      Returns the location of the directory where processing file live.
      Specified by:
      getProcessingDir in interface IFilePathService
      Returns:
      location of directory containing processing files
    • getPersistenceDir

      public String getPersistenceDir()
      Description copied from interface: IFilePathService
      Returns the location of persistence directory. This is the location of a global read/write directory where persistent files can be stored.
      Specified by:
      getPersistenceDir in interface IFilePathService
      Returns:
      location of persistence directory.
    • getProcessingTemplatesDir

      public String getProcessingTemplatesDir()
      Description copied from interface: IFilePathService
      Returns the location of the directory containing templates for cluster processing.
      Specified by:
      getProcessingTemplatesDir in interface IFilePathService
      Returns:
      location of the processing templates directory
    • getScanNumber

      public int getScanNumber() throws Exception
      Specified by:
      getScanNumber in interface IFilePathService
      Returns:
      the current scan number. Same as NumTracker.getCurrentFileNumber() in GDA8.
      Throws:
      Exception
    • getVisit

      public String getVisit() throws Exception
      Specified by:
      getVisit in interface IFilePathService
      Returns:
      the current visit number LocalProperties.get(LocalProperties.GDA_DEF_VISIT, LocalProperties.DEFAULT_VISIT)
      Throws:
      Exception
    • getVisitConfigDir

      public String getVisitConfigDir()
      Description copied from interface: IFilePathService
      Returns the location of the directory to use for files such configuration files of any type, saved scan files, etc. In GDA this is mapped to the xml subdirectory of the current visit directory, the contents of which live for the lifetime of the visit.
      Specified by:
      getVisitConfigDir in interface IFilePathService
      Returns:
      location of the configuration directory for the current visit