org.apache.uima.analysis_engine.impl
Class AnalysisEngineDescription_impl

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

public class AnalysisEngineDescription_impl
extends ResourceCreationSpecifier_impl
implements AnalysisEngineDescription

Reference implementation of AnalysisEngineDescription. Note that this class contains two attributes of class Map, which are not supported by the default XML input/output routines. Therefore we override the #writeAttributeAsElement(String,Class,Object,Writer) and #readAttributeFromXMLElement(String,Class,Element,XMLParser) methods.

See Also:
Serialized Form

Field Summary
protected  java.lang.String ELEM_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS
          Name of the "delegateAnalysisEngineSpecifiers" XML Element.
protected  java.lang.String PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS
          Name of the "delegateAnalysisEngineSpecifiers" property.
protected  java.lang.String PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS_WITH_IMPORTS
          Name of the "delegateAnalysisEngineSpecifiersWithImports" property.
 
Constructor Summary
AnalysisEngineDescription_impl()
          Creates a new AnalysisEngineDescription_impl.
 
Method Summary
 void buildFromXMLElement(org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)
          Overridden to set default operational properties if they are not specified in descriptor.
protected  boolean capabilitiesContainSofa(java.lang.String aSofaName, boolean aOutput)
           
protected  void checkForInvalidParameterOverrides(ConfigurationParameter[] aParams, java.lang.String aGroupName, ResourceManager aResourceManager)
          Overrides{@link ResourceCreationSpecifier_impl#checkForInvalidParameterOverrides(ConfigurationParameter[], String) to validate parameter overrides in an aggregate AE.
 void doFullValidation()
          Does full validation of this ResourceCreationSpecifier.
 void doFullValidation(ResourceManager aResourceManager)
          Does full validation of this ResourceCreationSpecifier.
 java.util.Map<java.lang.String,ResourceSpecifier> getAllComponentSpecifiers(ResourceManager aResourceManager)
          For an aggregate AnalysisEngine only, gets the ResourceSpecifiers of all components in this aggregate.
 AnalysisEngineMetaData getAnalysisEngineMetaData()
          Retrieves the metadata that describes the AnalysisEngine.
 java.lang.String getAnnotatorImplementationName()
          For a primitive AnalysisEngine only, retrieves the name of the annotator implementation.
 ResourceSpecifier getComponentSpecifier(java.lang.String key)
          Gets the ResourceSpecifier of one a component of this aggregate, based on its key.
 java.util.Map<java.lang.String,ResourceSpecifier> getDelegateAnalysisEngineSpecifiers()
          For an aggregate AnalysisEngine only, retrieves a collection of ResourceSpecifiers that indicate which delegate AnalysisEngines comprise the aggregate.
 java.util.Map<java.lang.String,ResourceSpecifier> getDelegateAnalysisEngineSpecifiers(ResourceManager aResourceManager)
          For an aggregate AnalysisEngine only, retrieves a collection of ResourceSpecifiers that indicate which delegate AnalysisEngines comprise the aggregate.
 java.util.Map<java.lang.String,MetaDataObject> getDelegateAnalysisEngineSpecifiersWithImports()
          Retrieves a Map whose keys are string identifiers and whose values are the either Import or ResourceSpecifier objects.
 FlowControllerDeclaration getFlowControllerDeclaration()
          For an aggregate AnalysisEngine only, gets the declaration of which FlowController should be used by the AnalysisEngine.
 java.lang.String getFrameworkImplementation()
          Gets the name of the AE framework implementation within which the Resource executes.
 SofaMapping[] getSofaMappings()
          Reserved for future use.
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.
 boolean isPrimitive()
          Retrieves whether the AnalysisEngine is primitive (consisting of one annotator), as opposed to aggregate (containing multiple delegate AnalysisEngines).
 java.util.List<NameClassPair> listAttributes()
          Overridden to add Delegate AE Specifiers to the result list.
protected  void readPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo, org.w3c.dom.Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)
          Overridden to handle XML import of the DelegateAnalysisEngineSpecifiers attribute.
