Package org.corpus_tools.pepper.modules
Interface DocumentController
-
- All Known Implementing Classes:
DocumentControllerImpl
public interface DocumentController
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddModuleControllers(ModuleControllerImpl moduleController)Adds a furtherModuleControllerImplto internal list of allModuleControllerImplobjects, the here containedSDocumentobject has to pass.voidawake()Wakes up the containedSDocument, which means, it theSDocumentGraphof theSDocumentwill be load to main memory again by callingSDocument#loadSDocumentGraph().ModuleControllergetCurrentModuleController()Returns the module controller, which is currently processing this document.org.corpus_tools.salt.common.SDocumentgetDocument()Returns theSDocumentobject, to which this object belongs to.org.corpus_tools.salt.graph.IdentifiergetDocumentId()Returns theIdentifierof theSDocumentobject, to which this object belongs to.StringgetGlobalId()Returns a global unique (inside one Salt project) id for the containedSDocumentobject.DOCUMENT_STATUSgetGlobalStatus()Returns the global status of this object.org.eclipse.emf.common.util.URIgetLocation()Returns location, where to storeSDocumentGraphwhen#sleep()was called or load whenawake()was calledList<ModuleControllerImpl>getModuleControllers()Returns a list of allModuleControllerImplobjects, the here containedSDocumentobject has to pass.intgetNumOfProcessingModules()Returns the number ofPepperModulecurrently processing theSDocumentor more precisly theSDocumentGraphcontained by thisDocumentControllerImplobject.LonggetProcessingTime()Returns the processing time of the containedSDocumentobject, needed by all registeredPepperModule, which have already started the process.doublegetProgress()Returns the progress of the containedSDocumentfor all registeredModuleControllerImplobjects.intgetSize_nodes()Stores the number ofSNodes a document contains, when it ws send to sleep.intgetSize_relations()Stores the number ofSRelations a document contains, when it ws send to sleep.booleanisAsleep()Returns if theSDocumentGraphof containedSDocumentis send to sleep or awake.voidsendToSleep()Notifies theDocumentControllerImplobject, that the containedSDocumentor more precisely theSDocumentGraphobject could be send to sleep.voidsendToSleep_FORCE()Sends theDocumentControllerImplobject, that the containedSDocumentor more precisely theSDocumentGraphobject could be send to sleep as methodsendToSleep().voidsetDocument(org.corpus_tools.salt.common.SDocument sDocument)Sets theSDocumentobject, to which this object belongs to.voidsetLocation(org.eclipse.emf.common.util.URI location)Sets location, where to storeSDocumentGraphwhen#sleep()was called or load whenawake()was called.voidupdateStatus(ModuleController moduleController, DOCUMENT_STATUS status)Updates the status of a specified of containedSDocumentobject corresponding to theModuleControllerImplmatching to the passed id.
-
-
-
Method Detail
-
getDocument
org.corpus_tools.salt.common.SDocument getDocument()
Returns theSDocumentobject, to which this object belongs to.- Returns:
- document id
-
setDocument
void setDocument(org.corpus_tools.salt.common.SDocument sDocument)
Sets theSDocumentobject, to which this object belongs to. Computes the globalId ( see:getGlobalId()). Adds the global id as processing instruction to theSDocumentobject.- Parameters:
sDocument-SDocumentobject to which this object belongs to
-
getDocumentId
org.corpus_tools.salt.graph.Identifier getDocumentId()
Returns theIdentifierof theSDocumentobject, to which this object belongs to.- Returns:
- document id
-
getGlobalId
String getGlobalId()
Returns a global unique (inside one Salt project) id for the containedSDocumentobject. This identifier is computed by mthe number of theSCorpusGraphin list, thisSDocumentobject is contained in and theIdentifierof theSDocument. Imagine the number of theSCorpusGraphis 1 and theIdentifier.getId()is /corpus1/document1, than the returned global id is /1/corpus1/document1.- Returns:
- a global unique (inside one Salt project) id for the contained
SDocumentobject
-
getLocation
org.eclipse.emf.common.util.URI getLocation()
Returns location, where to storeSDocumentGraphwhen#sleep()was called or load whenawake()was called- Returns:
- location
-
setLocation
void setLocation(org.eclipse.emf.common.util.URI location)
Sets location, where to storeSDocumentGraphwhen#sleep()was called or load whenawake()was called.- Parameters:
location- location asURI
-
getSize_nodes
int getSize_nodes()
Stores the number ofSNodes a document contains, when it ws send to sleep.- Returns:
- number of
SNodeof the contained document
-
getSize_relations
int getSize_relations()
Stores the number ofSRelations a document contains, when it ws send to sleep.- Returns:
- number of
SRelationof the contained document
-
isAsleep
boolean isAsleep()
Returns if theSDocumentGraphof containedSDocumentis send to sleep or awake.- Returns:
- true, if
SDocumentGraphis asleep, false otherwise.
-
sendToSleep
void sendToSleep()
Notifies theDocumentControllerImplobject, that the containedSDocumentor more precisely theSDocumentGraphobject could be send to sleep. If noPepperModuleis currently processing it, theSDocumentGraphis send to sleep. This means, theSDocumentGraphwill be stored to local disk and removed from main memory, by callingSDocument#saveSDocumentGraph(org.eclipse.emf.common.util.URI). The counterpart to this method isawake(). Both methods are synchronized.
-
sendToSleep_FORCE
void sendToSleep_FORCE()
Sends theDocumentControllerImplobject, that the containedSDocumentor more precisely theSDocumentGraphobject could be send to sleep as methodsendToSleep().
But note, this method does not check if theSDocumentGraphis still in use by any other module. Therfore handle with care.
-
awake
void awake()
Wakes up the containedSDocument, which means, it theSDocumentGraphof theSDocumentwill be load to main memory again by callingSDocument#loadSDocumentGraph(). The counterpart to this method is#sleep(). Both methods are synchronized.
-
getModuleControllers
List<ModuleControllerImpl> getModuleControllers()
Returns a list of allModuleControllerImplobjects, the here containedSDocumentobject has to pass.- Returns:
- a list of all
ModuleControllerImplobjects
-
getCurrentModuleController
ModuleController getCurrentModuleController()
Returns the module controller, which is currently processing this document.- Returns:
- the currently active
ModuleController
-
addModuleControllers
void addModuleControllers(ModuleControllerImpl moduleController)
Adds a furtherModuleControllerImplto internal list of allModuleControllerImplobjects, the here containedSDocumentobject has to pass.
Note: You cannot call this method anymore, if the process has already been started. Which means that the methods#updateStatus(String, DOCUMENT_STATUS)has been called.- Parameters:
moduleController-ModuleControllerImpltheSDocumentalso has to pass
-
getNumOfProcessingModules
int getNumOfProcessingModules()
Returns the number ofPepperModulecurrently processing theSDocumentor more precisly theSDocumentGraphcontained by thisDocumentControllerImplobject.- Returns:
- number of processing
PepperModuleobjects
-
updateStatus
void updateStatus(ModuleController moduleController, DOCUMENT_STATUS status)
Updates the status of a specified of containedSDocumentobject corresponding to theModuleControllerImplmatching to the passed id.- Parameters:
pModuleController- determines theStepStatusobjectstatus- the status to which theStepStatusshall be set to.
-
getGlobalStatus
DOCUMENT_STATUS getGlobalStatus()
Returns the global status of this object. The global status is determined by eachStepStatusobject being contained in this object.- If one of the contained
StepStatusobjects status value is set toDOCUMENT_STATUS.IN_PROGRESS, the global status will beDOCUMENT_STATUS.IN_PROGRESS. - If one of the contained
StepStatusobjects status value is set toDOCUMENT_STATUS.DELETED, the global status will beDOCUMENT_STATUS.DELETED. - If one of the contained
StepStatusobjects status value is set toDOCUMENT_STATUS.FAILED, the global status will beDOCUMENT_STATUS.FAILED. - Only if each contained
StepStatusobjects status value is set toDOCUMENT_STATUS.COMPLETED, the global status will beDOCUMENT_STATUS.COMPLETED.
- Returns:
- If one of the contained
-
getProgress
double getProgress()
Returns the progress of the containedSDocumentfor all registeredModuleControllerImplobjects.- Returns:
- percentage value between 0 and 1.
-
getProcessingTime
Long getProcessingTime()
Returns the processing time of the containedSDocumentobject, needed by all registeredPepperModule, which have already started the process.
-
-