Class FileWriterBase

java.lang.Object
gda.device.detector.addetector.filewriter.FileWriterBase
All Implemented Interfaces:
NXFileWriterPlugin, NXFileWriterWithTemplate, NXPlugin, NXPluginBase, PositionInputStream<NXDetectorDataAppender>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
MultipleImagesPerHDF5FileWriter, MultipleImagesPerParallelHDF5FileWriter, SingleImagePerFileWriter

public abstract class FileWriterBase extends Object implements NXFileWriterPlugin, NXFileWriterWithTemplate, org.springframework.beans.factory.InitializingBean
  • Field Details

    • fileTemplate

      protected String fileTemplate
  • Constructor Details

    • FileWriterBase

      public FileWriterBase()
  • Method Details

    • disableFileWriting

      protected abstract void disableFileWriting() throws Exception
      Throws:
      Exception
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • isWriteErrorStatusSupported

      public boolean isWriteErrorStatusSupported()
    • setWriteErrorStatusSupported

      public void setWriteErrorStatusSupported(boolean writeErrorStatusSupported)
    • isWriteStatusErr

      public Boolean isWriteStatusErr() throws Exception
      Throws:
      Exception
    • checkErrorStatus

      protected void checkErrorStatus() throws DeviceException
      Throws:
      DeviceException
    • clearWriteStatusErr

      protected void clearWriteStatusErr() throws DeviceException
      Use this method to clear writeStatus ready for next scan.
      Throws:
      DeviceException
    • setNdFile

      public void setNdFile(NDFile ndFile)
    • setFileTemplate

      public void setFileTemplate(String fileTemplate)
      File template to pass directly to AreaDetector. AreaDetector's NDFilePlugin (http://cars.uchicago.edu/software/epics/NDPluginFile.html) will always apply arguments to the template in the order filepath, filename, filenumber
      Specified by:
      setFileTemplate in interface NXFileWriterWithTemplate
      Parameters:
      fileTemplate -
    • setFilePathTemplate

      public void setFilePathTemplate(String filePathTemplate)
      The file path to pass to AreadDetector, with $scan$ resolving to the currently running scan number, and $datadir$ to the current scan file's directory.
      Specified by:
      setFilePathTemplate in interface NXFileWriterWithTemplate
      Parameters:
      filePathTemplate -
    • setFileNameTemplate

      public void setFileNameTemplate(String fileNameTemplate)
      The file name to pass to AreadDetector, with $scan$ resolving to the currently running scan number, and $datadir$ to the current scan file's directory.
      Specified by:
      setFileNameTemplate in interface NXFileWriterWithTemplate
      Parameters:
      fileNameTemplate -
    • setFileNumberAtScanStart

      public void setFileNumberAtScanStart(long fileNumberAtScanStart)
      If non-negative, the file number to preset in AreaDetector before staring the exposure
      Parameters:
      fileNumberAtScanStart -
    • setSetFileNameAndNumber

      public void setSetFileNameAndNumber(boolean setFileNameAndNumber)
    • getNdFile

      public NDFile getNdFile()
    • getFileTemplate

      public String getFileTemplate()
      Returns:
      the file template to configure in AreaDetector
    • getFilePathTemplate

      public String getFilePathTemplate()
    • getFileNameTemplate

      public String getFileNameTemplate()
    • getFileNumberAtScanStart

      public long getFileNumberAtScanStart()
    • isSetFileNameAndNumber

      public boolean isSetFileNameAndNumber()
    • isPathErrorSuppressed

      public boolean isPathErrorSuppressed()
    • setPathErrorSuppressed

      public void setPathErrorSuppressed(boolean pathErrorSuppressed)
    • getFilePath

      protected String getFilePath()
      Returns:
      the file path to configure in AreaDetector
    • getFileDirRelativeToDataDirIfPossible

      protected String getFileDirRelativeToDataDirIfPossible()
      Only if the path template starts with the datadir, return a path relative to it, otherwise return an absolute path.
    • getRelativeFilePath

      protected String getRelativeFilePath() throws Exception
      Returns:
      the file path relative to the data directory if it starts with the datadir, otherwise returns absolute path.
      Throws:
      Exception
    • getAbsoluteFilePath

      protected String getAbsoluteFilePath(String filePathRelativeToDataDir)
    • getFileName

      protected String getFileName()
      Returns:
      the file name to configure in AreaDetector
    • getNdArrayPortVal

      public String getNdArrayPortVal()
    • setNdArrayPortVal

      public void setNdArrayPortVal(String ndArrayPortVal)
    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface NXPluginBase
      Throws:
      Exception
    • atCommandFailure

      public void atCommandFailure() throws Exception
      Specified by:
      atCommandFailure in interface NXPluginBase
      Throws:
      Exception
    • setEnabled

      public void setEnabled(boolean enableDuringScan)
    • isEnabled

      public boolean isEnabled()
    • enableCallback

      public void enableCallback(boolean enable) throws Exception
      Throws:
      Exception
    • getScanNumber

      protected long getScanNumber() throws Exception
      Returns:
      The unique scanNubmer from the current scan.
      Throws:
      Exception
    • getFullFileName

      public String getFullFileName() throws Exception
      Specified by:
      getFullFileName in interface NXFileWriterPlugin
      Throws:
      Exception
    • setNDArrayPortAndAddress

      protected void setNDArrayPortAndAddress() throws Exception
      Throws:
      Exception
    • willRequireCallbacks

      public boolean willRequireCallbacks()
      Specified by:
      willRequireCallbacks in interface NXPluginBase
    • prepareForLine

      public void prepareForLine() throws Exception
      Specified by:
      prepareForLine in interface NXPluginBase
      Throws:
      Exception
    • completeLine

      public void completeLine() throws Exception
      Specified by:
      completeLine in interface NXPluginBase
      Throws:
      Exception
    • completeCollection

      public void completeCollection() throws Exception
      Specified by:
      completeCollection in interface NXPluginBase
      Throws:
      Exception
    • prepareForCollection

      public void prepareForCollection(int numberImagesPerCollection, ScanInformation scanInfo) throws Exception
      Specified by:
      prepareForCollection in interface NXPluginBase
      Throws:
      Exception