protected  void resolveDelegateAnalysisEngineImports(java.util.Collection<java.lang.String> aEnclosingAggregateAeUrls, ResourceManager aResourceManager, boolean aRecursive)
          Resolves imports of delegate Analysis Engines.
protected  void resolveDelegateAnalysisEngineImports(ResourceManager aResourceManager, boolean aRecursive)
          Resolves imports of delegate Analysis Engines.
 void resolveImports(java.util.Collection<java.lang.String> aAlreadyImportedDelegateAeUrls, ResourceManager aResourceManager)
          Resolves all import declarations in this AnalysisEngineDescription.
 void resolveImports(ResourceManager aResourceManager)
          Resolves all import declarations in this AnalysisEngineDescription.
 void setAnnotatorImplementationName(java.lang.String aImplementationName)
          For a primitive AnalysisEngine only, sets the name of the annotator implementation.
 void setFlowControllerDeclaration(FlowControllerDeclaration aFlowControllerDeclaration)
          For an aggregate AnalysisEngine only, sets the declaration of which FlowController should be used by the AnalysisEngine.
 void setFrameworkImplementation(java.lang.String aFrameworkImplementation)
          Sets the name of the AE framework implementation within which the ResourceCreationSpecifier executes.
 void setPrimitive(boolean aPrimitive)
          Sets whether the AnalysisEngine is primitive (consisting of one annotator), as opposed to aggregate (containing multiple delegate AnalysisEngines).
 void setSofaMappings(SofaMapping[] aSofaMappings)
          Reserved for future use.
 void toXML(org.xml.sax.ContentHandler aContentHandler, boolean aWriteDefaultNamespaceAttribute, boolean aPreserveDelegateAnalysisEngineImports)
          Writes this object's XML representation by making calls on a SAX ContentHandler.
 void toXML(java.io.OutputStream aOutputStream, boolean aPreserveDelegateAnalysisEngineImports)
          Writes this object's XML representation as a string in UTF-8 encoding.
 void toXML(java.io.Writer aWriter, boolean aPreserveDelegateAnalysisEngineImports)
          Writes this object's XML representation as a string.
 void validate(ResourceManager aResourceManager)
          Determines if the AnalysisEngineDescription is valid.
protected  void validateSofaMappings()
          Validate SofA mappings and inputs/outputs for an aggregate AE.
protected  void writePropertyAsElement(PropertyXmlInfo aPropInfo, java.lang.String aNamespace, org.xml.sax.ContentHandler aContentHandler)
          Overridden to handle XML export of the DelegateAnalysisEngineSpecifiers attribute.
 
Methods inherited from class org.apache.uima.resource.impl.ResourceCreationSpecifier_impl
checkForDuplicateParameterNames, getExternalResourceDependencies, getExternalResourceDependency, getImplementationName, getMetaData, getResourceManagerConfiguration, setExternalResourceDependencies, setImplementationName, setMetaData, setResourceManagerConfiguration, validate, validateConfigurationParameters
 
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, readArrayPropertyValueFromXMLElement, readMapPropertyFromXml, readUnknownPropertyValueFromXMLElement, setAttributeValue, setSourceUrl, setSourceUrlIfNull, toString, toXML, toXML, toXML, toXML, writeArrayPropertyAsElement, writeMapPropertyToXml
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.uima.resource.ResourceCreationSpecifier
getExternalResourceDependencies, getExternalResourceDependency, getImplementationName, getMetaData, getResourceManagerConfiguration, setExternalResourceDependencies, setImplementationName, setMetaData, setResourceManagerConfiguration, validate
 
Methods inherited from interface org.apache.uima.resource.metadata.MetaDataObject
clone, equals, getAttributeValue, getSourceUrl, getSourceUrlString, isModifiable, setAttributeValue, setSourceUrl
 
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, toXML, toXML, toXML, toXML
 

Field Detail

PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS

protected java.lang.String PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS
Name of the "delegateAnalysisEngineSpecifiers" property. Change this if interface changes.


PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS_WITH_IMPORTS

protected java.lang.String PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS_WITH_IMPORTS
Name of the "delegateAnalysisEngineSpecifiersWithImports" property. Change this if interface changes.


ELEM_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS

