org.apache.uima.resource.metadata.impl
Class ResourceMetaData_impl

java.lang.Object
  extended by org.apache.uima.resource.metadata.impl.MetaDataObject_impl
      extended by org.apache.uima.resource.metadata.impl.ResourceMetaData_impl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, MetaDataObject, ResourceMetaData, XMLizable
Direct Known Subclasses:
AnalysisEngineMetaData_impl

public class ResourceMetaData_impl
extends MetaDataObject_impl
implements ResourceMetaData

Reference implementation of org.apache.uima.resource.ResourceMetaData.

See Also:
Serialized Form

Constructor Summary
ResourceMetaData_impl()
          Creates a new ResourceMetaData_impl.
 
Method Summary
 void buildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)
          Overridden to validate configuration parameter data types immediately after parsing is complete.
protected  java.lang.Class getClassForParameterType(java.lang.String paramType)
          Gets the expected Java class for the given parameter type name.
 ConfigurationParameterDeclarations getConfigurationParameterDeclarations()
          Gets the configuration parameter declarations for this Resource.
 ConfigurationParameterSettings getConfigurationParameterSettings()
          Gets the configuration parameter settings for this Resource.
 java.lang.String getCopyright()
          Gets the copyright notice for this Resource.
 java.lang.String getDescription()
          Gets the description of this Resource.
 java.lang.String getName()
          Gets the name of this Resource.
 java.lang.String getUUID()
          Gets the UUID (Universally Unique Identifier) for this Resource.
 java.lang.String getVendor()
          Gets the vendor of this Resource.
 java.lang.String getVersion()
          Gets the version number of this Resource.
protected  XmlizationInfo getXmlizationInfo()
          To be implemented by subclasses to return information describing how to represent this object in XML.
protected static XmlizationInfo getXmlizationInfoForClass()
          Static method to get XmlizationInfo, used by subclasses to set up their own XmlizationInfo.
 void resolveImports()
          Resolves any import declarations throughout this metadata.
 void resolveImports(ResourceManager aResourceManager)
          Resolves any import declarations throughout this metadata.
 void setConfigurationParameterDeclarations(ConfigurationParameterDeclarations aDeclarations)
          Gets the configuration parameter declarations for this Resource.
 void setConfigurationParameterSettings(ConfigurationParameterSettings aSettings)
          Sets the configuration parameter settings for this Resource.
 void setCopyright(java.lang.String aCopyright)
          Sets the copyright notice for this Resource.
 void setDescription(java.lang.String aDescription)
          Sets the description of this Resource.
 void setName(java.lang.String aName)
          Sets the name of this Resource.
 void setUUID(java.lang.String aUUID)
          Sets the UUID (Universally Unique Identifier) for this Resource.
 void setVendor(java.lang.String aVendor)
          Sets the vendor of this Resource.
 void setVersion(java.lang.String aVersion)
          Sets the version number of this Resource.
protected  void validateConfigurationParameterDataTypeMatch(ConfigurationParameter aParam, NameValuePair aNVP)
          Validate that a value is of an appropriate data type for assignment to the given parameter.
 void validateConfigurationParameterSettings()
          Validates configuration parameter settings within this Resource MetaData, and throws an exception if they are not valid.
protected  void validateConfigurationParameterSettings(NameValuePair[] aNVPs, java.lang.String aGroupName, ConfigurationParameterDeclarations aParamDecls)
          Validates configuration parameter settings within a group.
 
Methods inherited from class org.apache.uima.resource.metadata.impl.MetaDataObject_impl
buildFromXMLElement, clone, equals, getAttributeClass, getAttributeValue, getPropertyDescriptors, getPropertyXmlInfo, getRelativePathBase, getSourceUrl, getSourceUrlString, getWrapperClass, getXMLAttributes, hashCode, isModifiable, listAttributes, readArrayPropertyValueFromXMLElement, readMapPropertyFromXml, readPropertyValueFromXMLElement, readUnknownPropertyValueFromXMLElement, setAttributeValue, setSourceUrl, setSourceUrlIfNull, toString, toXML, toXML, toXML, toXML, writeArrayPropertyAsElement, writeMapPropertyToXml, writePropertyAsElement
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.uima.resource.metadata.MetaDataObject
clone, equals, getAttributeValue, getSourceUrl, getSourceUrlString, isModifiable, listAttributes, setAttributeValue, setSourceUrl
 
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, toXML, toXML, toXML, toXML
 

Constructor Detail

ResourceMetaData_impl

public ResourceMetaData_impl()
Creates a new ResourceMetaData_impl.

Method Detail

resolveImports

public void resolveImports()
                    throws InvalidXMLException
Description copied from interface: ResourceMetaData
Resolves any import declarations throughout this metadata. This base interface cannot contain any interfaces, but subinterfaces may introduce new properties that can have imports that need to be resolved.

