public class DocumentBus extends Object
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. 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.| Modifier and Type | Field and Description |
|---|---|
protected Hashtable<String,ConcurrentLinkedQueue<DocumentController>> |
documentBus
This table is the central management object of the
DocumentBus. |
protected String |
id
Id of this object.
|
protected List<String> |
inputModuleControllerIds
A list of Ids belonging to
ModuleController objects on the input
side. |
protected ReentrantLock |
lock
This lock is used for creating the condition
waitUntilAllDocumentsArePut to let the pop(String)
method wait until all documents have been put. |
protected MEMORY_POLICY |
memPolicy |
protected List<String> |
outputModuleControllerIds
A list of Ids belonging to
ModuleController objects, which are on
the output side of this queue. |
protected Condition |
waitUntilAllDocumentsArePut
Used to let the
pop(String) method wait until all documents have
been put. |
| Constructor and Description |
|---|
DocumentBus(List<String> inputModuleControllerIds,
List<String> outputModuleControllerIds)
Creates an object of this type and sets all passed in- and output
ModuleController objects. |
DocumentBus(List<String> inputModuleControllerIds,
String outputModuleControllerId)
Creates an object of this type and sets the passes the given input
controller and output controller.
|
DocumentBus(String inputModuleControllerId,
List<String> outputModuleControllerIds)
Creates an object of this type and sets the passes the given input
controller and output controller.
|
DocumentBus(String inputModuleControllerId,
String outputModuleControllerId)
Creates an object of this type and sets the passes the given input
controller and output controller.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
Hashtable<String,ConcurrentLinkedQueue<DocumentController>> |
getDocumentBus()
Returns the table, which is the central management object of the
DocumentBus. |
String |
getId()
Creates an id for this object. the id consists of the in- and output
DocumentController objects. |
List<String> |
getInputControllerIds()
Returns a list of Ids belonging to
ModuleController objects on
the input side. |
MEMORY_POLICY |
getMemPolicy()
Returns the set memory policy.
|
List<String> |
getOutputControllerIds()
Returns a list of Ids belonging to
ModuleController objects,
which are on the output side of this queue. |
PepperJobImpl |
getPepperJob()
Returns the
PepperJob object containing this object |
protected void |
init(List<String> inputModuleControllerIds,
List<String> outputModuleControllerIds)
Creates an object of this type and passes all output
ModuleController objects. |
protected void |
initDocumentBus(List<String> outputModuleControllerIds)
Initializes the table, which is the central management object of the
DocumentBus. |
boolean |
isFinished()
Returns true, whether all input
ModuleController objects called
the finish(String) method and set this object to status finish. |
DocumentController |
pop(String outputControllerId)
Returns a
DocumentController object, which is on first place of
the internal queue (regarding the FIFO principle). |
DocumentController |
pop(String outputControllerId,
boolean ignorePermissionForDocument)
Returns a
DocumentController object, which is on first place of
the internal queue (regarding the FIFO principle). |
void |
put(DocumentController documentController)
Adds the given
DocumentController object to the queue. |
void |
setMemPolicy(MEMORY_POLICY memPolicy)
Sets the memory policy.
|
void |
setPepperJob(PepperJobImpl pepperJob)
Sets the
PepperJob object containing this object |
String |
toString()
returns a String representation of this object.
|
protected List<String> outputModuleControllerIds
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.protected List<String> inputModuleControllerIds
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 String id
protected volatile Hashtable<String,ConcurrentLinkedQueue<DocumentController>> documentBus
DocumentBus.
This table relates a queue containing document controllers to a
identifier of a ModuleController object. Key= identifier, value=
queueprotected volatile MEMORY_POLICY memPolicy
protected ReentrantLock lock
waitUntilAllDocumentsArePut to let the pop(String)
method wait until all documents have been put.protected Condition waitUntilAllDocumentsArePut
pop(String) method wait until all documents have
been put.public DocumentBus(String inputModuleControllerId, String outputModuleControllerId)
inputModuleControllerId - identifier of controller, which produces documents for this
busoutputModuleControllerId - identifier of controller, which consumes documents for this
buspublic DocumentBus(String inputModuleControllerId, List<String> outputModuleControllerIds)
inputModuleControllerId - identifier of controller, which produces documents for this
busoutputModuleControllerIds - list of identifier of controller, which consumes documents for
this buspublic DocumentBus(List<String> inputModuleControllerIds, String outputModuleControllerId)
inputModuleControllerIds - list of identifier of controller, which produces documents for
this busoutputModuleControllerId - identifier of controller, which consumes documents for this
buspublic DocumentBus(List<String> inputModuleControllerIds, List<String> outputModuleControllerIds)
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 busoutputModuleControllerIds - list of identifier of controller, which consumes documents for
this busprotected void init(List<String> inputModuleControllerIds, List<String> outputModuleControllerIds)
ModuleController objects. This is important, because an
DocumentController can only be removed from queue, when all
output ModuleController objects requested the
DocumentController object.outputs - public List<String> getOutputControllerIds()
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.public List<String> getInputControllerIds()
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.public String getId()
DocumentController objects.public PepperJobImpl getPepperJob()
PepperJob object containing this objectPepperJob object containing thispublic void setPepperJob(PepperJobImpl pepperJob)
PepperJob object containing this objectpepperJob - PepperJob object containing thispublic Hashtable<String,ConcurrentLinkedQueue<DocumentController>> getDocumentBus()
DocumentBus. This table relates a queue containing document
controllers to a identifier of a ModuleController object. Key=
identifier, value= queueprotected void initDocumentBus(List<String> outputModuleControllerIds)
DocumentBus. This table relates a queue containing document
controllers to a identifier of a ModuleController object. Key=
identifier, value= queue. outputModuleControllerIds - a list of ids of the ModuleController objects on the
output side.public MEMORY_POLICY getMemPolicy()
public void setMemPolicy(MEMORY_POLICY memPolicy)
memPolicy - public void finish(String inputControllerId)
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.public boolean isFinished()
ModuleController objects called
the finish(String) method and set this object to status finish.public void put(DocumentController documentController)
DocumentController object to the queue.documentController - the DocumentController object to be added to the
queue.public DocumentController pop(String outputControllerId)
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. PepperJobImpl gives the permission.
Otherwise, this method waits for the permission. PepperModule has not finished all documentsPepperJobImpl) gives
the permission to wake up the document, if it was in sleep mode
moduleController - object requesting the DocumentController objectpublic DocumentController pop(String outputControllerId, boolean ignorePermissionForDocument)
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. PepperJobImpl gives the permission.
Otherwise, this method waits for the permission. PepperModule has not finished all documentsPepperJobImpl) gives
the permission to wake up the document, if it was in sleep mode
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 objectignorePermissionForDocument - if set, a document will be returned even if the Pepper job
gives no permissionCopyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.