protected java.lang.String ELEM_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS
Name of the "delegateAnalysisEngineSpecifiers" XML Element. Change this if schema changes.

Constructor Detail

AnalysisEngineDescription_impl

public AnalysisEngineDescription_impl()
Creates a new AnalysisEngineDescription_impl. Initializes the MetaData, DelegateAnalysisEngineSpecifiers, and ExternalResourcesRequired attributes.

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 AnalysisEngineDescription
Specified by:
getFrameworkImplementation in interface ResourceCreationSpecifier
Overrides:
getFrameworkImplementation in class ResourceCreationSpecifier_impl
Returns:
the framework implementation name
See Also:
AnalysisEngineDescription.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 AnalysisEngineDescription
Specified by:
setFrameworkImplementation in interface ResourceCreationSpecifier
Overrides:
setFrameworkImplementation in class ResourceCreationSpecifier_impl
Parameters:
aFrameworkImplementation - the framework implementation name
See Also:
AnalysisEngineDescription.setFrameworkImplementation(java.lang.String)

isPrimitive

public boolean isPrimitive()
Description copied from interface: AnalysisEngineDescription
Retrieves whether the AnalysisEngine is primitive (consisting of one annotator), as opposed to aggregate (containing multiple delegate AnalysisEngines).

Some of the methods on this class apply only to one type of AnalysisEngine:
AnalysisEngineDescription.getAnnotatorImplementationName() - primitive AnalysisEngine only
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers() - aggregate AnalysisEngine only
AnalysisEngineDescription.getFlowControllerDeclaration() - aggregate AnalysisEngine only

Specified by:
isPrimitive in interface AnalysisEngineDescription
Returns:
true if and only if the AnalysisEngine is primitive
See Also:
AnalysisEngineDescription.isPrimitive()

setPrimitive

public void setPrimitive(boolean aPrimitive)
Description copied from interface: AnalysisEngineDescription
Sets whether the AnalysisEngine is primitive (consisting of one annotator), as opposed to aggregate (containing multiple delegate AnalysisEngines).

Specified by:
setPrimitive in interface AnalysisEngineDescription
Parameters:
aPrimitive - true if and only if the AnalysisEngine is primitive
See Also:
AnalysisEngineDescription.setPrimitive(boolean)

getAnnotatorImplementationName

public java.lang.String getAnnotatorImplementationName()
Description copied from interface: AnalysisEngineDescription
For a primitive AnalysisEngine only, retrieves the name of the annotator implementation. For Java annotators, this will be a fully qualified Java class name.

Specified by:
getAnnotatorImplementationName in interface AnalysisEngineDescription
Returns:
the implementation name of the annotator. If the AnalysisEngine is aggregate, always returns null.
See Also:
AnalysisEngineDescription.getAnnotatorImplementationName()

setAnnotatorImplementationName

public void setAnnotatorImplementationName(java.lang.String aImplementationName)
Description copied from interface: AnalysisEngineDescription
For a primitive AnalysisEngine only, sets the name of the annotator implementation. For Java annotators, this must be a fully qualified Java class name.

Specified by:
setAnnotatorImplementationName in interface AnalysisEngineDescription
Parameters:
aImplementationName - the implementation name of the annotator.
See Also:
AnalysisEngineDescription.setAnnotatorImplementationName(String)

getDelegateAnalysisEngineSpecifiers

public java.util.Map<java.lang.String,ResourceSpecifier> getDelegateAnalysisEngineSpecifiers()
                                                                                      throws InvalidXMLException
Description copied from interface: AnalysisEngineDescription
For an aggregate AnalysisEngine only, retrieves a collection of ResourceSpecifiers that indicate which delegate AnalysisEngines comprise the aggregate. Each ResourceSpecifier can either:
  1. completely describe how to build a AnalysisEngine instance
  2. describe how to locate a distributed AnalysisEngine service, for example a specific endpoint or a JNDI name

This method returns an unmodifiable Map whose keys are string identifiers and whose values are the ResourceSpecifier objects. The string identifiers in this Map are to refer to the delegate AnalysisEngines from elsewhere in this AnalysisEngineDescription. (For example in the FlowConstraints description.)

