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(CpeDescription aDescriptor,
ResourceManager aResourceManager)
Create a new CPEFactory for a CpeDescription that's already been parsed.
|
CPEFactory(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(CasProcessor aCasProcessor)
Appends given Cas Processor to the list of CasProcessors
|
void |
addCollectionReader(BaseCollectionReader collectionReader) |
CasProcessor[] |
getCasProcessors()
Returns an array of Cas Processors instantiated from the cpe descriptor
|
BaseCollectionReader |
getCollectionReader()
Returns Collection Reader instantiated from configuration in the cpe descriptor.
|
CpeConfiguration |
getCPEConfig()
Returns an object containing global CPE configuration including:
Number of documents to process
Checkpoint configuration
id of the document begin processing
|
CpeDescription |
getCpeDescriptor()
Returns Cpe Descriptor
|
String |
getDescriptor(List aList) |
URL |
getDescriptorURL(CpeCasProcessor aCasProcessorCfg)
Returns a descriptor path associated with Cas Processor
|
int |
getProcessingUnitThreadCount()
Returns number of processing threads (Processing Units)
|
ResourceManager |
getResourceManager()
Gets the ResourceManager that all components of this CPE should share.
|
ResourceSpecifier |
getSpecifier(URL aDescriptorUrl)
Instantiates a ResourceSpecifier from a given URL.
|
boolean |
isDefault() |
boolean |
isDefinitionInstanceOf(Class aResourceClass,
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.
|
CasProcessor |
produceCasDataConsumer(Class aResourceClass,
ResourceSpecifier aSpecifier,
Map aAdditionalParams)
Instantiates CasData Consumer from a given class.
|
public static final String CPM_HOME
public HashMap casProcessorConfigMap
public CPEFactory(ResourceManager aResourceManager)
public CPEFactory(CpeDescription aDescriptor, ResourceManager aResourceManager) throws ResourceInitializationException
aDescriptor - aResourceManager - the resource manager that all components of this CPE will share If null, a new
ResourceManager will be created.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()
UIMARuntimeException - wraps Exceptionpublic BaseCollectionReader getCollectionReader() throws ResourceConfigurationException
ResourceConfigurationExceptionpublic CasProcessor[] getCasProcessors() throws ResourceConfigurationException
ResourceConfigurationException - -public boolean isDefinitionInstanceOf(Class aResourceClass, ResourceSpecifier resourceSpecifier, String aDescriptor) throws ResourceConfigurationException
aResourceClass - -
class to checkresourceSpecifier - -
specifier containing expected typeaDescriptor - -
descriptor nameResourceConfigurationException - -public CasProcessor produceCasDataConsumer(Class aResourceClass, ResourceSpecifier aSpecifier, Map aAdditionalParams) throws ResourceInitializationException
aResourceClass - -
CasDataConsumer classaSpecifier - -
specifieraAdditionalParams - -
parameters used to initialize CasDataConsumerResourceInitializationException - -public URL getDescriptorURL(CpeCasProcessor aCasProcessorCfg) throws ResourceConfigurationException
aCasProcessorCfg - -
Cas Processor configurationResourceConfigurationException - -public ResourceSpecifier getSpecifier(URL aDescriptorUrl) throws Exception
aDescriptorUrl - - URL of descriptorException - -public CpeConfiguration getCPEConfig() throws InstantiationException
InstantiationExceptionpublic int getProcessingUnitThreadCount()
throws ResourceConfigurationException
ResourceConfigurationException - -public boolean isDefault()
public CpeDescription getCpeDescriptor()
public void addCasProcessor(CasProcessor aCasProcessor) throws ResourceConfigurationException
aCasProcessor - -
CasProcessor to addResourceConfigurationExceptionpublic String getDescriptor(List aList) throws ResourceConfigurationException
aList - ResourceConfigurationException - -public void addCollectionReader(BaseCollectionReader collectionReader)
collectionReader - -
collection reader to use by the CPMpublic ResourceManager getResourceManager()
Copyright © 2018. All rights reserved.