Package org.corpus_tools.pepper.core
Class TerminalDocumentBus
- java.lang.Object
-
- org.corpus_tools.pepper.core.DocumentBus
-
- org.corpus_tools.pepper.core.TerminalDocumentBus
-
public class TerminalDocumentBus extends DocumentBus
TODO make docu- Author:
- Florian Zipser
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringID_TERMINALid for the terminal document bus, which is output for exporters-
Fields inherited from class org.corpus_tools.pepper.core.DocumentBus
documentBus, id, inputModuleControllerIds, lock, memPolicy, outputModuleControllerIds, waitUntilAllDocumentsArePut
-
-
Constructor Summary
Constructors Constructor Description TerminalDocumentBus(String inputModuleControllerId)Creates an object of this type and sets the passes the given input controller and output controller.TerminalDocumentBus(List<String> inputModuleControllerIds)Creates an object of this type and sets all passed in- and outputModuleControllerImplobjects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentControllerpop(String outputControllerId)Returns aDocumentControllerobject, which is on first place of the internal queue (regarding the FIFO principle).DocumentControllerpop(String outputControllerId, boolean ignorePermissionForDocument)Returns aDocumentControllerobject, which is on first place of the internal queue (regarding the FIFO principle).-
Methods inherited from class org.corpus_tools.pepper.core.DocumentBus
finish, getDocumentBus, getId, getInputControllerIds, getMemPolicy, getOutputControllerIds, getPepperJob, init, initDocumentBus, isFinished, put, setMemPolicy, setPepperJob, toString
-
-
-
-
Field Detail
-
ID_TERMINAL
protected static final String ID_TERMINAL
id for the terminal document bus, which is output for exporters- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TerminalDocumentBus
public TerminalDocumentBus(String inputModuleControllerId)
Creates an object of this type and sets the passes the given input controller and output controller.- Parameters:
inputModuleControllerId- identifier of controller, which produces documents for this bus
-
TerminalDocumentBus
public TerminalDocumentBus(List<String> inputModuleControllerIds)
Creates an object of this type and sets all passed in- and outputModuleControllerImplobjects. This is important, because anDocumentControllercan only be removed from queue, when all outputModuleControllerImplobjects requested theDocumentControllerobject.- Parameters:
inputModuleControllerIds- list of identifier of controller, which produces documents for this bus
-
-
Method Detail
-
pop
public DocumentController pop(String outputControllerId, boolean ignorePermissionForDocument)
Description copied from class:DocumentBusReturns aDocumentControllerobject, which is on first place of the internal queue (regarding the FIFO principle). When all registeredModuleControllerobjects popped theDocumentControllerobject, 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 thePepperJobImplgives the permission. Otherwise, this method waits for the permission.
Caution, call this method can take some time, since it waits for two conditions:- a document is waiting in the queue, and the preceding
PepperModulehas not finished all documents - the Pepper framework (more precisely the
PepperJobImpl) gives the permission to wake up the document, if it was in sleep mode
DocumentBus.pop(String), ifignorePermissionForDocumentis set to true this method returns aDocumentControllerobject even if thePepperJobpermission does not allow to process a further document. This mechanism can be used, if aPepperModulehas an own control mechanism of sendingSDocuments to sleep.- Overrides:
popin classDocumentBus- Parameters:
outputControllerId- object requesting theDocumentControllerobjectignorePermissionForDocument- if set, a document will be returned even if the Pepper job gives no permission- Returns:
- head of the queue.
- a document is waiting in the queue, and the preceding
-
pop
public DocumentController pop(String outputControllerId)
Returns aDocumentControllerobject, which is on first place of the internal queue (regarding the FIFO principle). When all registeredModuleControllerImplobjects popped theDocumentControllerobject, it will be removed from internal queue.- Overrides:
popin classDocumentBus- Parameters:
moduleController- object requesting theDocumentControllerobject- Returns:
- head of the queue.
-
-