Class NexusDataWriterConfiguration

java.lang.Object
gda.factory.FindableBase
gda.data.scan.datawriter.NexusDataWriterConfiguration
All Implemented Interfaces:
Findable

public class NexusDataWriterConfiguration extends FindableBase
An instance of this class holds some configuration about how to write nexus files for all scans on this beamline, e.g. metadata scannables to be added to each scan, the location map to use, etc.

The preferred approach is to define this as a bean in Spring. If the deprecated static methods are used in NexusDataWriter, an instance of this class is implicitly created via the ServiceHolder.

WARN: Invoking the static NDW methods with Spring is not compatible with defining a bean for this type in Spring

  • Constructor Details

    • NexusDataWriterConfiguration

      public NexusDataWriterConfiguration()
      Do not call this constructor directly except in test code. It should be declared in spring and accessed via getInstance(). For use in test code only!
  • Method Details

    • getInstance

      public static NexusDataWriterConfiguration getInstance()
    • unregisterFromOsgi

      @Deprecated(since="GDA 9.26", forRemoval=true) public void unregisterFromOsgi()
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method should be deleted once NDW static methods are removed
      If this was successfully registered with OSGi then unregister.
    • getMetadataScannables

      public Set<String> getMetadataScannables()
      Returns the names of the configured metadata scannables. These will be added to the nexus file for all scans on this beamline.
      Returns:
      metadata scannables
    • setMetadataScannables

      public void setMetadataScannables(Set<String> metadataScannables)
    • addMetadataScannable

      public void addMetadataScannable(String scannableName)
    • removeMetadataScannable

      public boolean removeMetadataScannable(String scannableName)
    • getLocationMap

      public Map<String,ScannableWriter> getLocationMap()
      Returns the location map, a map from scannable name to a ScannableWriter that writes the scannable with that name. The scannable writer also contains the ScannableWriter.getPrerequisiteScannableNames().
      Returns:
      the location map
    • setLocationMap

      public void setLocationMap(Map<String,ScannableWriter> locationMap)
    • getMetadataScannablesPerDetectorMap

      public Map<String,Set<String>> getMetadataScannablesPerDetectorMap()
      Returns the map of scannables per detectors, i.e. these are scannables that are written as metadata scannables to the nexus file for scans that include the detector.
      Returns:
      scannables per detector map
    • setMetadataScannablesPerDetectorMap

      public void setMetadataScannablesPerDetectorMap(Map<String,Collection<String>> metadataScannablesPerDetector)
    • setMetadataScannablesForDetector

      public void setMetadataScannablesForDetector(String detectorName, Set<String> metadataScananbles)
    • getMetadataScannablesForDetector

      public Set<String> getMetadataScannablesForDetector(String detectorName)
    • getMetadataScannablesForScannable

      public Set<String> getMetadataScannablesForScannable(String scannableName)
    • getNexusTemplateFiles

      public List<String> getNexusTemplateFiles()
      Returns the nexus template files that will applied to the nexus file as written.
      Returns:
      nexus template files
    • setNexusTemplateFiles

      public void setNexusTemplateFiles(List<String> nexusTemplateFiles)
    • getMetadata

      public Map<String,String> getMetadata()
      Returns the metadata to be added to the nexus files.
      Returns:
      nexus file
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
      Allow arbitrary metadata to be added to nexus data files.

      To add an entry (eg sample_background) to each file as a note in the "sample" group, set the entries as {'sample_background': 'sample:NXsample/sample_background'}

      Parameters:
      metadata - should be a map of metadata names to nexus paths (relative to the top level /entry1/ node.
    • clear

      public void clear()
      Clears the contents of this configuration.
    • getNexusTemplates

      public List<NexusTemplate> getNexusTemplates()
    • addNexusTemplate

      public void addNexusTemplate(String name, NexusTemplate nt)
    • setNexusTemplates

      public void setNexusTemplates(Map<String,NexusTemplate> nexusTemplates)
    • removeNexusTemplate

      public void removeNexusTemplate(String name)