Specified by:
resolveImports in interface ResourceMetaData
Throws:
InvalidXMLException - if either the import target does not exist or is invalid

resolveImports

public void resolveImports(ResourceManager aResourceManager)
                    throws InvalidXMLException
Description copied from interface: ResourceMetaData
Resolves any import declarations throughout this metadata. This base interface cannot contain any interfaces, but subinterfaces may introduce new properties that can have imports that need to be resolved.

Specified by:
resolveImports in interface ResourceMetaData
Parameters:
aResourceManager - the Resource Manager used to locate descriptors imported by name. For example, the path in which to locate these descriptors can be set via the ResourceManager.setDataPath(String) method.
Throws:
InvalidXMLException - if either the import target does not exist or is invalid

getUUID

public java.lang.String getUUID()
Description copied from interface: ResourceMetaData
Gets the UUID (Universally Unique Identifier) for this Resource.

Specified by:
getUUID in interface ResourceMetaData
Returns:
the UUID for this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#getUUID()

setUUID

public void setUUID(java.lang.String aUUID)
Description copied from interface: ResourceMetaData
Sets the UUID (Universally Unique Identifier) for this Resource.

Specified by:
setUUID in interface ResourceMetaData
Parameters:
aUUID - the UUID for this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#setUUID(String)

getName

public java.lang.String getName()
Description copied from interface: ResourceMetaData
Gets the name of this Resource.

Specified by:
getName in interface ResourceMetaData
Returns:
the name of this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#getName()

setName

public void setName(java.lang.String aName)
Description copied from interface: ResourceMetaData
Sets the name of this Resource.

Specified by:
setName in interface ResourceMetaData
Parameters:
aName - the name of this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#setName(String)

getVersion

public java.lang.String getVersion()
Description copied from interface: ResourceMetaData
Gets the version number of this Resource.

Specified by:
getVersion in interface ResourceMetaData
Returns:
the version number of this Resource, as a String
See Also:
org.apache.uima.resource.ResourceMetaData#getVersion()

setVersion

public void setVersion(java.lang.String aVersion)
Description copied from interface: ResourceMetaData
Sets the version number of this Resource.

Specified by:
setVersion in interface ResourceMetaData
Parameters:
aVersion - the version number of this Resource, as a String
See Also:
org.apache.uima.resource.ResourceMetaData#setVersion(String)

getDescription

public java.lang.String getDescription()
Description copied from interface: ResourceMetaData
Gets the description of this Resource.

Specified by:
getDescription in interface ResourceMetaData
Returns:
the description of this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#getDescription()

setDescription

public void setDescription(java.lang.String aDescription)
Description copied from interface: ResourceMetaData
Sets the description of this Resource.

Specified by:
setDescription in interface ResourceMetaData
Parameters:
aDescription - the description of this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#setDescription(String)

getVendor

public java.lang.String getVendor()
Description copied from interface: ResourceMetaData
Gets the vendor of this Resource.

Specified by:
getVendor in interface ResourceMetaData
Returns:
the vendor of this Resource, as a String
See Also:
org.apache.uima.resource.ResourceMetaData#getVendor()

setVendor

public void setVendor(java.lang.String aVendor)
Description copied from interface: ResourceMetaData
Sets the vendor of this Resource.

Specified by:
setVendor in interface ResourceMetaData
Parameters:
aVendor - the vendor of this Resource, as a String
See Also:
org.apache.uima.resource.ResourceMetaData#setVendor(String)

getCopyright

public java.lang.String getCopyright()
Description copied from interface: ResourceMetaData
Gets the copyright notice for this Resource.

Specified by:
getCopyright in interface ResourceMetaData
Returns:
the copyright notice for this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#getCopyright()

setCopyright

public void setCopyright(java.lang.String aCopyright)
Description copied from interface: ResourceMetaData
Sets the copyright notice for this Resource.

Specified by:
setCopyright in interface ResourceMetaData
Parameters:
aCopyright - the copyright notice for this Resource
See Also:
org.apache.uima.resource.ResourceMetaData#setCopyright(String)

getConfigurationParameterSettings

public ConfigurationParameterSettings getConfigurationParameterSettings()
Description copied from interface: ResourceMetaData
Gets the configuration parameter settings for this Resource.

Specified by:
getConfigurationParameterSettings in interface ResourceMetaData
Returns:
an object containing the settings for thie Resource's configuration parameters.
See Also:
org.apache.uima.resource.ResourceMetaData#getConfigurationParameterSettings()

setConfigurationParameterSettings

public void setConfigurationParameterSettings(ConfigurationParameterSettings aSettings)
Description copied from interface: ResourceMetaData
Sets the configuration parameter settings for this Resource.

