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 |
static String |
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) |
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) |
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() |
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)
public CPEFactory(org.apache.uima.collection.metadata.CpeDescription aDescriptor,
org.apache.uima.resource.ResourceManager aResourceManager)
throws org.apache.uima.resource.ResourceInitializationException
aDescriptor - aResourceManager - the resource manager that all components of this CPE will share If null, a new
ResourceManager will be created.org.apache.uima.resource.ResourceInitializationExceptionpublic 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()
InstantiationException - -public org.apache.uima.collection.base_cpm.BaseCollectionReader getCollectionReader()
throws org.apache.uima.resource.ResourceConfigurationException
ConfigurationException - -org.apache.uima.resource.ResourceConfigurationExceptionpublic 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 - -public 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.ResourceConfigurationExceptionpublic String getDescriptor(List aList) throws org.apache.uima.resource.ResourceConfigurationException
aList - org.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–2014 The Apache Software Foundation. All rights reserved.