Interface NexusObjectProvider<N extends NXobject>
- Type Parameters:
N- a subinterface ofNXobjectthat an object
- All Superinterfaces:
NexusEntryModification
- All Known Implementing Classes:
AbstractNexusObjectProvider,NexusObjectWrapper,NexusUser,NXObjectProvider
Defines the interface for a class that can create a a NeXus object of a particular type.
(i.e. an instance of a NeXus base class).
For example, this interface can be implemented by classes representing devices such
as positioners or detectors; alternatively a wrapper class implementing this class
could contain objects representing such devices, this allows for greater decoupling.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the names of any additional primary data fields for this device.getAuxiliaryDataFieldNames(String dataGroupName) Returns the names of the data fields for the given auxiliary data group as aList.Returns the names of any auxiliary data groups to create.Returns the axis data field names for this object.getAxisDataFieldsForPrimaryDataField(String primaryDataFieldName) Returns the names of any data fields that are axes for the primary data field with the given name.Returns the category for thisNexusObjectProvider.Returns the name of the collection for thisNexusObjectProvider.Returns the name of the default axis field for this nexus object, if any.getDefaultAxisDimension(String primaryDataFieldName, String axisDataFieldName) Returns the dimension of the given primary data field for which the data field with the given name is a default axis, ornullif this field does not provide a default axis to the default data field.int[]getDimensionMappings(String primaryDataFieldName, String axisDataFieldName) Returns the dimension mappings between the data field and the primary data field with the given names.intgetExternalDatasetRank(String fieldName) Returns the rank of the external dataset with the given field name.Returns the names of the external HDF5 file(s) that this device writes its data to, ornullif none.getName()Get the name of the provider.Return the NeXus base class enum value for the type NeXus object this provider creates.Returns the NeXus object for this provider, creating it if necessary The same NeXus object must be returned each time this method is invokedReturns the name of the default data field to write to within the nexus object.getPropertyValue(String propertyName) Returns the value of the application defined property of this object with the given name.Returns aNexusScanInfo.ScanRoledefining the role of the device for this nexus object provider performs in the scan.
-
Method Details
-
getName
String getName()Get the name of the provider. This is used as the name of the NeXus object (i.e. group) in the parent group to which it is added.- Returns:
- name of base
-
getNexusBaseClass
NexusBaseClass getNexusBaseClass()Return the NeXus base class enum value for the type NeXus object this provider creates.- Returns:
- the
NexusBaseClassfor this object provider
-
getNexusObject
N getNexusObject()Returns the NeXus object for this provider, creating it if necessary The same NeXus object must be returned each time this method is invoked- Returns:
- NeXus object or
null
-
getCategory
NexusBaseClass getCategory()Returns the category for thisNexusObjectProvider. When adding a nexus object to aNexusEntryBuilder, the nexus object will be added to a group of this type, if one exists in the skeleton tree. For example aNexusObjectProviderthat provides anNXpositionerwould normally be added to theNXinstrumentgroup, but if this method returnsNexusBaseClass.NX_SAMPLE, then it will instead be added to theNXsamplegroup.- Returns:
- category for this object
-
getCollectionName
String getCollectionName()Returns the name of the collection for thisNexusObjectProvider. When adding a nexus object to aNexusEntryBuilder, if this method does not returnnull, then the nexus object will be added to theNXcollectionwith this name within the group that it would have been added to otherwise. The collection will be created if it does not already exist.- Returns:
- collection name or
null
-
getScanRole
NexusScanInfo.ScanRole getScanRole()Returns aNexusScanInfo.ScanRoledefining the role of the device for this nexus object provider performs in the scan. This affects how the fields within the nexus object returned bygetNexusObject()are added to theNXdatagroup, if any. For example andNXdatagroup will be created for each primary field of each detector, and axis fields The nexus writing framework already knows theNexusScanInfo.ScanRoleof theINexusDevicewhoseinvalid input: 'method returned this NexusObjectProvider, as the INexusDevices are grouped by ScanRole in the NexusScanModel. However, some INexusDevices may correspond to multiple devices with different roles in the scan - a malcolm device is an example of this. Where this is the case, this method can returns a non-null value to override the scan ro @return the role of this device in the scan, where <code>null</code> tells the nexus writing framework to use the scan role of the {@link INexusDevice} in the NexusScanModel which produced this provider' -
getExternalFileNames
Returns the names of the external HDF5 file(s) that this device writes its data to, ornullif none.- Returns:
- name of external file, or
null
-
getExternalDatasetRank
Returns the rank of the external dataset with the given field name.- Parameters:
fieldName- field name- Returns:
- rank of external dataset with given field name
- Throws:
IllegalArgumentException- if no such field exists
-
getAxisDataFieldNames
Returns the axis data field names for this object. These are the fields that will be linked to when this this object is added to anNexusDataBuilderto construct anNXdatagroup. This method should not return the names of primary data fields, nor should it return the names of data fields which should only be added to theNXdatagroups for a particular primary data field (anNXdatagroup is added to the scan for each primary data field, as returned bygetPrimaryDataFieldName()andgetAdditionalPrimaryDataFieldNames()). The primary data field will also be linked to in anNXdatagroup, except where this device is the primary device for the scan where it is not linked to in theNXdatagroups for additional primary data fields.- Returns:
- name of data fields for this object
-
getPrimaryDataFieldName
String getPrimaryDataFieldName()Returns the name of the default data field to write to within the nexus object. If this object is added as the primary device to anNXdatagroup, then this is the field name of the default field, i.e. the field referred to by the@signalattribute.If additional
NXdatagroups should be created for other fields in this scan, then the names of these fields should be returned bygetAdditionalPrimaryDataFieldNames().- Returns:
- default data field name, this cannot be
null
-
getAdditionalPrimaryDataFieldNames
Returns the names of any additional primary data fields for this device. This method indicates that if this device is to be used to create anNXdatawith the fieldgetPrimaryDataFieldName()as the default (signal field), then additionalNXdatagroups should be created for each of these fields.- Returns:
- additional primary data field names
-
getAxisDataFieldsForPrimaryDataField
Returns the names of any data fields that are axes for the primary data field with the given name. These data fields are those that should be added to theNXdatagroup for the primary data field with the given name (and not those for other primary data fields), in addition to the data fields returned bygetAxisDataFieldNames()- Parameters:
primaryDataFieldName- primary data field name- Returns:
- names of data fields
-
getDefaultAxisDataFieldName
String getDefaultAxisDataFieldName()Returns the name of the default axis field for this nexus object, if any. If this object is added as a device to anNXdatathen this is the field that will be added as a default axis of the@signalfield, for example for a positioner this may be the demand field.- Returns:
- name of demand field, or
nullif none.
-
getDefaultAxisDimension
Returns the dimension of the given primary data field for which the data field with the given name is a default axis, ornullif this field does not provide a default axis to the default data field. This method is required only when this device provides the default data field of anNXdatagroup (i.e. that referred to by the@signalattribute), and additional data fields within this device provide default axis for that data field- Parameters:
primaryDataFieldName- name of primary data fieldaxisDataFieldName- axis data field name- Returns:
- dimension of the default data field for which the field with the
given name provides a default axis, or
nullif none
-
getDimensionMappings
Returns the dimension mappings between the data field and the primary data field with the given names. This method is required only when this device provides the default data field of anNXdatagroup (i.e. that referred to by thesignalattribute), and additional data fields within that and the default data field of this device.- Parameters:
primaryDataFieldName- field nameaxisDataFieldName- axis data field name- Returns:
- dimension mappings between the field with the given name and the default data field
-
getAuxiliaryDataGroupNames
Returns the names of any auxiliary data groups to create. An auxiliary data group is one that groups a number of data group with the same rank together. A typical use case would be for statistics about the main data field for the device, such as min, max, mean, sum, etc.- Returns:
- names of auxiliary data groups
-
getAuxiliaryDataFieldNames
Returns the names of the data fields for the given auxiliary data group as aList. These are the plottable fields for that data group. In the typical use case of an auxiliary data group for statistics.- Parameters:
dataGroupName- name of the auxiliary data group- Returns:
- list of names of data fields for the auxiliary data group with the given name,
or
nullif there is no such auxiliary data group
-
isUseDeviceNameInNXdata
Returns whether the name of this device name (as returned bygetName()should be used in the names of the links created withinNXdatagroups to the fields within the nexus object for this instance. If this is not the case, the links to the fields created in theNXdatagroup will have the same name as they do in the nexus object for this instance (i.e. that returned bygetNexusObject().If this method returns an empty
Optionalthen the default behaviour is to use the device name in the names of the links in theNXdatafor this device for the axes device for theNXdatagroup (often these are the devices being scanned, whose nexus object is anNXpositioner), but not for the primary data deviceIf the device name is to be used in the name of the links created then:
- If a single field from this device is added to the
NXdatagroup then that link will simply have the same name as this device. - If multiple fields from this devices are added to an
NXdatagroup then name of the link created within theNXdatagroup will be the name of the device, followed by an underscore, followed by the name of the field within the nexus object for this instance.
- Returns:
- an
OptionalcontainingBoolean.TRUEto use the device name when linking fields in anNXdatagroup,Boolean.FALSEto not use the device name, and an empty optional to use the default behaviour, i.e. use the device name for axis devices only
- If a single field from this device is added to the
-
getPropertyValue
Returns the value of the application defined property of this object with the given name. This allows arbitrary application or implementation specific information to be associated with this object.Note that these properties should not be confused with the fields of the NeXus object returned by
getNexusObject().- Parameters:
propertyName- name of property- Returns:
- the value of the property with the given name, or
nullif no property with the given name is set
-