Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.core.TerminalDocumentBus Class Reference

TODO make docu. More...

Inherits org.corpus_tools.pepper.core.DocumentBus.

Public Member Functions

 TerminalDocumentBus (String inputModuleControllerId)
 Creates an object of this type and sets the passes the given input controller and output controller. More...
 
 TerminalDocumentBus (List< String > inputModuleControllerIds)
 Creates an object of this type and sets all passed in- and output ModuleControllerImpl objects. More...
 
DocumentController pop (String outputControllerId, boolean ignorePermissionForDocument)
 Returns a DocumentController object, which is on first place of the internal queue (regarding the FIFO principle). More...
 
DocumentController pop (String outputControllerId)
 Returns a DocumentController object, which is on first place of the internal queue (regarding the FIFO principle). More...
 
- Public Member Functions inherited from org.corpus_tools.pepper.core.DocumentBus
 DocumentBus (String inputModuleControllerId, String outputModuleControllerId)
 Creates an object of this type and sets the passes the given input controller and output controller. More...
 
 DocumentBus (String inputModuleControllerId, List< String > outputModuleControllerIds)
 Creates an object of this type and sets the passes the given input controller and output controller. More...
 
 DocumentBus (List< String > inputModuleControllerIds, String outputModuleControllerId)
 Creates an object of this type and sets the passes the given input controller and output controller. More...
 
 DocumentBus (List< String > inputModuleControllerIds, List< String > outputModuleControllerIds)
 Creates an object of this type and sets all passed in- and output ModuleController objects. More...
 
List< String > getOutputControllerIds ()
 Returns a list of Ids belonging to ModuleController objects, which are on the output side of this queue. More...
 
List< String > getInputControllerIds ()
 Returns a list of Ids belonging to ModuleController objects on the input side. More...
 
String getId ()
 Creates an id for this object. More...
 
PepperJobImpl getPepperJob ()
 Returns the PepperJob object containing this object. More...
 
void setPepperJob (PepperJobImpl pepperJob)
 Sets the PepperJob object containing this object. More...
 
Hashtable< String, ConcurrentLinkedQueue< DocumentController > > getDocumentBus ()
 Returns the table, which is the central management object of the DocumentBus. More...
 
MEMORY_POLICY getMemPolicy ()
 Returns the set memory policy. More...
 
void setMemPolicy (MEMORY_POLICY memPolicy)
 Sets the memory policy. More...
 
void finish (String inputControllerId)
 Sets the entry corresponding to given id to status finished, which means, that when all listed ModuleController objects on input side, are set to status finish, this queue is finished and no further documents are passed to ModuleController objects on output side. More...
 
boolean isFinished ()
 Returns true, whether all input ModuleController objects called the finish(String) method and set this object to status finish. More...
 
void put (DocumentController documentController)
 Adds the given DocumentController object to the queue. More...
 
String toString ()
 returns a String representation of this object. More...
 

Static Protected Attributes

static final String ID_TERMINAL = "terminal"
 id for the terminal document bus, which is output for exporters
 

Additional Inherited Members

- Protected Member Functions inherited from org.corpus_tools.pepper.core.DocumentBus
void init (List< String > inputModuleControllerIds, List< String > outputModuleControllerIds)
 Creates an object of this type and passes all output ModuleController objects. More...
 
void initDocumentBus (List< String > outputModuleControllerIds)
 Initializes the table, which is the central management object of the DocumentBus. More...
 
- Protected Attributes inherited from org.corpus_tools.pepper.core.DocumentBus
List< String > outputModuleControllerIds = null
 A list of Ids belonging to ModuleController objects, which are on the output side of this queue. More...
 
List< String > inputModuleControllerIds = null
 A list of Ids belonging to ModuleController objects on the input side. More...
 
String id = null
 Id of this object.
 
volatile Hashtable< String, ConcurrentLinkedQueue< DocumentController > > documentBus = null
 This table is the central management object of the DocumentBus. More...
 
volatile MEMORY_POLICY memPolicy = MEMORY_POLICY.MODERATE
 
ReentrantLock lock = new ReentrantLock(true)
 This lock is used for creating the condition waitUntilAllDocumentsArePut to let the pop(String) method wait until all documents have been put.
 
Condition waitUntilAllDocumentsArePut = lock.newCondition()
 Used to let the pop(String) method wait until all documents have been put.
 

Detailed Description

TODO make docu.

Author
Florian Zipser

Constructor & Destructor Documentation

◆ TerminalDocumentBus() [1/2]

org.corpus_tools.pepper.core.TerminalDocumentBus.TerminalDocumentBus ( String  inputModuleControllerId)

Creates an object of this type and sets the passes the given input controller and output controller.

Parameters
inputModuleControllerIdidentifier of controller, which produces documents for this bus

◆ TerminalDocumentBus() [2/2]

org.corpus_tools.pepper.core.TerminalDocumentBus.TerminalDocumentBus ( List< String >  inputModuleControllerIds)

Creates an object of this type and sets all passed in- and output ModuleControllerImpl objects.

This is important, because an DocumentController can only be removed from queue, when all output ModuleControllerImpl objects requested the DocumentController object.

Parameters
inputModuleControllerIdslist of identifier of controller, which produces documents for this bus

Member Function Documentation

◆ pop() [1/2]

DocumentController org.corpus_tools.pepper.core.TerminalDocumentBus.pop ( String  outputControllerId)

Returns a DocumentController object, which is on first place of the internal queue (regarding the FIFO principle).

When all registered ModuleControllerImpl objects popped the DocumentController object, it will be removed from internal queue.

Parameters
moduleControllerobject requesting the DocumentController object
Returns
head of the queue.

Reimplemented from org.corpus_tools.pepper.core.DocumentBus.

◆ pop() [2/2]

DocumentController org.corpus_tools.pepper.core.TerminalDocumentBus.pop ( String  outputControllerId,
boolean  ignorePermissionForDocument 
)

Returns a DocumentController object, which is on first place of the internal queue (regarding the FIFO principle).

When all registered ModuleController objects popped the DocumentController object, it will be removed from internal queue.
If the document, which is the one to be taken in queue is in sleep mode, it will be woken up, if the PepperJobImpl gives the permission. Otherwise, this method waits for the permission.
Caution, call this method can take some time, since it waits for two conditions:

  1. a document is waiting in the queue, and the preceding PepperModule has not finished all documents
  2. the Pepper framework (more precisely the PepperJobImpl) gives the permission to wake up the document, if it was in sleep mode

In contrast to pop(String), if ignorePermissionForDocument is set to true this method returns a DocumentController object even if the PepperJob permission does not allow to process a further document. This mechanism can be used, if a PepperModule has an own control mechanism of sending SDocuments to sleep.

Parameters
outputControllerIdobject requesting the DocumentController object
ignorePermissionForDocumentif set, a document will be returned even if the Pepper job gives no permission
Returns
head of the queue.

Reimplemented from org.corpus_tools.pepper.core.DocumentBus.