Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.core.DocumentControllerImpl Class Reference

Stores the global status of a SDocument. More...

Inherits org.corpus_tools.pepper.modules.DocumentController.

Classes

class  DetailedStatus
 A small helper class, to store the status and the processing a specific PepperModule needed for the SDocument object contained by the container DocumentControllerImpl object.
 

Public Member Functions

 DocumentControllerImpl ()
 Initializes an object of this class. More...
 
 DocumentControllerImpl (SDocument document)
 Initializes an object of this class. More...
 
SDocument getDocument ()
 Returns the SDocument object, to which this object belongs to.
Returns
document id

 
void setDocument (SDocument sDocument)
 Sets the SDocument object, to which this object belongs to.Computes the globalId ( see: getGlobalId()). Adds the global id as processing instruction to the SDocument object.
Parameters
sDocumentSDocument object to which this object belongs to

 
Identifier getDocumentId ()
 Returns the Identifier of the SDocument object, to which this object belongs to.
Returns
document id

 
String getGlobalId ()
 Returns a global unique (inside one Salt project) id for the contained SDocument object.This identifier is computed by mthe number of the SCorpusGraph in list, this SDocument object is contained in and the Identifier of the SDocument. Imagine the number of the SCorpusGraph is 1 and the Identifier#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 SDocument object

 
void setCallGC (boolean callGC)
 Sets whether the garbage collector should be called after sending a SDocument object to sleep. More...
 
URI getLocation ()
 Returns location, where to store SDocumentGraph when sleep() was called or load when awake() was called.
Returns
location

 
void setLocation (URI location)
 Sets location, where to store SDocumentGraph when sleep() was called or load when awake() was called.
Parameters
locationlocation as URI

 
boolean isAsleep ()
 Returns if the SDocumentGraph of contained SDocument is send to sleep or awake.
Returns
true, if SDocumentGraph is asleep, false otherwise.

 
void sendToSleep ()
 Notifies the DocumentControllerImpl object, that the contained SDocument or more precisely the SDocumentGraph object could be send to sleep.If no PepperModule is currently processing it, the SDocumentGraph is send to sleep. This means, the SDocumentGraph will be stored to local disk and removed from main memory, by calling SDocument#saveSDocumentGraph(org.eclipse.emf.common.util.URI). The counterpart to this method is awake(). Both methods are synchronized.
 
void sendToSleep_FORCE ()
 Sends the DocumentControllerImpl object, that the contained SDocument or more precisely the SDocumentGraph object could be send to sleep as method sendToSleep().
But note, this method does not check if the SDocumentGraph is still in use by any other module. Therfore handle with care.
 
void awake ()
 Wakes up the contained SDocument, which means, it the SDocumentGraph of the SDocument will be load to main memory again by calling SDocument#loadSDocumentGraph().The counterpart to this method is sleep(). Both methods are synchronized.
 
String toString ()
 Returns a textual representation of this object. More...
 
List< ModuleControllerImplgetModuleControllers ()
 Returns a list of all ModuleControllerImpl objects, the here contained SDocument object has to pass.
Returns
a list of all ModuleControllerImpl objects

 
synchronized void addModuleControllers (ModuleControllerImpl moduleController)
 Adds a further ModuleControllerImpl to internal list of all ModuleControllerImpl objects, the here contained SDocument object 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
moduleControllerModuleControllerImpl the SDocument also has to pass

 
int getNumOfProcessingModules ()
 Returns the number of PepperModule currently processing the SDocument or more precisly the SDocumentGraph contained by this DocumentControllerImpl object.
Returns
number of processing PepperModule objects

 
ModuleController getCurrentModuleController ()
 Returns the module controller, which is currently processing this document.
Returns
the currently active ModuleController

 
void updateStatus (ModuleController moduleController, DOCUMENT_STATUS status)
 Updates the status of a specified of contained SDocument object corresponding to the ModuleControllerImpl matching to the passed id.
