public class CPEFactory extends Object
Using objects representing configuration, this component creates CollectionReader CasInitializer, Analysis Engines, and Cas Consumers.
In addition to creating object, this component provides read/write access to the object model allowing for dynamic or programmatic modifications. It facilitates plugging in existing CollectionReaders and CasProcessors.
| Modifier and Type | Field and Description |
|---|---|
HashMap |
casProcessorConfigMap
The cas processor config map.
|
static String |
CPM_HOME
The Constant CPM_HOME.
|
| Constructor and Description |
|---|
CPEFactory(org.apache.uima.collection.metadata.CpeDescription aDescriptor,
org.apache.uima.resource.ResourceManager aResourceManager)
Create a new CPEFactory for a CpeDescription that's already been parsed.
|
CPEFactory(org.apache.uima.resource.ResourceManager aResourceManager)
Create a new CPEFactory on which we will later call parse(String) to parse a CPE descriptor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor)
Appends given Cas Processor to the list of CasProcessors.
|
void |
addCollectionReader(org.apache.uima.collection.base_cpm.BaseCollectionReader collectionReader)
Adds the collection reader.
|
org.apache.uima.collection.base_cpm.CasProcessor[] |
getCasProcessors()
Returns an array of Cas Processors instantiated from the cpe descriptor.
|
org.apache.uima.collection.base_cpm.BaseCollectionReader |
getCollectionReader()
Returns Collection Reader instantiated from configuration in the cpe descriptor.
|
org.apache.uima.collection.metadata.CpeConfiguration |
getCPEConfig()
Returns an object containing global CPE configuration including:
Number of documents to process
Checkpoint configuration
id of the document begin processing
.
|
org.apache.uima.collection.metadata.CpeDescription |
getCpeDescriptor()
Returns Cpe Descriptor.
|
String |
getDescriptor(List aList)
Gets the descriptor.
|
URL |
getDescriptorURL(org.apache.uima.collection.metadata.CpeCasProcessor aCasProcessorCfg)
Returns a descriptor path associated with Cas Processor.
|
int |
getProcessingUnitThreadCount()
Returns number of processing threads (Processing Units).
|
org.apache.uima.resource.ResourceManager |
getResourceManager()
Gets the ResourceManager that all components of this CPE should share.
|
org.apache.uima.resource.ResourceSpecifier |
getSpecifier(URL aDescriptorUrl)
Instantiates a ResourceSpecifier from a given URL.
|
boolean |
isDefault()
Checks if is default.
|
boolean |
isDefinitionInstanceOf(Class aResourceClass,
org.apache.uima.resource.ResourceSpecifier resourceSpecifier,
String aDescriptor)
Check if a class has appropriate type.
|
void |
parse()
Creates an object representation from default cpe descriptor.
|
void |
parse(InputStream aDescriptorStream)
Creates an object representation for configuration in a given stream.
|
void |
parse(String aDescriptor)
Creates an object representation for configuration in a given cpe descriptor file.
|
org.apache.uima.collection.base_cpm.CasProcessor |
produceCasDataConsumer(Class aResourceClass,
org.apache.uima.resource.ResourceSpecifier aSpecifier,
Map aAdditionalParams)
Instantiates CasData Consumer from a given class.
|
public static final String CPM_HOME
public HashMap casProcessorConfigMap
public CPEFactory(org.apache.uima.resource.ResourceManager aResourceManager)
aResourceManager - the a resource managerpublic CPEFactory(org.apache.uima.collection.metadata.CpeDescription aDescriptor,
org.apache.uima.resource.ResourceManager aResourceManager)
throws org.apache.uima.resource.ResourceInitializationException
aDescriptor - the a descriptoraResourceManager - the resource manager that all components of this CPE will share If null, a new
ResourceManager will be created.org.apache.uima.resource.ResourceInitializationException - the resource initialization exceptionpublic void parse(String aDescriptor) throws InstantiationException
aDescriptor - -
path to the descriptorInstantiationException - -public void parse(InputStream aDescriptorStream) throws InstantiationException
aDescriptorStream - -
stream containing cpe descriptionInstantiationException - -public void parse()
org.apache.uima.UIMARuntimeException - wraps Exceptionpublic org.apache.uima.collection.base_cpm.BaseCollectionReader getCollectionReader()
throws org.apache.uima.resource.ResourceConfigurationException
org.apache.uima.resource.ResourceConfigurationException - the resource configuration exceptionpublic org.apache.uima.collection.base_cpm.CasProcessor[] getCasProcessors()
throws org.apache.uima.resource.ResourceConfigurationException
org.apache.uima.resource.ResourceConfigurationException - -public boolean isDefinitionInstanceOf(Class aResourceClass, org.apache.uima.resource.ResourceSpecifier resourceSpecifier, String aDescriptor) throws org.apache.uima.resource.ResourceConfigurationException
aResourceClass - -
class to checkresourceSpecifier - -
specifier containing expected typeaDescriptor - -
descriptor nameorg.apache.uima.resource.ResourceConfigurationException - -public org.apache.uima.collection.base_cpm.CasProcessor produceCasDataConsumer(Class aResourceClass, org.apache.uima.resource.ResourceSpecifier aSpecifier, Map aAdditionalParams) throws org.apache.uima.resource.ResourceInitializationException
aResourceClass - -
CasDataConsumer classaSpecifier - -
specifieraAdditionalParams - -
parameters used to initialize CasDataConsumerorg.apache.uima.resource.ResourceInitializationException - -public URL getDescriptorURL(org.apache.uima.collection.metadata.CpeCasProcessor aCasProcessorCfg) throws org.apache.uima.resource.ResourceConfigurationException
aCasProcessorCfg - -
Cas Processor configurationorg.apache.uima.resource.ResourceConfigurationException - -public org.apache.uima.resource.ResourceSpecifier getSpecifier(URL aDescriptorUrl) throws Exception
aDescriptorUrl - - URL of descriptorException - -public org.apache.uima.collection.metadata.CpeConfiguration getCPEConfig()
throws InstantiationException
InstantiationException - the instantiation exceptionpublic int getProcessingUnitThreadCount()
throws org.apache.uima.resource.ResourceConfigurationException
org.apache.uima.resource.ResourceConfigurationException - -public boolean isDefault()
public org.apache.uima.collection.metadata.CpeDescription getCpeDescriptor()
public void addCasProcessor(org.apache.uima.collection.base_cpm.CasProcessor aCasProcessor)
throws org.apache.uima.resource.ResourceConfigurationException
aCasProcessor - -
CasProcessor to addorg.apache.uima.resource.ResourceConfigurationException - the resource configuration exceptionpublic String getDescriptor(List aList) throws org.apache.uima.resource.ResourceConfigurationException
aList - the a listorg.apache.uima.resource.ResourceConfigurationException - -public void addCollectionReader(org.apache.uima.collection.base_cpm.BaseCollectionReader collectionReader)
collectionReader - -
collection reader to use by the CPMpublic org.apache.uima.resource.ResourceManager getResourceManager()
Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.