Note that the Map returned by this method will never contain Import objects -- they will always be resolved first. If you want to get access to the original Import objects, use AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiersWithImports(). Also use that method if you want to be able to make changes to the Map.

Specified by:
getDelegateAnalysisEngineSpecifiers in interface AnalysisEngineDescription
Returns:
an unmodifiable Map with String keys and ResourceSpecifier values.
Throws:
InvalidXMLException - if import resolution failed
See Also:
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers()

getDelegateAnalysisEngineSpecifiers

public java.util.Map<java.lang.String,ResourceSpecifier> getDelegateAnalysisEngineSpecifiers(ResourceManager aResourceManager)
                                                                                      throws InvalidXMLException
Description copied from interface: AnalysisEngineDescription
For an aggregate AnalysisEngine only, retrieves a collection of ResourceSpecifiers that indicate which delegate AnalysisEngines comprise the aggregate. Each ResourceSpecifier can either:
  1. completely describe how to build a AnalysisEngine instance
  2. describe how to locate a distributed AnalysisEngine service, for example a specific endpoint or a JNDI name

This method returns an unmodifiable Map whose keys are string identifiers and whose values are the ResourceSpecifier objects. The string identifiers in this Map are to refer to the delegate AnalysisEngines from elsewhere in this AnalysisEngineDescription. (For example in the FlowConstraints description.)

Note that the Map returned by this method will never contain Import objects -- they will always be resolved first. If you want to get access to the original Import objects, use AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiersWithImports(). Also use that method if you want to be able to make changes to the Map.

Specified by:
getDelegateAnalysisEngineSpecifiers in interface AnalysisEngineDescription
Parameters:
aResourceManager - the ResourceManager to use to get the datapath needed to resolve imports
Returns:
an unmodifiable Map with String keys and ResourceSpecifier values.
Throws:
InvalidXMLException - if import resolution failed
See Also:
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers()

getDelegateAnalysisEngineSpecifiersWithImports

public java.util.Map<java.lang.String,MetaDataObject> getDelegateAnalysisEngineSpecifiersWithImports()
Description copied from interface: AnalysisEngineDescription
Retrieves a Map whose keys are string identifiers and whose values are the either Import or ResourceSpecifier objects. These indicate the delegate AnalysisEngines that comprise the aggregate.

This is a direct representation of what is in the XML syntax for the descriptor. That is, if the XML had an <import> element, the Map will contain an Import object. If you do not want to deal with imports, use the AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiers() method instead.

Specified by:
getDelegateAnalysisEngineSpecifiersWithImports in interface AnalysisEngineDescription
Returns:
a Map with String keys and ResourceSpecifier or Import objects as values. This Map may be modified to add or remove imports or specifiers.
See Also:
AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiersWithImports()

getFlowControllerDeclaration

public FlowControllerDeclaration getFlowControllerDeclaration()
Description copied from interface: AnalysisEngineDescription
For an aggregate AnalysisEngine only, gets the declaration of which FlowController should be used by the AnalysisEngine.

Specified by:
getFlowControllerDeclaration in interface AnalysisEngineDescription
Returns:
an object containing either an import of a ResourceSpecifier or a ResourceSpecifier itself. This specifier will be used to create the FlowController.

setFlowControllerDeclaration

public void setFlowControllerDeclaration(FlowControllerDeclaration aFlowControllerDeclaration)
Description copied from interface: AnalysisEngineDescription
For an aggregate AnalysisEngine only, sets the declaration of which FlowController should be used by the AnalysisEngine.

Specified by:
setFlowControllerDeclaration in interface AnalysisEngineDescription
Parameters:
aFlowControllerDeclaration - an object containing either an import of a ResourceSpecifier or a ResourceSpecifier itself. This specifier will be used to create the FlowController.

getAllComponentSpecifiers

public java.util.Map<java.lang.String,ResourceSpecifier> getAllComponentSpecifiers(ResourceManager aResourceManager)
                                                                            throws InvalidXMLException
Description copied from interface: AnalysisEngineDescription
For an aggregate AnalysisEngine only, gets the ResourceSpecifiers of all components in this aggregate. This includes the FlowController as well as all of the component AnalysisEngines.

