public class LeoAEDescriptor extends Object implements LeoDelegate
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUMBER_INSTANCES
Default number of replication instances for this AnalysisEngine.
|
protected boolean |
deleteOnExit
If TRUE then delete the generated descriptor file once the program exits, defaults to TRUE.
|
static org.apache.log4j.Logger |
LOG
Logging object of output.
|
protected org.apache.uima.analysis_engine.AnalysisEngineDescription |
mAEDescriptor
AnalysisEngineDescription reference object.
|
protected ArrayList<String> |
mDelegateNames
Names of the delegate engines for aggregates only.
|
protected ArrayList<LeoDelegate> |
mDelegates
Delegate AnalysisEngineDescriptors for aggregates only.
|
protected URI |
mDescriptorLocator
The locator for this descriptor.
|
protected org.apache.uima.analysis_engine.metadata.FlowConstraints |
mFlowConstraints
Flow constraints for aggregates not using a fixed flow.
|
protected boolean |
mIsAsync
For an aggregate engine deployment will this aggregate be executed asynchronously,
if false (default) then the engine will be executed and scaled as a unit,
if true then the delegate engines will each be scaled individually.
|
protected int |
mNumberOfInstances
The number of instances of this Engine to execute in parellel on the service.
|
Constructor and Description |
---|
LeoAEDescriptor()
Default constructor.
|
LeoAEDescriptor(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
Use an existing AnalysisEngineDescription object to create a new LeoAEDescriptor.
|
LeoAEDescriptor(List<LeoAEDescriptor> primitives)
Create a new LeoAEDescriptor object that represents an aggregate from a list of
LeoAEDescriptor primitives.
|
LeoAEDescriptor(String descriptor,
boolean byName,
NameValue... paramValues)
Create a new description object from the descriptor file provided.
|
LeoAEDescriptor(String name,
String implementation_class)
Constructor that creates a blank AnalysisEngineDescriptor object with the name provided.
|
Modifier and Type | Method and Description |
---|---|
LeoAEDescriptor |
addCapability(org.apache.uima.resource.metadata.Capability c)
Adds either outputs or inputs for the specified capability to this ResultSpecification.
|
LeoAEDescriptor |
addConfigurationParameter(org.apache.uima.resource.metadata.ConfigurationParameter aConfigurationParameter)
Adds a configuration parameter to the metadata for this AnalysisEngineDescriptor.
|
LeoAEDescriptor |
addDelegate(LeoDelegate delegate)
Add the provided LeoAEDescriptor as a delegate to this AnalysisEngine.
|
LeoAEDescriptor |
addDelegate(String descriptor,
boolean byName,
NameValue... paramValues)
Add a delegate analysis engine descriptor to this engine using the descriptor provided.
|
LeoAEDescriptor |
addParameterSetting(String paramName,
boolean isMandatory,
boolean isMultiValued,
String paramType)
Add a new parameter.
|
LeoAEDescriptor |
addParameterSetting(String paramName,
boolean isMandatory,
boolean isMultiValued,
String paramType,
Object initValue)
Add a new parameter and optionally set an initial value.
|
LeoAEDescriptor |
addResourceConfiguration(org.apache.uima.resource.metadata.ResourceManagerConfiguration rmc)
Add the external resources specified by the provided ResourceManagerConfiguration object.
|
LeoAEDescriptor |
addType(String aTypeName,
String aTypeDescription,
String aSuperTypeName)
Add a new type to the TypeSystem with the Name and SuperType name provided.
|
LeoAEDescriptor |
addType(org.apache.uima.resource.metadata.TypeDescription td)
Add an Annotation Type to the TypeSystem.
|
LeoAEDescriptor |
addTypeSystemDescription(LeoTypeSystemDescription ftsd)
Append the TypeSystem contained in a LeoTypeSystemDescription object to the TypeSystem contained in
this Analysis Engine.
|
LeoAEDescriptor |
addTypeSystemDescription(org.apache.uima.resource.metadata.TypeSystemDescription tsd)
Append an existing TypeSystem to the existing TypeSystem contained in this Analysis Engine.
|
LeoAEDescriptor |
analysisEngineSection(TransformerHandler thd,
boolean isTopDescriptor)
Generate the XML for the analysisEngine section of the deployment descriptor.
|
LeoAEDescriptor |
genTypeSystemJava(String srcDirectory,
String binDirectory)
Generate the java source files for the TypeSystem of this AnalysisEngine, then compile them.
|
protected org.apache.uima.analysis_engine.AnalysisEngineDescription |
getAEDescriptor()
Return an AnalysisEngineDescription object reference for this model.
|
org.apache.uima.analysis_engine.AnalysisEngineDescription |
getAnalysisEngineDescription()
Get a reference to the core AnalysisEngineDescription object that this LeoAEDescriptor uses.
|
org.apache.uima.resource.metadata.Capability[] |
getCapabilites()
Get the capabilities for this Analysis Engine from its metadata.
|
LeoDelegate |
getDelegate(String name)
Get a LeoAEDescriptor for a delegate engine with the name provided.
|
List<String> |
getDelegateNames()
Return the names of the delegates found in aggregate descriptors.
|
LeoDelegate[] |
getDelegates()
Get the set of delegate engines for this aggregate if it exists.
|
String |
getDescription()
Gets the description of this Resource.
|
String |
getDescriptorLocator() |
String |
getImplementationName()
Retrieves the name of this ResourceCreationSpecifier's implementation.
|
int |
getMaxNumberOfInstances() |
boolean |
getModifiesCas()
Gets whether this component will modify the CAS.
|
String |
getName()
Gets the name of this Resource.
|
int |
getNumberOfInstances() |
boolean |
getOutputsNewCASes()
Gets whether this AnalysisEngine may output new CASes.
|
Object |
getParameterValue(String paramName)
Return the value to which the parameter has been set.
|
org.apache.uima.resource.ResourceSpecifier |
getResourceSpecifier()
Return a reference to the internal ResourceSpecifier that is the backend model for the delegate.
|
LeoTypeSystemDescription |
getTypeSystemDescription()
A simple method for getting the hold of current Type System.
|
String |
getVersion()
Sets the version number of this Resource.
|
boolean |
isAggregate() |
boolean |
isAsync() |
boolean |
isDeleteOnExit()
Returns TRUE if the generated descriptors will be deleted when the program exits.
|
boolean |
isMultipleDeploymentAllowed()
Gets whether multiple instances of this component can be run in parallel, each receiving a subset of the documents from a collection.
|
boolean |
isPrimitive()
Retrieves whether the AnalysisEngine is primitive (consisting of one annotator), as opposed to aggregate (containing multiple delegate AnalysisEngines).
|
protected void |
setAEDescriptor(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
Assign the AnalysisEngineDescription model for this LeoAEDescriptor object.
|
LeoAEDescriptor |
setAnalysisEngineDescription(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
Set the AnalysisEngineDescription object that will be the core gov.va.vinci.leo.model for this LeoAEDescriptor.
|
LeoAEDescriptor |
setAnalysisEngineDescription(String descriptor,
boolean byName)
Generate the AnalysisEngineDescription object from the descriptor file and set it as the internal gov.va.vinci.leo.model
for this LeoAEDescriptor.
|
LeoAEDescriptor |
setDescription(String desc)
Sets the description of this Resource.
|
LeoAEDescriptor |
setDescriptorLocator(URI mDescriptorLocator)
Set the location where the descriptor should be generated.
|
LeoAEDescriptor |
setImplementationName(String s)
Sets the name of this ResourceCreationSpecifier's implementation.
|
LeoAEDescriptor |
setIsAsync(boolean async)
Set the async flag for an aggregate deployment only, see the
isAsync method for more information about flag usage.
|
LeoAEDescriptor |
setIsDeleteOnExit(boolean deleteOnExit)
Set the flag to TRUE if generated descriptors should be deleted when the program exits, FALSE to persist them.
|
LeoAEDescriptor |
setModifiesCas(boolean aModifiesCas)
Sets whether this component will modify the CAS.
|
LeoAEDescriptor |
setMultipleDeploymentAllowed(boolean b)
Sets whether multiple instances of this component can be run in parallel, each receiving a subset of the documents from a collection.
|
LeoAEDescriptor |
setName(String name)
Sets the name of this Resource.
|
LeoAEDescriptor |
setNumberOfInstances(int numberOfInstances) |
LeoAEDescriptor |
setOutputsNewCASes(boolean b)
Sets whether this AnalysisEngine may output new CASes.
|
LeoAEDescriptor |
setParameterSetting(NameValue fpv)
Set a parameter from a NameValue object.
|
LeoAEDescriptor |
setParameterSetting(String name,
Object value)
Set the parameter with the name to the value.
|
LeoAEDescriptor |
setTypeSystemDescription(LeoTypeSystemDescription ftsd)
This method sets the type system description for this analysis engine to the TypeSystem provided.
|
LeoAEDescriptor |
setTypeSystemDescription(org.apache.uima.resource.metadata.TypeSystemDescription tsd)
Set the type system description for this analysis engine to the TypeSystem provided.
|
LeoAEDescriptor |
setVersion(String version)
Sets the version number of this Resource.
|
void |
toXML()
Write the descriptor file out based on the locator information in the object.
|
void |
toXML(String filename)
Write the descriptor out to a temp XML file with the name provided as filename.
|
protected void |
validParamType(String paramType)
Test the Parameter Type string to make sure it is not null or empty and it is one of the defined type
constants defined in the ConfigurationParameter interface.
|
protected org.apache.uima.analysis_engine.AnalysisEngineDescription mAEDescriptor
protected ArrayList<LeoDelegate> mDelegates
protected ArrayList<String> mDelegateNames
protected org.apache.uima.analysis_engine.metadata.FlowConstraints mFlowConstraints
protected boolean mIsAsync
protected int mNumberOfInstances
protected URI mDescriptorLocator
protected boolean deleteOnExit
public static final org.apache.log4j.Logger LOG
public static final int DEFAULT_NUMBER_INSTANCES
public LeoAEDescriptor()
public LeoAEDescriptor(String name, String implementation_class)
name
- the name of the AnalysisEngine, Leo will make sure it is unique.implementation_class
- the fully qualified name of the Annotator Class.public LeoAEDescriptor(String descriptor, boolean byName, NameValue... paramValues) throws IOException, org.apache.uima.util.InvalidXMLException
descriptor
- path or name of a descriptor file used to generate the AEDbyName
- if true then try to import by name otherwise import by locationparamValues
- Optional, list of parameters names and values to set. Creates the
parameter if it does not already exist.IOException
- if the descriptor cannot created.org.apache.uima.util.InvalidXMLException
- if there is a problem creating the xml.public LeoAEDescriptor(List<LeoAEDescriptor> primitives)
primitives
- List of primitives to be included in the aggregatepublic LeoAEDescriptor(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
aed
- AnalysisEngineDescription object used to store the metadata for this descriptorprotected void setAEDescriptor(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
aed
- AnalysisEngineDescription objectprotected org.apache.uima.analysis_engine.AnalysisEngineDescription getAEDescriptor()
public LeoAEDescriptor addDelegate(String descriptor, boolean byName, NameValue... paramValues) throws IOException, org.apache.uima.util.InvalidXMLException
descriptor
- Name or path to the delegate descriptor to be added.byName
- If true import this descriptor by name, else assume the descriptor param is a pathparamValues
- Optional, parameter values to be set in the delegate descriptorIOException
- if the descriptor cannot be read.org.apache.uima.util.InvalidXMLException
- if there is a problem creating the xml.public LeoAEDescriptor addDelegate(LeoDelegate delegate)
delegate
- Delegate to be added.public LeoDelegate getDelegate(String name)
name
- Annotator delegate namepublic LeoDelegate[] getDelegates()
public List<String> getDelegateNames()
public LeoAEDescriptor setAnalysisEngineDescription(String descriptor, boolean byName) throws IOException, org.apache.uima.util.InvalidXMLException
descriptor
- file used to generate the AnalysisEngineDescription objectbyName
- if true import the descriptor by name otherwise import by locationIOException
- if the descriptor cannot created.org.apache.uima.util.InvalidXMLException
- if there is a problem creating the xml.public LeoAEDescriptor setAnalysisEngineDescription(org.apache.uima.analysis_engine.AnalysisEngineDescription aed)
aed
- The AnalysisEngineDescription objectpublic org.apache.uima.analysis_engine.AnalysisEngineDescription getAnalysisEngineDescription()
public LeoAEDescriptor setParameterSetting(String name, Object value)
name
- String representing the parameter to be setvalue
- Object that is the value of this parameterpublic LeoAEDescriptor setParameterSetting(NameValue fpv)
fpv
- Parameter name and value to be setpublic LeoAEDescriptor addParameterSetting(String paramName, boolean isMandatory, boolean isMultiValued, String paramType) throws Exception
paramName
- Name of the parameter to be createdisMandatory
- If True then this parameter is required, false otherwiseisMultiValued
- If True then this parameter is multi-valued (an Array), false otherwiseparamType
- The data type of the parameter, i.e. String, Boolean, etc.Exception
- Thrown if the parameter cannot be set with the optional value or an required argument is missingpublic LeoAEDescriptor addParameterSetting(String paramName, boolean isMandatory, boolean isMultiValued, String paramType, Object initValue) throws Exception
paramName
- Name of the parameter to be createdisMandatory
- If True then this parameter is required, false otherwiseisMultiValued
- If True then this parameter is multi-valued (an Array), false otherwiseparamType
- The data type of the parameter, i.e. String, Boolean, etc.initValue
- Optional, the initial value to set for this parameterException
- Thrown if the parameter cannot be set with the optional value or an required argument is missingprotected void validParamType(String paramType) throws Exception
paramType
- The parameter Type string to be validatedException
- Thrown if the type string is empty or null or is not one of the type
constants defined in the ConfigurationParameter interface.public LeoAEDescriptor addConfigurationParameter(org.apache.uima.resource.metadata.ConfigurationParameter aConfigurationParameter)
aConfigurationParameter
- UIMA ConfigurationParameter to addpublic Object getParameterValue(String paramName)
paramName
- The name of the parameter whose value will be returnedpublic LeoAEDescriptor addType(String aTypeName, String aTypeDescription, String aSuperTypeName) throws Exception
aTypeName
- Name of the new Type to be added to the TypeSystemaTypeDescription
- Description of the new Type to be addedaSuperTypeName
- Name of the SuperType from which this type will deriveException
- If the required parameters, aTypeName or aSuperTypeName are missing.public LeoAEDescriptor addType(org.apache.uima.resource.metadata.TypeDescription td)
td
- TypeDescription to add to the TypeSystempublic LeoAEDescriptor addTypeSystemDescription(LeoTypeSystemDescription ftsd)
ftsd
- LeoTypeSystemDescription to add to this TypeSystem.public LeoAEDescriptor addTypeSystemDescription(org.apache.uima.resource.metadata.TypeSystemDescription tsd)
tsd
- TypeSystemDescription to append to the existing one.public LeoAEDescriptor setTypeSystemDescription(LeoTypeSystemDescription ftsd)
ftsd
- LeoTypeSystemDescription to be used in this analysis enginepublic LeoAEDescriptor setTypeSystemDescription(org.apache.uima.resource.metadata.TypeSystemDescription tsd)
tsd
- TypeSystemDescription to be used for this analysis enginepublic LeoTypeSystemDescription getTypeSystemDescription()
public LeoAEDescriptor genTypeSystemJava(String srcDirectory, String binDirectory) throws Exception
srcDirectory
- Directory where the java source files will be generated intobinDirectory
- Directory path where the .class files will be generatedException
- If we are unable to generate the java files or there is a compilation errorpublic boolean isAsync()
public LeoAEDescriptor setIsAsync(boolean async)
async
- If this is a primitive, async will be set to false, otherwise it will be set to async.public boolean isAggregate()
public int getNumberOfInstances()
public LeoAEDescriptor setNumberOfInstances(int numberOfInstances)
numberOfInstances
- the NumberOfInstances to scale this enginepublic int getMaxNumberOfInstances()
public LeoAEDescriptor setDescriptorLocator(URI mDescriptorLocator)
Service.setDescriptorDirectory("my/desc/dir")
.setDescriptorLocator
in interface LeoDelegate
mDescriptorLocator
- URI path where the descriptors should be locatedpublic String getDescriptorLocator()
getDescriptorLocator
in interface LeoDelegate
public org.apache.uima.resource.ResourceSpecifier getResourceSpecifier()
getResourceSpecifier
in interface LeoDelegate
public void toXML(String filename) throws Exception
toXML
in interface LeoDelegate
filename
- the filename to write out to. Note: the name is used in creating a temp file with the .xml
suffix, so name should just be the root filename with a path or extension.Exception
- if the xml cannot be written out to the specified filepublic void toXML() throws IOException, SAXException, org.apache.uima.util.InvalidXMLException, URISyntaxException
toXML
in interface LeoDelegate
IOException
- if the file cannot be written toSAXException
- if there is a problem creating the xmlorg.apache.uima.util.InvalidXMLException
- if the xml is invalid.URISyntaxException
- if the path specified is invalid.public LeoAEDescriptor analysisEngineSection(TransformerHandler thd, boolean isTopDescriptor) throws SAXException
analysisEngineSection
in interface LeoDelegate
thd
- the xml transform handler.isTopDescriptor
- true if this is a top level descriptor, else false.SAXException
- if there is no descriptor to outputpublic boolean isPrimitive()
public LeoAEDescriptor setImplementationName(String s)
s
- the implementation name of the Annotatorpublic String getImplementationName()
public LeoAEDescriptor setDescription(String desc)
desc
- the description of this Resourcepublic String getDescription()
public LeoAEDescriptor setName(String name)
setName
in interface LeoDelegate
name
- the name of this Resourcepublic String getName()
getName
in interface LeoDelegate
public LeoAEDescriptor setVersion(String version)
version
- he version number of this Resource, as a Stringpublic String getVersion()
public LeoAEDescriptor setModifiesCas(boolean aModifiesCas)
aModifiesCas
- true if this component modifies the CAS, false if it does not.public boolean getModifiesCas()
public LeoAEDescriptor setMultipleDeploymentAllowed(boolean b)
b
- true if multiple instances can be run in parallel, false if notpublic boolean isMultipleDeploymentAllowed()
public LeoAEDescriptor setOutputsNewCASes(boolean b)
b
- true if this component may output new CASes, false if it does notpublic boolean getOutputsNewCASes()
public LeoAEDescriptor addCapability(org.apache.uima.resource.metadata.Capability c)
c
- capability to add.public org.apache.uima.resource.metadata.Capability[] getCapabilites()
public LeoAEDescriptor addResourceConfiguration(org.apache.uima.resource.metadata.ResourceManagerConfiguration rmc)
rmc
- ResourceManagerConfiguration object with external resources to bindpublic boolean isDeleteOnExit()
isDeleteOnExit
in interface LeoDelegate
public LeoAEDescriptor setIsDeleteOnExit(boolean deleteOnExit)
Service.setDeleteOnExit(true)
method.setIsDeleteOnExit
in interface LeoDelegate
deleteOnExit
- Copyright © 2018 Department of Veterans Affairs. All Rights Reserved.