public class DocumentControllerImpl extends Object implements DocumentController
SDocument
. And a list of tuples for all
Modules and their current status. Can send SDocumentGraph
s contained
in given SDocument
to sleep and wake them.Modifier and Type | Class and Description |
---|---|
protected static class |
DocumentControllerImpl.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. |
Modifier and Type | Field and Description |
---|---|
protected ModuleController |
currentModuleController
stores the currently active document controller
|
protected boolean |
isStarted
Determines, if this object is already 'started', which means if
#updateStatus(String, DOCUMENT_STATUS) has been called. |
protected List<ModuleControllerImpl> |
moduleControllers
A list of all
ModuleControllerImpl objects, the here contained
SDocument object has to pass. |
protected int |
numberOfProcessingModules
Stores the number of
PepperModule , currently processing this
DocumentControllerImpl . |
Constructor and Description |
---|
DocumentControllerImpl()
Initializes an object of this class.
|
DocumentControllerImpl(org.corpus_tools.salt.common.SDocument document)
Initializes an object of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
addModuleControllers(ModuleControllerImpl moduleController)
Adds a further
ModuleControllerImpl to internal list of all
ModuleControllerImpl objects, the here contained
SDocument object has to pass. |
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() . |
ModuleController |
getCurrentModuleController()
Returns the module controller, which is currently processing this
document.
|
org.corpus_tools.salt.common.SDocument |
getDocument()
Returns the
SDocument object, to which this object belongs to. |
org.corpus_tools.salt.graph.Identifier |
getDocumentId()
Returns the
Identifier of the SDocument object, to which
this object belongs to. |
String |
getGlobalId()
Returns a global unique (inside one Salt project) id for the contained
SDocument object. |
DOCUMENT_STATUS |
getGlobalStatus()
Returns the global status of this object.
|
org.eclipse.emf.common.util.URI |
getLocation()
Returns location, where to store
SDocumentGraph when
#sleep() was called or load when DocumentController.awake() was called |
List<ModuleControllerImpl> |
getModuleControllers()
Returns a list of all
ModuleControllerImpl objects, the here
contained SDocument object has to pass. |
int |
getNumOfProcessingModules()
Returns the number of
PepperModule currently processing the
SDocument or more precisly the SDocumentGraph contained
by this DocumentControllerImpl object. |
Long |
getProcessingTime()
Returns the processing time of the contained
SDocument object,
needed by all registered PepperModule , which have already started
the process. |
double |
getProgress()
Returns the progress of the contained
SDocument for all
registered ModuleControllerImpl objects. |
int |
getSize_nodes()
Stores the number of
SNode s a document contains, when it ws send
to sleep. |
int |
getSize_relations()
Stores the number of
SRelation s a document contains, when it ws
send to sleep. |
String |
getStatusReport()
Returns a formated string containing a report of the progress status of
the contained document.
|
boolean |
isAsleep()
Returns if the
SDocumentGraph of contained SDocument is
send to sleep or awake. |
void |
sendToSleep_FORCE()
Sends the
DocumentControllerImpl object, that the contained
SDocument or more precisely the SDocumentGraph object
could be send to sleep as method DocumentController.sendToSleep() . |
void |
sendToSleep()
Notifies the
DocumentControllerImpl object, that the contained
SDocument or more precisely the SDocumentGraph object
could be send to sleep. |
void |
setCallGC(boolean callGC)
Sets whether the garbage collector should be called after sending a
SDocument object to sleep. |
void |
setDocument(org.corpus_tools.salt.common.SDocument sDocument)
Sets the
SDocument object, to which this object belongs to. |
void |
setLocation(org.eclipse.emf.common.util.URI location)
Sets location, where to store
SDocumentGraph when
#sleep() was called or load when DocumentController.awake() was called. |
protected 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) . |
String |
toString()
Returns a textual representation of this object.
|
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. |
protected volatile List<ModuleControllerImpl> moduleControllers
ModuleControllerImpl
objects, the here contained
SDocument
object has to pass.protected volatile boolean isStarted
#updateStatus(String, DOCUMENT_STATUS)
has been called.protected volatile int numberOfProcessingModules
PepperModule
, currently processing this
DocumentControllerImpl
. Number is determined by method
#updateStatus(String, DOCUMENT_STATUS)
protected volatile ModuleController currentModuleController
public DocumentControllerImpl()
DOCUMENT_STATUS
will be set to
DOCUMENT_STATUS.NOT_STARTED
.public DocumentControllerImpl(org.corpus_tools.salt.common.SDocument document)
DOCUMENT_STATUS
will be set to
DOCUMENT_STATUS.NOT_STARTED
.document
- SDocument
object which is controlled by this objectpublic org.corpus_tools.salt.common.SDocument getDocument()
SDocument
object, to which this object belongs to.getDocument
in interface DocumentController
public void setDocument(org.corpus_tools.salt.common.SDocument sDocument)
SDocument
object, to which this object belongs to.
Computes the globalId ( see: DocumentController.getGlobalId()
). Adds the global id
as processing instruction to the SDocument
object.setDocument
in interface DocumentController
sDocument
- SDocument
object to which this object belongs topublic org.corpus_tools.salt.graph.Identifier getDocumentId()
Identifier
of the SDocument
object, to which
this object belongs to.getDocumentId
in interface DocumentController
public String getGlobalId()
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.getGlobalId
in interface DocumentController
SDocument
objectpublic void setCallGC(boolean callGC)
SDocument
object to sleep.callGC
- public org.eclipse.emf.common.util.URI getLocation()
SDocumentGraph
when
#sleep()
was called or load when DocumentController.awake()
was calledgetLocation
in interface DocumentController
public void setLocation(org.eclipse.emf.common.util.URI location)
SDocumentGraph
when
#sleep()
was called or load when DocumentController.awake()
was called.setLocation
in interface DocumentController
location
- location as URI
public boolean isAsleep()
SDocumentGraph
of contained SDocument
is
send to sleep or awake.isAsleep
in interface DocumentController
SDocumentGraph
is asleep, false otherwise.protected void sleep()
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.public void sendToSleep()
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 DocumentController.awake()
. Both methods are
synchronized.sendToSleep
in interface DocumentController
public void sendToSleep_FORCE()
DocumentControllerImpl
object, that the contained
SDocument
or more precisely the SDocumentGraph
object
could be send to sleep as method DocumentController.sendToSleep()
. SDocumentGraph
is still in use by any other module. Therfore
handle with care.sendToSleep_FORCE
in interface DocumentController
public void awake()
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.awake
in interface DocumentController
public String toString()
public List<ModuleControllerImpl> getModuleControllers()
ModuleControllerImpl
objects, the here
contained SDocument
object has to pass.getModuleControllers
in interface DocumentController
ModuleControllerImpl
objectspublic void addModuleControllers(ModuleControllerImpl moduleController)
ModuleControllerImpl
to internal list of all
ModuleControllerImpl
objects, the here contained
SDocument
object has to pass. #updateStatus(String, DOCUMENT_STATUS)
has been called.addModuleControllers
in interface DocumentController
moduleController
- ModuleControllerImpl
the SDocument
also has to
passpublic int getNumOfProcessingModules()
PepperModule
currently processing the
SDocument
or more precisly the SDocumentGraph
contained
by this DocumentControllerImpl
object.getNumOfProcessingModules
in interface DocumentController
PepperModule
objectspublic ModuleController getCurrentModuleController()
getCurrentModuleController
in interface DocumentController
ModuleController
public void updateStatus(ModuleController moduleController, DOCUMENT_STATUS status)
SDocument
object
corresponding to the ModuleControllerImpl
matching to the passed
id.updateStatus
in interface DocumentController
status
- the status to which the StepStatus
shall be set to.public DOCUMENT_STATUS getGlobalStatus()
StepStatus
object being contained in this object.
StepStatus
objects status value is
set to DOCUMENT_STATUS.IN_PROGRESS
, the global status will be
DOCUMENT_STATUS.IN_PROGRESS
.StepStatus
objects status value is
set to DOCUMENT_STATUS.DELETED
, the global status will be
DOCUMENT_STATUS.DELETED
.StepStatus
objects status value is
set to DOCUMENT_STATUS.FAILED
, the global status will be
DOCUMENT_STATUS.FAILED
.StepStatus
objects status value is set
to DOCUMENT_STATUS.COMPLETED
, the global status will be
DOCUMENT_STATUS.COMPLETED
.getGlobalStatus
in interface DocumentController
public double getProgress()
SDocument
for all
registered ModuleControllerImpl
objects.getProgress
in interface DocumentController
public Long getProcessingTime()
SDocument
object,
needed by all registered PepperModule
, which have already started
the process.getProcessingTime
in interface DocumentController
public String getStatusReport()
public int getSize_nodes()
SNode
s a document contains, when it ws send
to sleep.getSize_nodes
in interface DocumentController
SNode
of the contained documentpublic int getSize_relations()
SRelation
s a document contains, when it ws
send to sleep.getSize_relations
in interface DocumentController
SRelation
of the contained documentCopyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.