This method returns an unmodifiable Map whose keys are string identifiers and whose values are the ResourceSpecifier objects. The string identifiers in this Map are to refer to the components from elsewhere in this aggregate descriptor, for example in configuration parameter overrides and resource bindings.

Note that the Map returned by this method will never contain Import objects -- they will always be resolved first. If you want to get access to the original Import objects, use AnalysisEngineDescription.getDelegateAnalysisEngineSpecifiersWithImports() and AnalysisEngineDescription.getFlowControllerDeclaration(). Also use those methods if you want to make changes to be able to make changes to the Map.

Specified by:
getAllComponentSpecifiers in interface AnalysisEngineDescription
Parameters:
aResourceManager - the ResourceManager from which to get the datapath needed to resolve imports. Pass null to use the default ResourceManager.
Returns:
an unmodifiable Map with String keys and ResourceSpecifier values.
Throws:
InvalidXMLException - if import resolution failed

getAnalysisEngineMetaData

public AnalysisEngineMetaData getAnalysisEngineMetaData()
Description copied from interface: AnalysisEngineDescription
Retrieves the metadata that describes the AnalysisEngine. This includes the AnalysisEngine's capabilties, the TypeSystem that is uses, the specified Flow information for an aggregate AnalysisEngine, and various informational attributes such as name, description, version, vendor, and copyright.

Specified by:
getAnalysisEngineMetaData in interface AnalysisEngineDescription
Returns:
the AnalysisEngineMetaData object containing the AnalysisEngine's metadata. This object can be modified.
See Also:
AnalysisEngineDescription.getAnalysisEngineMetaData()

getSofaMappings

public SofaMapping[] getSofaMappings()
Description copied from interface: AnalysisEngineDescription
Reserved for future use.

Specified by:
getSofaMappings in interface AnalysisEngineDescription

setSofaMappings

public void setSofaMappings(SofaMapping[] aSofaMappings)
Description copied from interface: AnalysisEngineDescription
Reserved for future use.

Specified by:
setSofaMappings in interface AnalysisEngineDescription

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 AnalysisEngineDescription
Specified by:
doFullValidation in interface ResourceCreationSpecifier
Overrides:
doFullValidation in class ResourceCreationSpecifier_impl
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 AnalysisEngineDescription
Specified by:
doFullValidation in interface ResourceCreationSpecifier
Overrides:
doFullValidation in class ResourceCreationSpecifier_impl
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 void validate(ResourceManager aResourceManager)
              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
Overrides:
validate in class ResourceCreationSpecifier_impl
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

checkForInvalidParameterOverrides

protected void checkForInvalidParameterOverrides(ConfigurationParameter[] aParams,
                                                 java.lang.String aGroupName,
                                                 ResourceManager aResourceManager)
                                          throws ResourceInitializationException
