Pepper
3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
|
This object is an implementation of a threadsafe queue to store DocumentController objects. More...
Inherited by org.corpus_tools.pepper.core.InitialDocumentBus, and org.corpus_tools.pepper.core.TerminalDocumentBus.
Public Member Functions | |
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... | |
DocumentController | pop (String outputControllerId) |
Returns a DocumentController object, which is on first place of the internal queue (regarding the FIFO principle). 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... | |
String | toString () |
returns a String representation of this object. More... | |
Protected Member Functions | |
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 | |
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. | |
This object is an implementation of a threadsafe queue to store DocumentController objects.
Such an object is used to connect multiple ModuleController objects. An DocumentController can only be removed from queue, when all output ModuleController objects requested the DocumentController object.
This object has a list of Ids belonging to ModuleController objects, which are on the output side of this queue. All these objects have to request a document, before this queue can get the status finished. The same goes for ModuleController objects on the input side. All these controllers have to notify this queue to be finished, before the queue can notify the controllers on the output side, that this queue is finished.
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.
inputModuleControllerId | identifier of controller, which produces documents for this bus |
outputModuleControllerId | identifier of controller, which consumes documents for this bus |
org.corpus_tools.pepper.core.DocumentBus.DocumentBus | ( | String | inputModuleControllerId, |
List< String > | outputModuleControllerIds | ||
) |
Creates an object of this type and sets the passes the given input controller and output controller.
inputModuleControllerId | identifier of controller, which produces documents for this bus |
outputModuleControllerIds | list of identifier of controller, which consumes documents for this bus |
org.corpus_tools.pepper.core.DocumentBus.DocumentBus | ( | List< String > | inputModuleControllerIds, |
String | outputModuleControllerId | ||
) |
Creates an object of this type and sets the passes the given input controller and output controller.
inputModuleControllerIds | list of identifier of controller, which produces documents for this bus |
outputModuleControllerId | identifier of controller, which consumes documents for this bus |
org.corpus_tools.pepper.core.DocumentBus.DocumentBus | ( | List< String > | inputModuleControllerIds, |
List< String > | outputModuleControllerIds | ||
) |
Creates an object of this type and sets all passed in- and output ModuleController objects.
This is important, because an DocumentController can only be removed from queue, when all output ModuleController objects requested the DocumentController object.
inputModuleControllerIds | list of identifier of controller, which produces documents for this bus |
outputModuleControllerIds | list of identifier of controller, which consumes documents for this bus |
void org.corpus_tools.pepper.core.DocumentBus.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.
inputControllerId | id of controller to be set to finish. |
Hashtable<String, ConcurrentLinkedQueue<DocumentController> > org.corpus_tools.pepper.core.DocumentBus.getDocumentBus | ( | ) |
Returns the table, which is the central management object of the DocumentBus.
This table relates a queue containing document controllers to a identifier of a ModuleController object. Key= identifier, value= queue
String org.corpus_tools.pepper.core.DocumentBus.getId | ( | ) |
Creates an id for this object.
the id consists of the in- and output DocumentController objects.
List<String> org.corpus_tools.pepper.core.DocumentBus.getInputControllerIds | ( | ) |
Returns a list of Ids belonging to ModuleController objects on the input side.
All these controllers have to notify this queue to be finished, before the queue can notify the controllers on the output side, that this queue is finished.
MEMORY_POLICY org.corpus_tools.pepper.core.DocumentBus.getMemPolicy | ( | ) |
Returns the set memory policy.
List<String> org.corpus_tools.pepper.core.DocumentBus.getOutputControllerIds | ( | ) |
Returns a list of Ids belonging to ModuleController objects, which are on the output side of this queue.
All these objects have to request a document, before this queue can get the status finished.
PepperJobImpl org.corpus_tools.pepper.core.DocumentBus.getPepperJob | ( | ) |
|
protected |
Creates an object of this type and passes all output ModuleController objects.
This is important, because an DocumentController can only be removed from queue, when all output ModuleController objects requested the DocumentController object.
outputs |
|
protected |
Initializes the table, which is the central management object of the DocumentBus.
This table relates a queue containing document controllers to a identifier of a ModuleController object. Key= identifier, value= queue.
Please take care not to call this method, when this object is already started, since this will confuse the started process.
outputModuleControllerIds | a list of ids of the ModuleController objects on the output side. |
boolean org.corpus_tools.pepper.core.DocumentBus.isFinished | ( | ) |
Returns true, whether all input ModuleController objects called the finish(String) method and set this object to status finish.
DocumentController org.corpus_tools.pepper.core.DocumentBus.pop | ( | String | outputControllerId | ) |
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:
moduleController | object requesting the DocumentController object |
Reimplemented in org.corpus_tools.pepper.core.TerminalDocumentBus.
DocumentController org.corpus_tools.pepper.core.DocumentBus.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:
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.
outputControllerId | object requesting the DocumentController object |
ignorePermissionForDocument | if set, a document will be returned even if the Pepper job gives no permission |
Reimplemented in org.corpus_tools.pepper.core.TerminalDocumentBus.
void org.corpus_tools.pepper.core.DocumentBus.put | ( | DocumentController | documentController | ) |
Adds the given DocumentController object to the queue.
documentController | the DocumentController object to be added to the queue. |
Reimplemented in org.corpus_tools.pepper.core.InitialDocumentBus.
void org.corpus_tools.pepper.core.DocumentBus.setMemPolicy | ( | MEMORY_POLICY | memPolicy | ) |
Sets the memory policy.
Don't change the memory policy, when job was started.
memPolicy |
void org.corpus_tools.pepper.core.DocumentBus.setPepperJob | ( | PepperJobImpl | pepperJob | ) |
String org.corpus_tools.pepper.core.DocumentBus.toString | ( | ) |
returns a String representation of this object.
Note, that this String cannot be used for serialization/deserialization purposes.
|
protected |
This table is the central management object of the DocumentBus.
This table relates a queue containing document controllers to a identifier of a ModuleController object. Key= identifier, value= queue
|
protected |
A list of Ids belonging to ModuleController objects on the input side.
All these controllers have to notify this queue to be finished, before the queue can notify the controllers on the output side, that this queue is finished.
|
protected |
A list of Ids belonging to ModuleController objects, which are on the output side of this queue.
All these objects have to request a document, before this queue can get the status finished.