Parameters
pModuleControllerdetermines the StepStatus object
statusthe status to which the StepStatus shall be set to.

 
DOCUMENT_STATUS getGlobalStatus ()
 Returns the global status of this object.The global status is determined by each StepStatus object being contained in this object.

Returns

 
double getProgress ()
 Returns the progress of the contained SDocument for all registered ModuleControllerImpl objects.
Returns
percentage value between 0 and 1.

 
Long getProcessingTime ()
 Returns the processing time of the contained SDocument object, needed by all registered PepperModule, which have already started the process.
 
String getStatusReport ()
 Returns a formated string containing a report of the progress status of the contained document. More...
 
int getSize_nodes ()
 Stores the number of SNodes a document contains, when it ws send to sleep.
Returns
number of SNode of the contained document

 
int getSize_relations ()
 Stores the number of SRelations a document contains, when it ws send to sleep.
Returns
number of SRelation of the contained document

 

Protected Member Functions

void sleep ()
 Sends the contained SDocument to sleep, which means, it will be stored to local disk and removed from main memory, by calling SDocument#saveSDocumentGraph(org.eclipse.emf.common.util.URI). More...
 

Protected Attributes

volatile List< ModuleControllerImplmoduleControllers = null
 A list of all ModuleControllerImpl objects, the here contained SDocument object has to pass.
 
volatile boolean isStarted = false
 Determines, if this object is already 'started', which means if updateStatus(String, DOCUMENT_STATUS) has been called.
 
volatile int numberOfProcessingModules = 0
 Stores the number of PepperModule, currently processing this DocumentControllerImpl. More...
 
volatile ModuleController currentModuleController = null
 stores the currently active document controller
 

Detailed Description

Stores the global status of a SDocument.

And a list of tuples for all Modules and their current status. Can send SDocumentGraphs contained in given SDocument to sleep and wake them.

Author
Florian Zipser

Constructor & Destructor Documentation

◆ DocumentControllerImpl() [1/2]

org.corpus_tools.pepper.core.DocumentControllerImpl.DocumentControllerImpl ( )

Initializes an object of this class.

The default value of DOCUMENT_STATUS will be set to DOCUMENT_STATUS#NOT_STARTED.

◆ DocumentControllerImpl() [2/2]

org.corpus_tools.pepper.core.DocumentControllerImpl.DocumentControllerImpl ( SDocument  document)

Initializes an object of this class.

The default value of DOCUMENT_STATUS will be set to DOCUMENT_STATUS#NOT_STARTED.

Parameters
documentSDocument object which is controlled by this object

Member Function Documentation

◆ getStatusReport()

String org.corpus_tools.pepper.core.DocumentControllerImpl.getStatusReport ( )

Returns a formated string containing a report of the progress status of the contained document.

Returns
a report of the progress status

◆ setCallGC()

void org.corpus_tools.pepper.core.DocumentControllerImpl.setCallGC ( boolean  callGC)

Sets whether the garbage collector should be called after sending a SDocument object to sleep.

Parameters
callGC

◆ sleep()

void org.corpus_tools.pepper.core.DocumentControllerImpl.sleep ( )
protected

Sends the contained SDocument to sleep, which means, it will be stored to local disk and removed from main memory, by calling SDocument#saveSDocumentGraph(org.eclipse.emf.common.util.URI).

The counterpart to this method is awake(). Both methods are synchronized.

◆ toString()

String org.corpus_tools.pepper.core.DocumentControllerImpl.toString ( )

Returns a textual representation of this object.

Note: This representation could not be used for serialization/deserialization purposes.

Returns
textual representation

Member Data Documentation

◆ numberOfProcessingModules

volatile int org.corpus_tools.pepper.core.DocumentControllerImpl.numberOfProcessingModules = 0
protected

Stores the number of PepperModule, currently processing this DocumentControllerImpl.

Number is determined by method updateStatus(String, DOCUMENT_STATUS)