Overrides{@link ResourceCreationSpecifier_impl#checkForInvalidParameterOverrides(ConfigurationParameter[], String) to validate parameter overrides in an aggregate AE. Also logs a warning for aggregate parameters with no declared overrides.

Overrides:
checkForInvalidParameterOverrides in class ResourceCreationSpecifier_impl
Parameters:
aParams - an array of ConfigurationParameters
aGroupName - name of groups in which these parameters are contained. Null if no group
aResourceManager - a ResourceManager instance to use to resolve imports by name.
Throws:
ResourceInitializationException - if there is an invalid parameter override declaration

getComponentSpecifier

public ResourceSpecifier getComponentSpecifier(java.lang.String key)
                                        throws ResourceInitializationException
Gets the ResourceSpecifier of one a component of this aggregate, based on its key. This may be the specifier of a component (i.e. delegate) AnalysisEngine, or it may be the specifier of the FlowController.

Specified by:
getComponentSpecifier in interface AnalysisEngineDescription
Parameters:
key - the key of the component specifier to get
Returns:
the specifier for the component, null if there is no component with the given key
Throws:
ResourceInitializationException - if there's a problem resolving imports

validateSofaMappings

protected void validateSofaMappings()
                             throws ResourceInitializationException
Validate SofA mappings and inputs/outputs for an aggregate AE.

Parameters:
aDesc -
Throws:
ResourceInitializationException

capabilitiesContainSofa

protected boolean capabilitiesContainSofa(java.lang.String aSofaName,
                                          boolean aOutput)

listAttributes

public java.util.List<NameClassPair> listAttributes()
Overridden to add Delegate AE Specifiers to the result list. Default introspection implementation won't return it because it has no set method. We've also overridden the XML import/export methods, though, so that set methods are not required.

Specified by:
listAttributes in interface MetaDataObject
Overrides:
listAttributes in class MetaDataObject_impl
Returns:
a List containing NameClassPair objects, each of which contains the name of a parameter and the Class of its value. For primitive types, the wrapper classes will be returned (e.g. java.lang.Integer instead of int).
See Also:
org.apache.uima.resource.MetaDataObject#listAttributes()

toXML

public void toXML(java.io.OutputStream aOutputStream,
                  boolean aPreserveDelegateAnalysisEngineImports)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Description copied from interface: AnalysisEngineDescription
Writes this object's XML representation as a string in UTF-8 encoding.

Specified by:
toXML in interface AnalysisEngineDescription
Parameters:
aOutputStream - an OutputStream to which the XML string will be written, in UTF-8 encoding.
aPreserveDelegateAnalysisEngineImports - if true, XML serialization will always preserve <import> elements used to import delegate analysis engine specifiers into an aggregate. If false, the default import serialization behavior applies, which is to write <import> elements only in the case where they have not previously been resolved.
Throws:
java.io.IOException - if an I/O failure occurs
org.xml.sax.SAXException

toXML

public void toXML(java.io.Writer aWriter,
                  boolean aPreserveDelegateAnalysisEngineImports)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Description copied from interface: AnalysisEngineDescription
Writes this object's XML representation as a string. Note that if you want to write the XML to a file, it is highly recommended that you use XMLizable.toXML(OutputStream) instead, as it ensures that output is written in UTF-8 encoding, which is the default encoding that should be used for XML files.

Specified by:
toXML in interface AnalysisEngineDescription
Parameters:
aWriter - a Writer to which the XML string will be written
aPreserveDelegateAnalysisEngineImports - if true, XML serialization will always preserve <import> elements used to import delegate analysis engine specifiers into an aggregate. If false, the default import serialization behavior applies, which is to write <import> elements only in the case where they have not previously been resolved.
Throws:
java.io.IOException - if an I/O failure occurs
org.xml.sax.SAXException

toXML

public void toXML(org.xml.sax.ContentHandler aContentHandler,
                  boolean aWriteDefaultNamespaceAttribute,
                  boolean aPreserveDelegateAnalysisEngineImports)
           throws org.xml.sax.SAXException
Description copied from interface: AnalysisEngineDescription
Writes this object's XML representation by making calls on a SAX ContentHandler.

Specified by:
toXML in interface AnalysisEngineDescription
Parameters:
aContentHandler - the content handler to which this object will write events that describe its XML representation.
aWriteDefaultNamespaceAttribute - whether the namespace of this element should be written as the default namespace. This should be done only for the root element, and it defaults to false.
aPreserveDelegateAnalysisEngineImports - if true, XML serialization will always preserve <import> elements used to import delegate analysis engine specifiers into an aggregate. If false, the default import serialization behavior applies, which is to write <import> elements only in the case where they have not previously been resolved.
Throws:
org.xml.sax.SAXException

resolveImports

public void resolveImports(ResourceManager aResourceManager)
                    throws InvalidXMLException
Description copied from interface: AnalysisEngineDescription
Resolves all import declarations in this AnalysisEngineDescription. For an aggregate, this is recursive, also resolving all imports in each delegate AnalysisEngine. Users do not typically need to call this method; it is called automatically when UIMAFramework.produceAnalysisEngine(ResourceSpecifier) is called.

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

resolveImports

public void resolveImports(java.util.Collection<java.lang.String> aAlreadyImportedDelegateAeUrls,
                           ResourceManager aResourceManager)
                    throws InvalidXMLException
Description copied from interface: AnalysisEngineDescription
Resolves all import declarations in this AnalysisEngineDescription. For an aggregate, this is recursive, also resolving all imports in each delegate AnalysisEngine. Users do not typically need to call this method; it is called automatically when UIMAFramework.produceAnalysisEngine(ResourceSpecifier) is called.

This version is used internally to resolve nested imports.

Specified by:
resolveImports in interface AnalysisEngineDescription
Parameters:
aAlreadyImportedDelegateAeUrls - URLs of already imported AE descriptors, so we don't import them again.
aResourceManager - the Resource Manager used to locate imports by name. For example, the path in which to locate these imported descriptors can be set via the ResourceManager.setDataPath(String) method.
Throws:
InvalidXMLException - if an import target does not exist or is invalid

resolveDelegateAnalysisEngineImports

protected void resolveDelegateAnalysisEngineImports(ResourceManager aResourceManager,
                                                    boolean aRecursive)
                                             throws InvalidXMLException
Resolves imports of delegate Analysis Engines. This reads from the delegateAnalysisEngineSpecifiersWithImports map and populates the delegateAnalysisEngineSpecifiers map.

Parameters:
aRecursive - If true, this method will call resolveImports(Collection, ResourceManager) on each delegate. If a cirular import is found, an exception will be thrown.
Throws:
InvalidXMLException

resolveDelegateAnalysisEngineImports

protected void resolveDelegateAnalysisEngineImports(java.util.Collection<java.lang.String> aEnclosingAggregateAeUrls,
                                                    ResourceManager aResourceManager,
                                                    boolean aRecursive)
                                             throws InvalidXMLException
Resolves imports of delegate Analysis Engines. This reads from the delegateAnalysisEngineSpecifiersWithImports map and populates the delegateAnalysisEngineSpecifiers map.

Parameters:
aEnclosingAggregateAeUrls - URLs of enclosing aggregate AEs. Used to detect circular imports.
aRecursive - If true, this method will call resolveImports(Collection, ResourceManager) on each delegate. If a circular import is found, an exception will be thrown.
Throws:
InvalidXMLException

writePropertyAsElement

protected void writePropertyAsElement(PropertyXmlInfo aPropInfo,
                                      java.lang.String aNamespace,
                                      org.xml.sax.ContentHandler aContentHandler)
                               throws org.xml.sax.SAXException
Overridden to handle XML export of the DelegateAnalysisEngineSpecifiers attribute. This attribute has a value of type Map, which is not handled by the default XML export logic.

Overrides:
writePropertyAsElement in class MetaDataObject_impl
Parameters:
aPropInfo - information on how to represent the property in XML
aNamespace - XML namespace URI for this object
aContentHandler - content handler to which this object will send events that describe its XML representation
Throws:
org.xml.sax.SAXException
See Also:
org.apache.uima.MetaDataObject_impl#writePropertyAsElement(PropertyXmlInfo,String,ContentHandler)

readPropertyValueFromXMLElement

protected void readPropertyValueFromXMLElement(PropertyXmlInfo aPropXmlInfo,
                                               org.w3c.dom.Element aElement,
                                               XMLParser aParser,
                                               XMLParser.ParsingOptions aOptions)
                                        throws InvalidXMLException
Overridden to handle XML import of the DelegateAnalysisEngineSpecifiers attribute. This attribute has a value of type Map, which is not handled by the default XML import logic.

Overrides:
readPropertyValueFromXMLElement in class MetaDataObject_impl
Parameters:
aPropXmlInfo - information about the property to read
aElement - DOM element to read from
aParser - parser to use to construct complex values
aOptions - option settings
Throws:
InvalidXMLException
See Also:
org.apache.uima.resource.impl.MetaDataObject_impl#readPropertyValueFromXMLElement(org.apache.uima.resource.impl.PropertyXmlInfo, org.w3c.dom.Element, org.apache.uima.util.XMLParser)

buildFromXMLElement

public void buildFromXMLElement(org.w3c.dom.Element aElement,
                                XMLParser aParser,
                                XMLParser.ParsingOptions aOptions)
                         throws InvalidXMLException
Overridden to set default operational properties if they are not specified in descriptor.

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

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.

Overrides:
getXmlizationInfo in class ResourceCreationSpecifier_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.