Package gda.data.metadata
Class GdaMetadata
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.data.metadata.GdaMetadata
- All Implemented Interfaces:
Metadata,Configurable,Findable,gda.observable.IObservable,gda.observable.IObserver
@ServiceInterface(Metadata.class)
public class GdaMetadata
extends FindableConfigurableBase
implements Metadata, gda.observable.IObserver
A concrete implementation of the
Metadata interface. The class stores a list of IMetadataEntry objects
and provides access to those objects and their contents. Metadata can be added programatically or configured via XML.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean__contains__(Object name) Convenience method for checking if a metadata entry is present from Jython.__getitem__(String metaname) Convenience method for getting metadata from Jythonvoid__setitem__(String metaname, String metavalue) Convenience method for setting metadata from JythonvoidaddIObserver(gda.observable.IObserver observer) voidaddMetadataEntry(IMetadataEntry entry) Adds an entry to the metadata list or replaces its contents.voidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.voiddeleteIObserver(gda.observable.IObserver observer) voidFetches all the metadata entries in the list of metadata.getMetadataEntry(String name) Get a metadata entry by namegetMetadataValue(String name) Returns the value of a named metadata entry.getMetadataValue(String metadataName, String fallbackJavaProperty, String defaultValue) Gets the metadata value.voidremoveMetadataEntry(String name) Removes the metadata entry with the specified name.voidsetMetadataEntries(List<IMetadataEntry> entries) Sets the entries within this metadata.voidsetMetadataValue(String name, String metadataValue) Sets the the value of a named metadata entry, for further information on what type of metadata this method can be used for seeIMetadataEntryvoidSet or change the name of the object (as defined in XML).voidMethods inherited from class gda.factory.FindableConfigurableBase
getNameMethods inherited from class gda.factory.ConfigurableBase
isConfigureAtStartup, isConfigured, reconfigure, setConfigured
-
Constructor Details
-
GdaMetadata
public GdaMetadata()Constructor.
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
setMetadataValue
Description copied from interface:MetadataSets the the value of a named metadata entry, for further information on what type of metadata this method can be used for seeIMetadataEntry- Specified by:
setMetadataValuein interfaceMetadata- Parameters:
name- The name for which the metadata value is to be changed.metadataValue- The value required for the metadata entry.- See Also:
-
getMetadataValue
Description copied from interface:MetadataReturns the value of a named metadata entry.- Specified by:
getMetadataValuein interfaceMetadata- Parameters:
name- The name of the required metadata entry.- Returns:
- The value of the required metadata entry.
-
getMetadataValue
public String getMetadataValue(String metadataName, String fallbackJavaProperty, String defaultValue) Description copied from interface:MetadataGets the metadata value.- Specified by:
getMetadataValuein interfaceMetadata- Parameters:
metadataName- The name of the required metadata entry.fallbackJavaProperty- If set the value of this property will be used as a fallback.defaultValue- The default value for the fallback property i.e. it's value if the property is not set.- Returns:
- The metadata value
-
addMetadataEntry
Description copied from interface:MetadataAdds an entry to the metadata list or replaces its contents. If the name of the entry matches one already in the metadata list then the properties of that entry are changed to be the same as those passed in.- Specified by:
addMetadataEntryin interfaceMetadata- Parameters:
entry- MetadataListEntry The entry to be added.
-
getMetadataEntries
Description copied from interface:MetadataFetches all the metadata entries in the list of metadata.- Specified by:
getMetadataEntriesin interfaceMetadata- Returns:
- ArrayList The list of MetadataEntry objects.
-
getMetadataEntry
Description copied from interface:MetadataGet a metadata entry by name- Specified by:
getMetadataEntryin interfaceMetadata- Parameters:
name- name of required entry- Returns:
- metadata entry or
nullif there is no entry with this name
-
setMetadataEntries
Sets the entries within this metadata.- Parameters:
entries- the metadata entries
-
removeMetadataEntry
Removes the metadata entry with the specified name.- Parameters:
name- the metadata entry name
-
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML).- Specified by:
setNamein interfaceFindable- Overrides:
setNamein classFindableConfigurableBase- Parameters:
name- the object name
-
update
- Specified by:
updatein interfacegda.observable.IObserver
-
addIObserver
public void addIObserver(gda.observable.IObserver observer) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver observer) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
__getitem__
Convenience method for getting metadata from Jython>>> metadata['visit'] 'ab1234-5' >>> # is equivalent to >>> metadata.getMetadataValue('visit') 'ab1234-5' >>>NB. this will return an empty string if no matching metadata entry is present- Parameters:
metaname- The name of the metadata to get- See Also:
-
__setitem__
Convenience method for setting metadata from Jython>>> metadata['visit'] = 'ab1234-5' >>> # is equivalent to >>> metadata.setMetadataValue('visit', 'ab1234-5')NB this will not add a new metadata entry if an existing one is not present- Parameters:
metaname- The name of the metadata to setmetavalue- The new value of the metadata entry- See Also:
-
__contains__
Convenience method for checking if a metadata entry is present from Jython.>>> 'visit' in metadata True >>> 'foobar' in metadata False
- Parameters:
name- The metadata entry to check- Returns:
- True if there is a metadata entry present for the given name
-