org.apache.uima.resource.impl
Class ResourceCreationSpecifier_impl

java.lang.Object
  extended by org.apache.uima.resource.metadata.impl.MetaDataObject_impl
      extended by org.apache.uima.resource.impl.ResourceCreationSpecifier_impl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, MetaDataObject, ResourceCreationSpecifier, ResourceSpecifier, XMLizable
Direct Known Subclasses:
AnalysisEngineDescription_impl, CasConsumerDescription_impl, CasInitializerDescription_impl, CollectionReaderDescription_impl, FlowControllerDescription_impl

public class ResourceCreationSpecifier_impl
extends MetaDataObject_impl
implements ResourceCreationSpecifier

Reference implementation of ResourceCreationSpecifier.

See Also:
Serialized Form

Constructor Summary
ResourceCreationSpecifier_impl()
           
 
Method Summary
protected  void checkForDuplicateParameterNames(ConfigurationParameter[] aParams)
          Checks for duplicate parameter names and throws an exception if any are found.
protected  void checkForInvalidParameterOverrides(ConfigurationParameter[] aParams, java.lang.String aGroupName, ResourceManager aResourceManager)
          Checks parameter overrides and throws a ResourceInitializationException if they are invalid.
 void doFullValidation()
          Does full validation of this ResourceCreationSpecifier.
 void doFullValidation(ResourceManager aResourceManager)
          Does full validation of this ResourceCreationSpecifier.
 ExternalResourceDependency[] getExternalResourceDependencies()
          Retrieves descriptions of this ResourceCreationSpecifier's dependencies on external resources.
 ExternalResourceDependency getExternalResourceDependency(java.lang.String aKey)
          Gets the external resource dependency with the given key.
 java.lang.String getFrameworkImplementation()
          Gets the name of the AE framework implementation within which the Resource executes.
 java.lang.String getImplementationName()
          Retrieves the name of this ResourceCreationSpecifier's implementation.
 ResourceMetaData getMetaData()
          Retrieves the ResourceMetaData to assign to the newly constructed ResourceCreationSpecifier.
 ResourceManagerConfiguration getResourceManagerConfiguration()
          Retrieves the Resource Manager configuration, which declares the resources that satisfy the dependencies defined by ResourceCreationSpecifier.getExternalResourceDependencies().
protected  XmlizationInfo getXmlizationInfo()
          To be implemented by subclasses to return information describing how to represent this object in XML.
 void setExternalResourceDependencies(ExternalResourceDependency[] aDependencies)
          Sets the descriptions of this ResourceCreationSpecifier's dependencies on external resources.
 void setFrameworkImplementation(java.lang.String aFrameworkImplementation)
          Sets the name of the AE framework implementation within which the ResourceCreationSpecifier executes.
 void setImplementationName(java.lang.String aImplementationName)
          Sets the name of this ResourceCreationSpecifier's implementation.
 void setMetaData(ResourceMetaData aMetaData)
          Sets the MetaData for this ResourceCreationSpecifier_impl.
 void setResourceManagerConfiguration(ResourceManagerConfiguration aResourceManagerConfiguration)
          Sets the Resource Manager configuration, which declares the resources that satisfy the dependencies defined by ResourceCreationSpecifier.getExternalResourceDependencies().
 void validate()
          Determines if the AnalysisEngineDescription is valid.
 void validate(ResourceManager aResourceManager)
          Checks that this ResourceCreationSpecifier is valid.
protected  void validateConfigurationParameters(ResourceManager aResourceManager)
          Validates configuration parameters within this Resource, and throws an exception if they are not valid.
 
Methods inherited from class org.apache.uima.resource.metadata.impl.MetaDataObject_impl
buildFromXMLElement, 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, buildFromXMLElement, toXML, toXML, toXML, toXML
 

Constructor Detail

ResourceCreationSpecifier_impl

public ResourceCreationSpecifier_impl()
Method Detail

getFrameworkImplementation

public java.lang.String getFrameworkImplementation()
Description copied from interface: ResourceCreationSpecifier
Gets the name of the AE framework implementation within which the Resource executes. The framework name for this implementation is given by Constants.JAVA_FRAMEWORK_NAME..

Specified by:
getFrameworkImplementation in interface ResourceCreationSpecifier
Returns:
the framework implementation name
See Also:
org.apache.uima.collection.processing.CasConsumerDescription#getFrameworkImplementation()

setFrameworkImplementation

public void setFrameworkImplementation(java.lang.String aFrameworkImplementation)
Description copied from interface: ResourceCreationSpecifier
Sets the name of the AE framework implementation within which the ResourceCreationSpecifier executes. The framework name for this implementation is given by Constants.JAVA_FRAMEWORK_NAME..

