Class FileRegistrar

All Implemented Interfaces:
IFileRegistrar, IDataWriterExtender, Findable

public class FileRegistrar extends DataWriterExtenderBase implements IFileRegistrar

The FileRegistrar deals with archiving in both the GDA8 and the GDA9 scanning systems.

To be used in 9

the init-method "register" must be called. This ensures that the FileRegistrar is registered as a scanning participant. Now whenever a scan is run its @FileDeclared and @ScanEnd annotations will be run.

 <bean id="FileRegistrar" class="gda.data.fileregistrar.FileRegistrar" init-method="register">
     <property name="name" value="FileRegistrar"/> 
     <property name="directory" value="/dls/bl-misc/dropfiles2/icat/dropZone/${gda.instrument}-" />
 </bean> 
 

To be used in 8

In GDA8 File registration listens to scans (via DataWriterExtender) and can be used directly by detectors. Files will be archived and listed in icat and possibly post-processed. Whatever the pipeline is configured to do.
 <bean id="FileRegistrar" class="gda.data.fileregistrar.FileRegistrar"
     <property name="name" value="FileRegistrar"/> 
     <property name="directory" value="/dls/bl-misc/dropfiles2/icat/dropZone/${gda.instrument}-" />
 </bean> 
 
  • Constructor Details

  • Method Details

    • registerFile

      public void registerFile(String fileName)
      Entry point in GDA8 scanning to register a file
      Specified by:
      registerFile in interface IFileRegistrar
      Parameters:
      fileName - absolute Pathname of file to register
    • registerFiles

      public void registerFiles(String[] fileNames)
      Entry point in GDA8 scanning to register files
      Specified by:
      registerFiles in interface IFileRegistrar
      Parameters:
      fileNames - An array of absolute Pathnames of files to register
    • addScanFile

      public void addScanFile(String filePath)
      Normally in GDA8 the IFileRegistrar interface is made available to register files. That interface should be used rather than this method. In GDA9 this is redundant because annotations are used for any object participating in a scan. The @FileDeclared injects the filenames to be used in the scan. You may also inject the first position of the scan or any OSGi service or the ScanInformation when using this annotation.
      Parameters:
      filePath - - the full path to the file
    • addData

      public void addData(IDataWriterExtender parent, IScanDataPoint dataPoint) throws Exception
      Description copied from interface: IDataWriterExtender
      called by a DataWriter after it has processed addData
      Specified by:
      addData in interface IDataWriterExtender
      Overrides:
      addData in class DataWriterExtenderBase
      Parameters:
      parent -
      dataPoint -
      Throws:
      Exception
    • completeCollection

      public void completeCollection(IDataWriterExtender parent)
      Description copied from interface: IDataWriterExtender
      called by a DataWriter after it has processed completeCollection
      Specified by:
      completeCollection in interface IDataWriterExtender
      Overrides:
      completeCollection in class DataWriterExtenderBase
      Parameters:
      parent -
    • scanEnd

      public void scanEnd()
    • scanFinally

      public void scanFinally()
    • getName

      public String getName()
      Description copied from interface: Findable
      Get the object name. Used by Castor to check if the object name has been set before calling the Findable.setName(String) method.
      Specified by:
      getName in interface Findable
      Returns:
      a String containing the object name.
    • setName

      public void setName(String name)
      Description copied from interface: Findable
      Set or change the name of the object (as defined in XML).
      Specified by:
      setName in interface Findable
      Parameters:
      name - the object name
    • getIcatXMLCreator

      public ArchiveFileCreator getIcatXMLCreator()
    • getClientFileAnnouncer

      public DeviceBase getClientFileAnnouncer()
    • setClientFileAnnouncer

      public void setClientFileAnnouncer(ClientFileAnnouncer clientFileAnnouncer)
      Clients can listen to this object for String arrays with filenames of recently created files to update their data projects.
      Parameters:
      clientFileAnnouncer -
    • register

      public void register()
      Method called by spring to register the registrar with solstice scanning.
      Throws:
      NullPointerException - if there is no IRunnableDeviceService - this is intentional and an error
      ClassCastException - if IRunnableDeviceService is not a IScanService which is must be.