public class ModuleControllerImpl extends Object implements ModuleController
PepperModule and handles as a
connector between such an object and the Pepper framework.| Modifier and Type | Field and Description |
|---|---|
protected ReentrantLock |
busyLock
A lock determining, whether this object currently is busy with importing
corpus structure or importing document structure.
|
protected ExecutorService |
executor
Executor, to create and manage threads for import of corpus structure and
import of document structure
|
protected String |
id
id of this object
|
protected PepperModule |
pepperModule
The
PepperModule object, this controller object is observing. |
protected org.corpus_tools.salt.common.SCorpusGraph |
sCorpusGraph
The
SCorpusGraph object to be filled. |
| Constructor and Description |
|---|
ModuleControllerImpl(String id)
Creates an instance of
ModuleControllerImpl. |
| Modifier and Type | Method and Description |
|---|---|
void |
complete(DocumentController documentController)
Adds the given
DocumentController to the output document bus to
be processed by the next PepperModule objects. |
void |
delete(DocumentController documentController)
Notifies the Pepper framework, that the
SDocument being contained
in passed DocumentController shall not be processed any further
by following Pepper modules. |
protected ReentrantLock |
getBusyLock()
A lock determining, whether this object currently is busy with importing
corpus structure or importing document structure.
|
org.corpus_tools.salt.common.SCorpusGraph |
getCorpusGraph()
Returns the
SCorpusGraph object, the contained
PepperImporter is mapping. |
protected ExecutorService |
getExecutor()
Returns an executor service for this object.
|
String |
getId()
Returns the id of this object.
|
DocumentBus |
getInputDocumentBus()
The
DocumentBus object working as input for this
ModuleControllerImpl. |
PepperJobImpl |
getJob()
Returns the
PepperJobImpl object reference of this object. |
DocumentBus |
getOutputDocumentBus()
All documents which were consumed by the
PepperModule contained
in this object are set to this output bus, regarding the status, the
PepperModule returned. |
PepperModule |
getPepperModule()
Returns the
PepperModule object, this controller object is
observing. |
Double |
getProgress(String globalId)
Returns the progress as a value between 0 and 1 of the contained
PepperModule object concerning to the SDocument
corresponding to the passed global identifier. |
Future<?> |
importCorpusStructure(org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph)
Starts the import of corpus structure via the set
PepperImporter
object by calling
PepperImporter.importCorpusStructure(SCorpusGraph). |
DocumentController |
next()
Returns the next
DocumentController waiting in the input document
bus to be processed by the contained PepperModule. |
DocumentController |
next(boolean ignorePermissionForDocument)
Returns the next
DocumentController waiting in the input document
bus to be processed by the contained PepperModule. |
Future<?> |
processDocumentStructures()
Starts the import of document-structure.
|
void |
setInputDocumentBus(DocumentBus inputDocumentBus)
The
DocumentBus object working as input for this
ModuleControllerImpl. |
void |
setJob_basic(PepperJobImpl job)
Sets the
PepperJobImpl object reference of this object. |
void |
setJob(PepperJobImpl job)
Sets the
PepperJobImpl object reference of this object. |
void |
setOutputDocumentBus(DocumentBus outputDocumentBus)
All documents which were consumed by the
PepperModule contained
in this object are set to this output bus, regarding the status, the
PepperModule returned. |
void |
setPepperModule_basic(PepperModule newPepperModule)
Sets the
PepperModule object, this controller object is
observing. |
void |
setPepperModule(PepperModule newPepperModule)
Sets the
PepperModule object, this controller object is
observing. |
String |
toString()
Returns a String representation of this object.
|
protected String id
protected PepperModule pepperModule
PepperModule object, this controller object is observing.protected volatile org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph
SCorpusGraph object to be filled.protected ExecutorService executor
protected ReentrantLock busyLock
public ModuleControllerImpl(String id)
ModuleControllerImpl. Sets the internal id
to the passed one. Note: the id is unchangeable.id - identifier of this object. Id can neither be null nor empty.public String getId()
getId in interface ModuleControllerpublic PepperModule getPepperModule()
PepperModule object, this controller object is
observing.getPepperModule in interface ModuleControllerpublic void setPepperModule(PepperModule newPepperModule)
PepperModule object, this controller object is
observing. Also sets the inverse method
PepperModule#setPepperModuleController_basic(ModuleControllerImpl)setPepperModule in interface ModuleControllernewPepperModule - new object to observepublic void setPepperModule_basic(PepperModule newPepperModule)
PepperModule object, this controller object is
observing.setPepperModule_basic in interface ModuleControllernewPepperModule - new object to observepublic PepperJobImpl getJob()
PepperJobImpl object reference of this object.getJob in interface ModuleControllerPepperJobImpl objectpublic void setJob(PepperJobImpl job)
PepperJobImpl object reference of this object. And
notifies the reverse method PepperJobImpl, to set the
ModuleControllerImpl object to this.setJob in interface ModuleControllerjob - new PepperJobImpl objectpublic void setJob_basic(PepperJobImpl job)
PepperJobImpl object reference of this object.setJob_basic in interface ModuleControllerjob - new PepperJobImpl objectpublic DocumentBus getInputDocumentBus()
DocumentBus object working as input for this
ModuleControllerImpl. All documents on bus will be processed and
set to #outputDocumentBusgetInputDocumentBus in interface ModuleControllerpublic void setInputDocumentBus(DocumentBus inputDocumentBus)
DocumentBus object working as input for this
ModuleControllerImpl. All documents on bus will be processed and
set to #outputDocumentBussetInputDocumentBus in interface ModuleControllerinputDocumentBus - bus to be used as input buspublic DocumentBus getOutputDocumentBus()
PepperModule contained
in this object are set to this output bus, regarding the status, the
PepperModule returned.getOutputDocumentBus in interface ModuleControllerpublic void setOutputDocumentBus(DocumentBus outputDocumentBus)
PepperModule contained
in this object are set to this output bus, regarding the status, the
PepperModule returned.setOutputDocumentBus in interface ModuleControlleroutputDocumentBus - bus to be used as input buspublic org.corpus_tools.salt.common.SCorpusGraph getCorpusGraph()
SCorpusGraph object, the contained
PepperImporter is mapping. This method will only return a non
empty object, if the contained PepperModule is an
PepperImporter and if
ModuleController.importCorpusStructure(SCorpusGraph) was called.getCorpusGraph in interface ModuleControllerprotected ExecutorService getExecutor()
public Future<?> importCorpusStructure(org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph)
PepperImporter
object by calling
PepperImporter.importCorpusStructure(SCorpusGraph). The import
runs in a separate thread, which is set as child of current thread.
Therefore, don#t forget to call method, this method keeps the focus
until, the import of the corpus structure has ended. This enables the
calling object to wait until the corpus structure was imported. This
method can only be invoked once per time.importCorpusStructure in interface ModuleControllersCorpusGraph - a SCorpusGraph object, in which the
PepperImporter shall import the corpus structure.public Future<?> processDocumentStructures()
ModuleControllerImpl object will request all
DocumentController object waiting in the incoming
DocumentBus.protected ReentrantLock getBusyLock()
public DocumentController next(boolean ignorePermissionForDocument)
DocumentController waiting in the input document
bus to be processed by the contained PepperModule.
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.next in interface ModuleControllerignorePermissionForDocument - if set, a document will be returned even if the Pepper job
gives no permissionpublic DocumentController next()
DocumentController waiting in the input document
bus to be processed by the contained PepperModule.next in interface ModuleControllerpublic void complete(DocumentController documentController)
DocumentController to the output document bus to
be processed by the next PepperModule objects.complete in interface ModuleControllerdocumentController - to be passed to next Pepper modulepublic void delete(DocumentController documentController)
SDocument being contained
in passed DocumentController shall not be processed any further
by following Pepper modules.delete in interface ModuleControllerpublic Double getProgress(String globalId)
PepperModule object concerning to the SDocument
corresponding to the passed global identifier.getProgress in interface ModuleControllerglobalId - global id for SDocument, note, that this is not the
SElementIdCopyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.