Specified by:
setFrameworkImplementation in interface ResourceCreationSpecifier
Parameters:
aFrameworkImplementation - the framework implementation name
See Also:
org.apache.uima.collection.processing.CasConsumerDescription#setFrameworkImplementation(java.lang.String)

getImplementationName

public java.lang.String getImplementationName()
Description copied from interface: ResourceCreationSpecifier
Retrieves the name of this ResourceCreationSpecifier's implementation. This must be a fully qualified Java class name.

Specified by:
getImplementationName in interface ResourceCreationSpecifier
Returns:
the implementation name of the CasConsumer
See Also:
org.apache.uima.collection.processing.CasConsumerDescription#getImplementationName()

setImplementationName

public void setImplementationName(java.lang.String aImplementationName)
Description copied from interface: ResourceCreationSpecifier
Sets the name of this ResourceCreationSpecifier's implementation. This must be a fully qualified Java class name.

Specified by:
setImplementationName in interface ResourceCreationSpecifier
Parameters:
aImplementationName - the implementation name of the CasConsumer
See Also:
org.apache.uima.collection.processing.CasConsumerDescription#setImplementationName(java.lang.String)

getMetaData

public ResourceMetaData getMetaData()
Description copied from interface: ResourceCreationSpecifier
Retrieves the ResourceMetaData to assign to the newly constructed ResourceCreationSpecifier.

Specified by:
getMetaData in interface ResourceCreationSpecifier
Returns:
the metadata for the new resource. This will always be modifiable.
See Also:
ResourceCreationSpecifier.getMetaData()

setMetaData

public void setMetaData(ResourceMetaData aMetaData)
Sets the MetaData for this ResourceCreationSpecifier_impl. Users should not do this, so this method is not published through the ResourceCreationSpecifier interface.

Specified by:
setMetaData in interface ResourceCreationSpecifier
Parameters:
aMetaData - metadata to assign

getExternalResourceDependencies

public ExternalResourceDependency[] getExternalResourceDependencies()
Description copied from interface: ResourceCreationSpecifier
Retrieves descriptions of this ResourceCreationSpecifier's dependencies on external resources. Each required external resource is assigned a String identifier. This is the identifier that this ResourceCreationSpecifier can use to locate the Resource (using the AnnotatorContext.getResourceObject(String) method).

Specified by:
getExternalResourceDependencies in interface ResourceCreationSpecifier
Returns:
an array of ExternalResourceDependency objects that describe this AnalysisEngine's resource dependencies.
See Also:
ResourceCreationSpecifier.getExternalResourceDependencies()

setExternalResourceDependencies

public void setExternalResourceDependencies(ExternalResourceDependency[] aDependencies)
Description copied from interface: ResourceCreationSpecifier
Sets the descriptions of this ResourceCreationSpecifier's dependencies on external resources.

Specified by:
setExternalResourceDependencies in interface ResourceCreationSpecifier
Parameters:
aDependencies - an array of ExternalResourceDependency objects that describe this ResourceCreationSpecifier's resource dependencies.
See Also:
ResourceCreationSpecifier.setExternalResourceDependencies(ExternalResourceDependency[])

getExternalResourceDependency

public ExternalResourceDependency getExternalResourceDependency(java.lang.String aKey)
Description copied from interface: ResourceCreationSpecifier
Gets the external resource dependency with the given key.

Specified by:
getExternalResourceDependency in interface ResourceCreationSpecifier
Parameters:
aKey - the key of the external resource dependency to get
Returns:
the resource dependency with the specified key, null if none.
See Also:
ResourceCreationSpecifier.getExternalResourceDependency(java.lang.String)

getResourceManagerConfiguration

public ResourceManagerConfiguration getResourceManagerConfiguration()
Description copied from interface: ResourceCreationSpecifier
Retrieves the Resource Manager configuration, which declares the resources that satisfy the dependencies defined by ResourceCreationSpecifier.getExternalResourceDependencies().

Specified by:
getResourceManagerConfiguration in interface ResourceCreationSpecifier
Returns:
the Resource Manager configuration that describes how external resource dependencies are bound to actual resources.

setResourceManagerConfiguration

public void setResourceManagerConfiguration(ResourceManagerConfiguration aResourceManagerConfiguration)
Description copied from interface: ResourceCreationSpecifier
Sets the Resource Manager configuration, which declares the resources that satisfy the dependencies defined by ResourceCreationSpecifier.getExternalResourceDependencies().

