Textractor API textractor-720 (20091120123250)

textractor.chain
Class AbstractSentenceConsumer

java.lang.Object
  extended by textractor.sentence.AbstractSentenceProcessor
      extended by textractor.chain.AbstractSentenceConsumer
All Implemented Interfaces:
Callable<Boolean>, EventListener, Command, SentenceProcessingCompleteListener, SentenceConsumer, SentenceProcessor, TextractorProcessor
Direct Known Subclasses:
DocumentStoreBuilder, Indexer, SentenceWriter

public abstract class AbstractSentenceConsumer
extends AbstractSentenceProcessor
implements Command, SentenceConsumer, SentenceProcessingCompleteListener, Callable<Boolean>

Command implementation that executes a SentenceConsumer.


Field Summary
protected  boolean productionCompleted
          Indicates the producer is done and there will be no more to consume.
protected  TextractorContext textractorContext
          The Context that this SentenceConsumer can use.
 
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
AbstractSentenceConsumer()
          Create a new Command to consume sentences.
 
Method Summary
 Boolean call()
           
 boolean execute(Context context)
           
 boolean okToComplete()
          Indicate that all processing is complete and it's ok to terminate.
 void processingComplete(SentenceProcessingCompleteEvent event)
          This method gets called when a sentence processing is complete.
 
Methods inherited from class textractor.sentence.AbstractSentenceProcessor
addSentenceProcessedListener, addSentenceProcessingCompleteListener, fireSentenceProcessedEvent, fireSentenceProcessingCompleteEvent, removeSentenceProcessedListener, removeSentenceProcessingCompleteListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface textractor.sentence.SentenceConsumer
consume
 
Methods inherited from interface textractor.sentence.SentenceProcessor
addSentenceProcessedListener, addSentenceProcessingCompleteListener, getNumberOfArticlesProcessed, getNumberOfSentencesProcessed, removeSentenceProcessedListener, removeSentenceProcessingCompleteListener
 

Field Detail

productionCompleted

protected boolean productionCompleted
Indicates the producer is done and there will be no more to consume.


textractorContext

protected TextractorContext textractorContext
The Context that this SentenceConsumer can use.

Constructor Detail

AbstractSentenceConsumer

public AbstractSentenceConsumer()
Create a new Command to consume sentences.

Method Detail

execute

public final boolean execute(Context context)
Specified by:
execute in interface Command

call

public final Boolean call()
                   throws Exception
Specified by:
call in interface Callable<Boolean>
Throws:
Exception

okToComplete

public boolean okToComplete()
Indicate that all processing is complete and it's ok to terminate. If false is returned the consumer thread will terminate without firing a SentenceProcessingCompleteEvent. Be aware of this and send the event if you override the default behavior.

Returns:
true if it's ok to complete.

processingComplete

public void processingComplete(SentenceProcessingCompleteEvent event)
This method gets called when a sentence processing is complete.

Specified by:
processingComplete in interface SentenceProcessingCompleteListener
Parameters:
event - A SentenceProcessingCompleteEvent object describing the event source.

Textractor API textractor-720 (20091120123250)

Copyright © 2003-2008 Institute for Computational Biomedicine, All Rights Reserved.