generated.docs.javadoc.org.eclipse.dawnsci.nexus.builder.impl.DefaultNexusEntryBuilder.html Maven / Gradle / Ivy
DefaultNexusEntryBuilder (h5jan API)
org.eclipse.dawnsci.nexus.builder.impl
Class DefaultNexusEntryBuilder
- java.lang.Object
-
- org.eclipse.dawnsci.nexus.builder.impl.DefaultNexusEntryBuilder
-
- All Implemented Interfaces:
- NexusEntryBuilder
public class DefaultNexusEntryBuilder
extends java.lang.Object
implements NexusEntryBuilder
Default implementation of NexusEntryBuilder
-
-
Constructor Summary
Constructors
Modifier
Constructor and Description
protected
DefaultNexusEntryBuilder(java.lang.String entryName,
NXentry nxEntry)
Creates a new DefaultNexusEntryBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
<N extends NXobject>
N
add(NexusObjectProvider<N> nexusObjectProvider)
Add the nexus object for the given NexusObjectProvider
provider
to this entry.
java.util.List<NXobject>
addAll(java.util.Collection<? extends NexusObjectProvider<?>> nexusObjectProviders)
Adds the nexus objects for the given NexusObjectProvider
s to
this entry.
void
addDefaultGroups()
Adds the default groups for the entry.
protected <N extends NXobject>
void
addGroupToNexusTree(NexusObjectProvider<N> nexusObjectProvider,
N nexusObject)
Adds the new nexus object to the first skeleton class instance that it
can be added to, unless category is specified, in which case it is added to the first
element of that category that it can be added to.
void
addMetadata(NexusMetadataProvider metadataProvider)
Adds the given metadata to this entry.
NexusDataBuilder
createDefaultData()
Creates a new NexusDataBuilder
wrapping a new NXdata
object,
added to this entry with the default name 'data'.
DataNode
getDataNode(java.lang.String relativePath)
Returns the data node with the given path relative to the wrapped NXentryImpl
java.lang.String
getEntryName()
Returns the name of the wrapped NXentry
within the root node
of the nexus file
NXentry
getNXentry()
Returns the wrapped NXentry
object.
void
modifyEntry(java.util.Collection<NexusEntryModification> modifications)
Modifies the entry according to the given modifications.
void
modifyEntry(CustomNexusEntryModification modification)
Performs a custom modification to the wrapped NXentry
.
void
modifyEntry(NexusEntryModification modification)
Modifies the entry according to the given modification.
NexusApplicationBuilder
newApplication(NexusApplicationDefinition applicationDefinition)
Creates a new application wrapping an NXsubentry
object within this entry.
NexusApplicationBuilder
newApplication(java.lang.String subentryName,
NexusApplicationDefinition applicationDefinition)
Creates a new application,
wrapping an NXsubentry
with the given name.
NexusDataBuilder
newData(java.lang.String name)
Creates a new NexusDataBuilder
wrapping a new NXdata
object
added to this entry with the given name.
void
setInstrumentName(java.lang.String instrumentName)
Sets the name of the NXinstrument
object within this entry.
void
validate()
Validate any NXsubentry
s within this entry according to their
application definitions.
-
-
Constructor Detail
-
DefaultNexusEntryBuilder
protected DefaultNexusEntryBuilder(java.lang.String entryName,
NXentry nxEntry)
Creates a new DefaultNexusEntryBuilder
. This constructor should only be called
by DefaultNexusFileBuilder
.
- Parameters:
entryName
- name of entry
nxEntry
- entry to wrap
-
Method Detail
-
add
public <N extends NXobject> N add(NexusObjectProvider<N> nexusObjectProvider)
throws NexusException
Description copied from interface: NexusEntryBuilder
Add the nexus object for the given NexusObjectProvider
provider
to this entry. The nexus object (i.e. group node) returned by the
NexusObjectProvider#createNexusObject(NexusNodeFactory)
is added to the entry at an appropriate location.
For example, the NexusObjectProvider
could provide an NXdetector
which would be added to the NXinstrument
object in the nexus tree.
- Specified by:
add
in interface NexusEntryBuilder
- Parameters:
nexusObjectProvider
- nexus object provider
- Returns:
- the nexus object created by the
NexusObjectProvider
- Throws:
NexusException
- if the nexus object could not be added for any reason
-
getNXentry
public NXentry getNXentry()
Description copied from interface: NexusEntryBuilder
Returns the wrapped NXentry
object.
- Specified by:
getNXentry
in interface NexusEntryBuilder
- Returns:
- wrapped
NXentry
object
-
getEntryName
public java.lang.String getEntryName()
Description copied from interface: NexusEntryBuilder
Returns the name of the wrapped NXentry
within the root node
of the nexus file
- Specified by:
getEntryName
in interface NexusEntryBuilder
- Returns:
- name of entry
-
createDefaultData
public NexusDataBuilder createDefaultData()
Description copied from interface: NexusEntryBuilder
Creates a new NexusDataBuilder
wrapping a new NXdata
object,
added to this entry with the default name 'data'. This is equivalent to
invoking newData("data")
.
- Specified by:
createDefaultData
in interface NexusEntryBuilder
- Returns:
- new
NexusDataBuilder
-
newData
public NexusDataBuilder newData(java.lang.String name)
Description copied from interface: NexusEntryBuilder
Creates a new NexusDataBuilder
wrapping a new NXdata
object
added to this entry with the given name.
- Specified by:
newData
in interface NexusEntryBuilder
- Returns:
- new
NexusDataBuilder
-
newApplication
public NexusApplicationBuilder newApplication(NexusApplicationDefinition applicationDefinition)
throws NexusException
Description copied from interface: NexusEntryBuilder
Creates a new application wrapping an NXsubentry
object within this entry.
- Specified by:
newApplication
in interface NexusEntryBuilder
- Parameters:
applicationDefinition
- application definition enumeration constant
- Returns:
- new
NexusApplicationBuilder
- Throws:
NexusException
- if the application could not be created for any reason
-
newApplication
public NexusApplicationBuilder newApplication(java.lang.String subentryName,
NexusApplicationDefinition applicationDefinition)
throws NexusException
Description copied from interface: NexusEntryBuilder
Creates a new application,
wrapping an NXsubentry
with the given name.
- Specified by:
newApplication
in interface NexusEntryBuilder
applicationDefinition
- application definition enumeration constant
- Returns:
- new
NexusApplicationBuilder
- Throws:
NexusException
- if the application could not be created for any reason
-
addAll
public java.util.List<NXobject> addAll(java.util.Collection<? extends NexusObjectProvider<?>> nexusObjectProviders)
throws NexusException
Description copied from interface: NexusEntryBuilder
Adds the nexus objects for the given NexusObjectProvider
s to
this entry. The nexus objects (i.e. group nodes) returned by the
NexusObjectProvider#createNexusObject(NexusNodeFactory)
is
added to the entry at an appropriate location.
For example, the NexusObjectProvider
could provide an NXdetector
which would be added to the NXinstrument
object in the nexus tree.
- Specified by:
addAll
in interface NexusEntryBuilder
- Returns:
- the nexus objects created by the
NexusObjectProvider
s
- Throws:
NexusException
- if the nexus objects could not be added for any reason
-
modifyEntry
public void modifyEntry(CustomNexusEntryModification modification)
throws NexusException
Description copied from interface: NexusEntryBuilder
Performs a custom modification to the wrapped NXentry
.
- Specified by:
modifyEntry
in interface NexusEntryBuilder
- Parameters:
modification
- custom modification
- Throws:
NexusException
- if the modification could not be performed for any reason
-
addMetadata
public void addMetadata(NexusMetadataProvider metadataProvider)
throws NexusException
Description copied from interface: NexusEntryBuilder
Adds the given metadata to this entry. A field is added to the wrapped
NXentry
(or to a child node of the appropriate type
as returned by NexusMetadataProvider.getCategory()
) for each
metadata entry.
- Specified by:
addMetadata
in interface NexusEntryBuilder
- Parameters:
metadataProvider
- metadata provider
- Throws:
NexusException
- if the metadata could not be added for any reason
-
modifyEntry
public void modifyEntry(NexusEntryModification modification)
throws NexusException
Description copied from interface: NexusEntryBuilder
Modifies the entry according to the given modification.
- Specified by:
modifyEntry
in interface NexusEntryBuilder
- Parameters:
modification
- modification
- Throws:
NexusException
- if the modification could not be performed for any reason
-
modifyEntry
public void modifyEntry(java.util.Collection<NexusEntryModification> modifications)
throws NexusException
Description copied from interface: NexusEntryBuilder
Modifies the entry according to the given modifications.
- Specified by:
modifyEntry
in interface NexusEntryBuilder
- Parameters:
modifications
- modifications
- Throws:
NexusException
- if the modifications could not be performed for any reason
-
setInstrumentName
public void setInstrumentName(java.lang.String instrumentName)
Description copied from interface: NexusEntryBuilder
Sets the name of the NXinstrument
object within this entry.
- Specified by:
setInstrumentName
in interface NexusEntryBuilder
- Parameters:
instrumentName
- instrument name
-
getDataNode
public DataNode getDataNode(java.lang.String relativePath)
throws NexusException
Description copied from interface: NexusEntryBuilder
Returns the data node with the given path relative to the wrapped NXentryImpl
- Specified by:
getDataNode
in interface NexusEntryBuilder
- Returns:
- data node the data node at the given relative path
- Throws:
NexusException
- if no such node exists, or the node at the given relative
path is a data node
-
addDefaultGroups
public void addDefaultGroups()
Adds the default groups for the entry. Subclasses may override as appropriate.
- Specified by:
addDefaultGroups
in interface NexusEntryBuilder
-
validate
public void validate()
throws NexusValidationException
Description copied from interface: NexusEntryBuilder
Validate any NXsubentry
s within this entry according to their
application definitions.
- Specified by:
validate
in interface NexusEntryBuilder
- Throws:
NexusValidationException
- if the entry is invalid
-
addGroupToNexusTree
protected <N extends NXobject> void addGroupToNexusTree(NexusObjectProvider<N> nexusObjectProvider,
N nexusObject)
throws NexusException
Adds the new nexus object to the first skeleton class instance that it
can be added to, unless category is specified, in which case it is added to the first
element of that category that it can be added to.
A special case is where the nexus object is of base class NexusBaseClass.NX_SAMPLE
,
in which case this replaces the existing NXsample base class in the nexus tree.
- Parameters:
nexusObjectProvider
-
nexusObject
-
- Throws:
NexusException