Specified by:
setResourceManagerConfiguration in interface ResourceCreationSpecifier
Parameters:
aResourceManagerConfiguration - the Resource Manager configuration that describes how external resource dependencies are bound to actual resources.

doFullValidation

public void doFullValidation()
                      throws ResourceInitializationException
Description copied from interface: ResourceCreationSpecifier
Does full validation of this ResourceCreationSpecifier. This essentially performs all operations necessary to instantiate a Resource except that it does not actually instantiate the implementation class. If appropriate, this method will also attempt to create a CAS based on the descriptor, in order to do full type system verification. If any operations fail, an exception will be thrown.

Specified by:
doFullValidation in interface ResourceCreationSpecifier
Throws:
ResourceInitializationException - if validation failed

doFullValidation

public void doFullValidation(ResourceManager aResourceManager)
                      throws ResourceInitializationException
Description copied from interface: ResourceCreationSpecifier
Does full validation of this ResourceCreationSpecifier. This essentially performs all operations necessary to instantiate a Resource except that it does not actually instantiate the implementation class. If appropriate, this method will also attempt to create a CAS based on the descriptor, in order to do full type system verification. If any operations fail, an exception will be thrown.

Specified by:
doFullValidation in interface ResourceCreationSpecifier
Parameters:
aResourceManager - a ResourceManager instance to use to load annotator classes, external resource classes, and resolve imports by name.
Throws:
ResourceInitializationException - if validation failed

validate

public final void validate()
                    throws ResourceInitializationException,
                           ResourceConfigurationException
Determines if the AnalysisEngineDescription is valid. An exception is thrown if it is not valid. This should be called from this Analysis Engine's initialize method. Note this does not check configuration parameter settings - that must be done by an explicit call to validateConfigurationParameterSettings.

Specified by:
validate in interface ResourceCreationSpecifier
Parameters:
aDesc - the AnalysisEngineDescripion to validate
Throws:
ResourceInitializationException - if aDesc is invalid
ResourceConfigurationException - if the configuration parameter settings in aDesc are invalid

validate

public void validate(ResourceManager aResourceManager)
              throws ResourceInitializationException,
                     ResourceConfigurationException
Description copied from interface: ResourceCreationSpecifier
Checks that this ResourceCreationSpecifier is valid. An exception is thrown if it is not valid. This only does fairly lightweight checking. To do a more complete but more expensive check, use ResourceCreationSpecifier.doFullValidation().

Specified by:
validate in interface ResourceCreationSpecifier
Parameters:
aResourceManager - a ResourceManager instance to use to resolve imports by name.
Throws:
ResourceInitializationException - if aDesc is invalid
ResourceConfigurationException - if the configuration parameter settings in aDesc are invalid

validateConfigurationParameters

protected void validateConfigurationParameters(ResourceManager aResourceManager)
                                        throws ResourceInitializationException
Validates configuration parameters within this Resource, and throws an exception if they are not valid.

This method checks to make sure that there are no duplicate configuration group names or duplicate parameter names within groups. For aggregates, it also checks that parameter overrides are valid, and logs a warning for parameters with no overrides. (For primitives, there should be no overrides.)

Parameters:
aMetaData - ResourceMetaData object containing parameters to validate
aResourceManger - used to resolve import by name. This is necessary to validate configuration parameter overrides.
Throws:
ResourceInitializationException - if the configuration parameters are invalid

checkForDuplicateParameterNames

protected void checkForDuplicateParameterNames(ConfigurationParameter[] aParams)
                                        throws ResourceInitializationException
Checks for duplicate parameter names and throws an exception if any are found.

Parameters:
aParams - an array of ConfigurationParameters
Throws:
ResourceInitializationException - if there is a duplicate parameter name in the arrays

checkForInvalidParameterOverrides

protected void checkForInvalidParameterOverrides(ConfigurationParameter[] aParams,
                                                 java.lang.String aGroupName,
                                                 ResourceManager aResourceManager)
                                          throws ResourceInitializationException
Checks parameter overrides and throws a ResourceInitializationException if they are invalid. Note that since overrides are invalid in primitive components, this default implementation throws an exception for ANY parameter override it finds. AnalysisEngineDescription_impl overrides this method to correctly handle parameter overrides in aggregates.

Parameters:
aParams - an array of ConfigurationParameters
aGroupName - name of groups in which these parameters are contained. Null if no group
aResourceManger - used to resolve imports by name.
Throws:
ResourceInitializationException - if there is an invalid parameter override declaration

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


Copyright © 2013. All Rights Reserved.