public class PepperJobImpl extends PepperJob
Step
class. To get the list of all steps, see #getSteps()
.
Note: Do not use this list to add a further step. Use
#addStep(PepperModule)
instead.
ModuleControllerImpl
, DocumentBus
and
PepperJobImpl
Modifier and Type | Field and Description |
---|---|
protected List<DocumentBus> |
documentBuses
A list of all buses between the
ModuleControllerImpl objects |
protected List<DocumentController> |
documentControllers
A list of all
DocumentControllerImpl objects corresponding to
each SDocument belonging to this job. |
protected List<DocumentBus> |
initialDocumentBuses
all documentBusses which are connected with
PepperImporter
modules |
protected ReentrantLock |
inProgress
Specifies if this job currently runs a conversion.
|
protected boolean |
isImportedCorpusStructure
flag to determine, if corpus structure has already been imported
|
protected boolean |
isReadyToStart
Determines if
checkReadyToStart() was already called |
protected boolean |
isWired
Determines, if steps are already wired.
|
protected MEMORY_POLICY |
memPolicy |
protected ModuleResolver |
moduleResolver
A reference to the OSGi module resolver, to find modules matching to the
step description
|
protected org.corpus_tools.salt.common.SaltProject |
saltProject
The
SaltProject which is converted by this job. |
Constructor and Description |
---|
PepperJobImpl(String jobId)
Initializes a
PepperJobImpl and sets its unique identifier. |
Modifier and Type | Method and Description |
---|---|
void |
addStep(Step step)
Adds the passed
Step object to the workflow covered by this
PepperJobImpl object and tries to resolve the described
PepperModule . |
Step |
addStep(StepDesc stepDesc)
Creates a new
Step object containing all values of the passed
StepDesc object and adds it to the workflow covered by this
PepperJobImpl . |
void |
addStepDesc(StepDesc stepDesc)
Overrides method
PepperJob.addStepDesc(StepDesc) , but calls it
via super and than calls addStep(Step) . |
protected Collection<org.apache.commons.lang3.tuple.Pair<Step,Collection<String>>> |
checkReadyToStart()
Checks for each
PepperModule in all steps, if it is ready to
start, via calling PepperModule.isReadyToStart() . |
void |
clear()
Removes all
Step s from all internal lists. |
void |
convert()
Starts the conversion of this job.
|
void |
convertFrom()
Imports a
SaltProject from any format. |
void |
convertTo()
Exports the
SaltProject into any format. |
Set<DocumentController> |
getActiveDocuments()
Returns a set of all currently active documents.
|
List<Step> |
getAllSteps()
Returns a of all steps belonging no matter, to which phase they belong.
|
PepperConfiguration |
getConfiguration()
returns the properties to customize the behavior of conversion for this
single job.
|
protected List<DocumentBus> |
getDocumentBuses() |
List<DocumentController> |
getDocumentControllers()
Returns a list of all
DocumentControllerImpl objects
corresponding to each SDocument belonging to this job. |
List<Step> |
getExportSteps()
Returns the list of all steps belonging to the export phase.
|
List<Step> |
getImportSteps()
Returns the list of all steps belonging to the import phase.
|
List<Step> |
getManipulationSteps()
Returns the list of all steps belonging to the manipulation phase.
|
int |
getMaxNumberOfDocuments()
Returns the maximal number of
SDocument objects which could be
processed at the same time |
MEMORY_POLICY |
getMemPolicy()
Returns the set memory policy.
|
ModuleResolver |
getModuleResolver()
Returns a reference to the OSGi module resolver, to find modules matching
to the step description.
|
int |
getNumOfActiveDocuments()
Returns the current number of
SDocument objects which could be
processed at the same time |
boolean |
getPermissionForProcessDoument(DocumentController controller)
Returns true, if a
SDocument or more precisely spoken a
SDocumentGraph could be woken up or imported. |
Long |
getProcessingTime()
Returns the amount of time the job already took.
|
org.corpus_tools.salt.common.SaltProject |
getSaltProject()
Returns the
SaltProject which is converted by this job. |
String |
getStatusReport()
Returns a formated string as a kind of a document centric progress
status.
|
protected void |
importCorpusStructures()
Imports corpus structures of all registered
ImportCorpusStructureTest steps. |
void |
load(org.eclipse.emf.common.util.URI uri)
Loads a serialization of a
PepperJob and fills this object with
these entries. |
void |
releaseDocument(DocumentController controller)
Releases a document and reduces the internal counter for the number of
currently processed documents (
getNumOfActiveDocuments() ). |
org.eclipse.emf.common.util.URI |
save(org.eclipse.emf.common.util.URI uri)
Stores this job to the file at passed URI.
|
void |
setConfiguration(PepperConfiguration conf)
Sets the properties to customize the behavior of conversion for this
single job
|
protected void |
setMaxNumerOfDocuments(int maxNumOfDocuments) |
protected void |
setMemPolicy(MEMORY_POLICY memPolicy)
Sets the memory policy.
|
void |
setModuleResolver(ModuleResolver moduleResolver)
Sets a reference to the OSGi module resolver, to find modules matching to
the step description.
|
void |
setSaltProject(org.corpus_tools.salt.common.SaltProject saltProject)
Sets the
SaltProject which is converted by this job. |
String |
toString()
Returns a textual representation of this Pepper job.
|
protected List<org.corpus_tools.salt.graph.Identifier> |
unifyProposedImportOrders(org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph)
Returns a list of
Identifier s corresponding to the
SDocument objects contained in the passed SCorpusGraph
object. |
protected void |
wire()
Wires all
Step objects being contained by this object to be ready
for #start() . |
createStepDesc, getBaseDir, getId, getStatus, getStepDescs, setBaseDir
protected org.corpus_tools.salt.common.SaltProject saltProject
SaltProject
which is converted by this job.protected ModuleResolver moduleResolver
protected List<DocumentBus> documentBuses
ModuleControllerImpl
objectsprotected List<DocumentBus> initialDocumentBuses
PepperImporter
modulesprotected boolean isWired
#start()
.protected volatile boolean isImportedCorpusStructure
protected List<DocumentController> documentControllers
DocumentControllerImpl
objects corresponding to
each SDocument
belonging to this job.protected boolean isReadyToStart
checkReadyToStart()
was already calledprotected volatile ReentrantLock inProgress
Step
s cannot be done
simultaneously.protected volatile MEMORY_POLICY memPolicy
public PepperJobImpl(String jobId)
PepperJobImpl
and sets its unique identifier.jobId
- unique identifier for this job. The id is not changeablepublic org.corpus_tools.salt.common.SaltProject getSaltProject()
SaltProject
which is converted by this job.getSaltProject
in class PepperJob
SaltProject
public void setSaltProject(org.corpus_tools.salt.common.SaltProject saltProject)
SaltProject
which is converted by this job.saltProject
- new SaltProject
public PepperConfiguration getConfiguration()
public void setConfiguration(PepperConfiguration conf)
conf
- for customizationpublic ModuleResolver getModuleResolver()
PepperModule
objectspublic void setModuleResolver(ModuleResolver moduleResolver)
moduleResolver
- reference to resolver to resolve PepperModule
objectspublic List<Step> getManipulationSteps()
Step
objects.public List<Step> getImportSteps()
Step
objects.public List<Step> getExportSteps()
Step
objects.public List<Step> getAllSteps()
Step
objects.public void addStepDesc(StepDesc stepDesc)
PepperJob.addStepDesc(StepDesc)
, but calls it
via super and than calls addStep(Step)
.StepDesc
object to job.addStepDesc
in class PepperJob
stepDesc
- description object of a particular steppublic Step addStep(StepDesc stepDesc)
Step
object containing all values of the passed
StepDesc
object and adds it to the workflow covered by this
PepperJobImpl
. Further tries to resolve the described
PepperModule
.public void addStep(Step step)
Step
object to the workflow covered by this
PepperJobImpl
object and tries to resolve the described
PepperModule
.
getModuleResolver()
must be setgetSaltProject()
must be setstep
- Step
object to be added to internal listprotected List<DocumentBus> getDocumentBuses()
protected void wire()
Step
objects being contained by this object to be ready
for #start()
. Which means, that:
getImportSteps()
is wired via a initial
document bus with the framework (no wiring, but listening on
#ID_INTITIAL
)getManipulationSteps()
is wired with following
step in list with a DocumentBus
.
getExportSteps()
is wired via a terminal
document bus with the framework (no wiring, but listening on
#ID_TERMINAL
)protected void importCorpusStructures()
ImportCorpusStructureTest
steps. After calling
PepperImporter.importCorpusStructure(SCorpusGraph)
, all
following modules will be asked, if they want to influence the order of
importing documents. If this is the case, an order is created and put to
all PepperImporter
objects. SCorpusGraph
objects as
Step
given in import step list getImportSteps()
. The
position of SCorpusGraph
corresponding to PepperImporter
(importing that graph) in SaltProject.getCorpusGraphs()
is
equivalent to position of Step
in list getImportSteps()
.protected List<org.corpus_tools.salt.graph.Identifier> unifyProposedImportOrders(org.corpus_tools.salt.common.SCorpusGraph sCorpusGraph)
Identifier
s corresponding to the
SDocument
objects contained in the passed SCorpusGraph
object. If all registered modules, do not make a proposal, the natural
one (the one given by the order of SDocument
s in
SCorpusGraph
) is taken. Note: Currently, this method does
not a real unification, if more than one proposals are given, the first
one is taken.sCorpusGraph
- the SCorpusGraph
for which the list has to be unifiedpublic List<DocumentController> getDocumentControllers()
DocumentControllerImpl
objects
corresponding to each SDocument
belonging to this job.DocumentControllerImpl
spublic String getStatusReport()
getStatusReport
in class PepperJob
protected Collection<org.apache.commons.lang3.tuple.Pair<Step,Collection<String>>> checkReadyToStart()
PepperModule
in all steps, if it is ready to
start, via calling PepperModule.isReadyToStart()
.public Long getProcessingTime()
public void convert()
PepperImporter.importCorpusStructure(SCorpusGraph)
has not
already been called, it will be done.
public void convertFrom()
SaltProject
from any format. For conversion a process
can be modeled, similar to PepperJob.convert()
with the difference, that
no PepperExporter
could be defined. The imported Salt model can
be accessed via PepperJob.getSaltProject()
.convertFrom
in class PepperJob
public void convertTo()
SaltProject
into any format. For conversion, a normal
process could be created, except the use of an importer. Here the
do-nothing importer is used, and it is expected, that the
PepperJob.getSaltProject()
is already 'filled'.public MEMORY_POLICY getMemPolicy()
protected void setMemPolicy(MEMORY_POLICY memPolicy)
memPolicy
- protected void setMaxNumerOfDocuments(int maxNumOfDocuments)
public int getMaxNumberOfDocuments()
SDocument
objects which could be
processed at the same timepublic int getNumOfActiveDocuments()
SDocument
objects which could be
processed at the same timepublic Set<DocumentController> getActiveDocuments()
public boolean getPermissionForProcessDoument(DocumentController controller)
SDocument
or more precisely spoken a
SDocumentGraph
could be woken up or imported. This is the case,
as long as: getNumOfActiveDocuments()
< getMaxNumberOfDocuments()
.
public void releaseDocument(DocumentController controller)
getNumOfActiveDocuments()
).public org.eclipse.emf.common.util.URI save(org.eclipse.emf.common.util.URI uri)
PepperJob.getId()
.pepper is created in
the passed directory.save
in class PepperJob
uri
- The location where to store this job.PepperJob.getId()
).public void clear()
Step
s from all internal lists.public void load(org.eclipse.emf.common.util.URI uri)
PepperJob
and fills this object with
these entries. The current implementation allows xml files following the
workflow description scheme version 1.0 and xmi files following the (old)
PepperParams schema. Only local files are supported. Copyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.