public class SimpleTextMerger extends JCasMultiplier_ImplBase
Limitations: if the lastSegment feature is never set to true by the component producing the input CASes, the merger will never produce any output. Also, this implementation relies on the CASes arriving in order, which could be a problem in a mulithreaded framework implementation. The order requirement could be relieved by recording a segment number in the SourceDocumentInformation, but that would also make this example more complicated.
Modifier and Type | Field and Description |
---|---|
static String |
MESSAGE_DIGEST |
static String |
MISSING_SOURCE_DOCUMENT_INFO |
static String |
NO_NEXT_CAS |
Constructor and Description |
---|
SimpleTextMerger() |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Asks if this AnalysisComponent has another CAS to output.
|
void |
initialize(UimaContext aContext)
Performs any startup tasks required by this component.
|
AbstractCas |
next()
Gets the next output CAS.
|
void |
process(JCas aJCas)
This method should be overriden by subclasses.
|
getCasInstancesRequired, getEmptyJCas, getRequiredCasInterface, process
batchProcessComplete, collectionProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification
public static final String MESSAGE_DIGEST
public static final String MISSING_SOURCE_DOCUMENT_INFO
public static final String NO_NEXT_CAS
public void initialize(UimaContext aContext) throws ResourceInitializationException
AnalysisComponent
The framework supplies this AnalysisComponent with a reference to the UimaContext
that
it will use, for example to access configuration settings or resources. This AnalysisComponent
should store a reference to its the UimaContext
for later use.
initialize
in interface AnalysisComponent
initialize
in class AnalysisComponent_ImplBase
aContext
- Provides access to services and resources managed by the framework. This includes
configuration parameters, logging, and access to external resources.ResourceInitializationException
- if this AnalysisComponent cannot initialize successfully.public void process(JCas aJCas) throws AnalysisEngineProcessException
JCasMultiplier_ImplBase
AnalysisComponent.hasNext()
is called and returns
false, or until the process
method is called again (see
AnalysisComponent
for details).process
in class JCasMultiplier_ImplBase
aJCas
- a JCAS that this AnalysisComponent should process.AnalysisEngineProcessException
- if a problem occurs during processingpublic boolean hasNext() throws AnalysisEngineProcessException
AnalysisComponent
AnalysisComponent.next()
should retrieve the next output CAS. When this method returns false,
the AnalysisComponent gives up control of the initial CAS that was passed to its
AnalysisComponent.process(AbstractCas)
method.AnalysisEngineProcessException
- if a problem occurs during processingpublic AbstractCas next() throws AnalysisEngineProcessException
AnalysisComponent
AnalysisComponent.hasNext()
and checking that it returns true.
The AnalysisComponent can obtain a new CAS by calling UimaContext.getEmptyCas(Class)
(or instead, one of the helper methods in the ImplBase class that it extended).
AnalysisEngineProcessException
- if a problem occurs during processingCopyright © 2016. All rights reserved.