Class CPEFactory
java.lang.Object
org.apache.uima.collection.impl.cpm.container.CPEFactory
Component responsible for generating objects representing cpe descriptor configuration. Provides
 various ways to instantiate object model representing cpe configuration. In the simplest form it
 ingests an XML file (CPE descriptor), parses it and creates an object for every element in the
 XML file.
 
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.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionThe cas processor config map.static final StringThe Constant CPM_HOME.
- 
Constructor SummaryConstructorsConstructorDescriptionCPEFactory(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.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCasProcessor(CasProcessor aCasProcessor) Appends given Cas Processor to the list of CasProcessors.voidaddCollectionReader(BaseCollectionReader collectionReader) Adds the collection reader.Returns an array of Cas Processors instantiated from the cpe descriptor.Returns Collection Reader instantiated from configuration in the CPE descriptor.Returns an object containing global CPE configuration including: Number of documents to process Checkpoint configuration id of the document begin processing .Returns Cpe Descriptor.getDescriptor(List aList) Gets the descriptor.getDescriptorURL(CpeCasProcessor aCasProcessorCfg) Returns a descriptor path associated with Cas Processor.intReturns number of processing threads (Processing Units).Gets the ResourceManager that all components of this CPE should share.getSpecifier(URL aDescriptorUrl) Instantiates a ResourceSpecifier from a given URL.booleanChecks if is default.booleanisDefinitionInstanceOf(Class aResourceClass, ResourceSpecifier resourceSpecifier, String aDescriptor) Check if a class has appropriate type.voidparse()Creates an object representation from default cpe descriptor.voidparse(InputStream aDescriptorStream) Creates an object representation for configuration in a given stream.voidCreates an object representation for configuration in a given cpe descriptor file.produceCasDataConsumer(Class aResourceClass, ResourceSpecifier aSpecifier, Map aAdditionalParams) Instantiates CasData Consumer from a given class.
- 
Field Details- 
CPM_HOMEThe Constant CPM_HOME.- See Also:
 
- 
casProcessorConfigMapThe cas processor config map.
 
- 
- 
Constructor Details- 
CPEFactoryCreate a new CPEFactory on which we will later call parse(String) to parse a CPE descriptor.- Parameters:
- aResourceManager- the a resource manager
 
- 
CPEFactorypublic CPEFactory(CpeDescription aDescriptor, ResourceManager aResourceManager) throws ResourceInitializationException Create a new CPEFactory for a CpeDescription that's already been parsed.- Parameters:
- aDescriptor- the a descriptor
- aResourceManager- the resource manager that all components of this CPE will share If null, a new ResourceManager will be created.
- Throws:
- ResourceInitializationException- the resource initialization exception
 
 
- 
- 
Method Details- 
parseCreates an object representation for configuration in a given cpe descriptor file.- Parameters:
- aDescriptor- - path to the descriptor
- Throws:
- InstantiationException- -
 
- 
parseCreates an object representation for configuration in a given stream.- Parameters:
- aDescriptorStream- - stream containing cpe description
- Throws:
- InstantiationException- -
 
- 
parsepublic void parse()Creates an object representation from default cpe descriptor.- Throws:
- UIMARuntimeException- wraps Exception
 
- 
getCollectionReaderReturns Collection Reader instantiated from configuration in the CPE descriptor. It also creates and initializes the CAS Initializer if one is defined and associates it with the CollectionReader.- Returns:
- CollectionReader instance
- Throws:
- ResourceConfigurationException- the resource configuration exception
 
- 
getCasProcessorsReturns an array of Cas Processors instantiated from the cpe descriptor.- Returns:
- - array of CasProcessor instances
- Throws:
- ResourceConfigurationException- -
 
- 
isDefinitionInstanceOfpublic boolean isDefinitionInstanceOf(Class aResourceClass, ResourceSpecifier resourceSpecifier, String aDescriptor) throws ResourceConfigurationException Check if a class has appropriate type.- Parameters:
- aResourceClass- - class to check
- resourceSpecifier- - specifier containing expected type
- aDescriptor- - descriptor name
- Returns:
- true - if class matches type
- Throws:
- ResourceConfigurationException- -
 
- 
produceCasDataConsumerpublic CasProcessor produceCasDataConsumer(Class aResourceClass, ResourceSpecifier aSpecifier, Map aAdditionalParams) throws ResourceInitializationException Instantiates CasData Consumer from a given class.- Parameters:
- aResourceClass- - CasDataConsumer class
- aSpecifier- - specifier
- aAdditionalParams- - parameters used to initialize CasDataConsumer
- Returns:
- - instance of CasProcessor
- Throws:
- ResourceInitializationException- -
 
- 
getDescriptorURLReturns a descriptor path associated with Cas Processor.- Parameters:
- aCasProcessorCfg- - Cas Processor configuration
- Returns:
- - Descriptor path
- Throws:
- ResourceConfigurationException- -
 
- 
getSpecifierInstantiates a ResourceSpecifier from a given URL.- Parameters:
- aDescriptorUrl- - URL of descriptor
- Returns:
- - ResourceSpecifier
- Throws:
- Exception- -
 
- 
getCPEConfigReturns an object containing global CPE configuration including:- Number of documents to process
- Checkpoint configuration
- id of the document begin processing
 - Returns:
- Global CPE Configuration
- Throws:
- InstantiationException- the instantiation exception
 
- 
getProcessingUnitThreadCountReturns number of processing threads (Processing Units).- Returns:
- Number of processing threads
- Throws:
- ResourceConfigurationException- -
 
- 
isDefaultpublic boolean isDefault()Checks if is default.- Returns:
- true if the configuration is the default
 
- 
getCpeDescriptorReturns Cpe Descriptor.- Returns:
- the Cpe Descriptor
 
- 
addCasProcessorAppends given Cas Processor to the list of CasProcessors.- Parameters:
- aCasProcessor- - CasProcessor to add
- Throws:
- ResourceConfigurationException- the resource configuration exception
 
- 
getDescriptorGets the descriptor.- Parameters:
- aList- the a list
- Returns:
- the cpe descriptor constructed from the list
- Throws:
- ResourceConfigurationException- -
 
- 
addCollectionReaderAdds the collection reader.- Parameters:
- collectionReader- - collection reader to use by the CPM
 
- 
getResourceManagerGets the ResourceManager that all components of this CPE should share.- Returns:
- the resource manager
 
 
-