Specified by:
setConfigurationParameterSettings in interface ResourceMetaData
Parameters:
aSettings - an object containing the settings for this Resource's configuration parameters.
See Also:
org.apache.uima.resource.ResourceMetaData#setConfigurationParameterSettings(org.apache.uima.resource.ConfigurationParameterSettings)

getConfigurationParameterDeclarations

public ConfigurationParameterDeclarations getConfigurationParameterDeclarations()
Description copied from interface: ResourceMetaData
Gets the configuration parameter declarations for this Resource.

Specified by:
getConfigurationParameterDeclarations in interface ResourceMetaData
Returns:
an object containig the configuration parameter declarations
See Also:
org.apache.uima.resource.ResourceMetaData#getConfigurationParameterDeclarations()

setConfigurationParameterDeclarations

public void setConfigurationParameterDeclarations(ConfigurationParameterDeclarations aDeclarations)
Description copied from interface: ResourceMetaData
Gets the configuration parameter declarations for this Resource.

Specified by:
setConfigurationParameterDeclarations in interface ResourceMetaData
Parameters:
aDeclarations - an object containig the configuration parameter declarations
See Also:
org.apache.uima.resource.ResourceMetaData#setConfigurationParameterDeclarations(org.apache.uima.resource.ConfigurationParameterDeclarations)

validateConfigurationParameterSettings

public void validateConfigurationParameterSettings()
                                            throws ResourceConfigurationException
Validates configuration parameter settings within this Resource MetaData, and throws an exception if they are not valid.

This method checks to make sure that each configuration parameter setting corresponds to an declared configuration parameter, and that the data types are compatible. It does NOT check that all mandatory parameters have been assigned values - this should be done at resource initialization time and not before.

NOTE: this method can cause a change to the ConfigurationParameterSettings object in the case where the value of a parameter is an empty Object[] and the parameter type is an array of a different type. In this case the empty object array will be replaced by an empty array of the appropriate type.

Specified by:
validateConfigurationParameterSettings in interface ResourceMetaData
Throws:
ResourceConfigurationException - if the configuration parameter settings are invalid
See Also:
ResourceMetaData.validateConfigurationParameterSettings()

validateConfigurationParameterSettings

protected void validateConfigurationParameterSettings(NameValuePair[] aNVPs,
                                                      java.lang.String aGroupName,
                                                      ConfigurationParameterDeclarations aParamDecls)
                                               throws ResourceConfigurationException
Validates configuration parameter settings within a group.

Parameters:
aNVPs - the parameter settings
aGroupName - the group
aParamDecls - Configuration Parameter Declarations
Throws:
ResourceConfigurationException - if the configuration parameter settings are invalid

validateConfigurationParameterDataTypeMatch

protected void validateConfigurationParameterDataTypeMatch(ConfigurationParameter aParam,
                                                           NameValuePair aNVP)
                                                    throws ResourceConfigurationException
Validate that a value is of an appropriate data type for assignment to the given parameter.

NOTE: this method can cause a change to the NameValuePair object in the case where the value of a parameter is an empty Object[] and the parameter type is an array of a different type. In this case the empty object array will be replaced by an empty array of the appropriate type.

Parameters:
aParam - configuration parameter
aNVP - name value pair containing candidate value
Throws:
ResourceConfigurationException - if the data types do not match

getClassForParameterType

protected java.lang.Class getClassForParameterType(java.lang.String paramType)
Gets the expected Java class for the given parameter type name.

Parameters:
paramType - parameter type name from ConfigurationParameterDeclarations
Returns:
expected Java class for parameter values of this type

buildFromXMLElement

public void buildFromXMLElement(org.w3c.dom.Element aElement,
                                XMLParser aParser,
                                XMLParser.ParsingOptions aOptions)
                         throws InvalidXMLException
Overridden to validate configuration parameter data types immediately after parsing is complete.

Specified by:
buildFromXMLElement in interface XMLizable
Overrides:
buildFromXMLElement in class MetaDataObject_impl
Parameters:
aElement - the XML element that represents this object.
aParser - a reference to the UIMA XMLParser. The XMLParser.buildObject(Element) method can be used to construct sub-objects.
aOptions - option settings
Throws:
InvalidXMLException - if the input XML element does not specify a valid object
See Also:
XMLizable.buildFromXMLElement(org.w3c.dom.Element, org.apache.uima.util.XMLParser)

getXmlizationInfo

protected XmlizationInfo getXmlizationInfo()
Description copied from class: MetaDataObject_impl
To be implemented by subclasses to return information describing how to represent this object in XML.

Specified by:
getXmlizationInfo in class MetaDataObject_impl
Returns:
information defining this object's XML representation

getXmlizationInfoForClass

protected static XmlizationInfo getXmlizationInfoForClass()
Static method to get XmlizationInfo, used by subclasses to set up their own XmlizationInfo.



Copyright © 2013. All Rights Reserved.