@CreoleResource(name="Conditional Corpus Pipeline", comment="A serial controller for conditionally run PR pipelines over corpora.", helpURL="http://gate.ac.uk/userguide/sec:developer:cond") public class ConditionalSerialAnalyserController extends ConditionalSerialController implements CorpusController, LanguageAnalyser, ControllerAwarePR
LanguageAnalyser
s.
It has a Corpus
and its execute method runs all the analysers in
turn over each of the documents in the corpus.
This is a copy of the SerialAnalyserController
, the only difference
being that it inherits from ConditionalSerialController
rather than
from SerialController
which makes it a conditional serial
analyser controller.
NOTE: if at the time when execute() is invoked, the document is not null, it is assumed that this controller is invoked from another controller and only this document is processed while the corpus (which must still be non-null) is ignored. Also, if the document is not null, the CorpusAwarePRs are not notified at the beginning, end, or abnormal termination of the pipeline.
If the document is null, all documents in the corpus are processed in sequence and CorpusAwarePRs are notified before the processing of the documents and after all documents have been processed or an abnormal termination occurred.
AbstractController.InternalStatusListener, AbstractController.IntervalProgressListener
Modifier and Type | Field and Description |
---|---|
protected Corpus |
corpus |
protected Document |
document
The document being processed.
|
protected boolean |
runningAsSubPipeline |
strategiesList
log, prList, prof, prTimeMap, sListener, timeMap
benchmarkFeatures, benchmarkID, controllerCallbacksEnabled, interrupted
name
features
Constructor and Description |
---|
ConditionalSerialAnalyserController() |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
ProcessingResource pr)
Overidden from
SerialController to only allow
LanguageAnalyser s as components. |
void |
add(ProcessingResource pr)
Overidden from
SerialController to only allow
LanguageAnalyser s as components. |
protected void |
checkLanguageAnalyser(ProcessingResource pr)
Throw an exception if the given processing resource is not
a LanguageAnalyser.
|
void |
controllerExecutionAborted(Controller c,
Throwable t)
Called by a controller containing this PR when the controller's
execution has been aborted by an exception thrown by one of the
contained PR's
execute methods, or by the controller
itself. |
void |
controllerExecutionFinished(Controller c)
Called by a controller containing this PR when the controller's
execution has completed successfully.
|
void |
controllerExecutionStarted(Controller c)
Called by a controller containing this PR when the controller
begins executing.
|
void |
execute()
Execute this controller.
|
protected void |
executeImpl()
Run the Processing Resources in sequence.
|
Corpus |
getCorpus()
Returns the
Corpus used by this
controller. |
Document |
getDocument()
Get the document property for this analyser.
|
List<ProcessingResource> |
getOffendingPocessingResources()
Checks whether all the contained PRs have all the required runtime
parameters set.
|
void |
invokeControllerExecutionAborted(Throwable thrown)
Invoke the controllerExecutionAborted method on this controller and all nested PRs and controllers.
|
void |
invokeControllerExecutionFinished()
Invoke the controllerExecutionFinished method on this controller and all nested PRs and controllers.
|
void |
invokeControllerExecutionStarted()
Invoke the controllerExecutionStarted method on this controller and all nested PRs and controllers.
|
void |
resourceUnloaded(CreoleEvent e)
Overridden to also clean up the corpus value.
|
void |
setCorpus(Corpus corpus)
Sets the
Corpus which contains the data on which
the controller is going to run. |
protected void |
setDocToPrs(Document doc)
Sets the current document to the memeber PRs
|
void |
setDocument(Document document)
Set the document property for this analyser.
|
cleanup, duplicate, getRunningStrategies, remove, remove, runComponent, setRunningStrategies, setRunningStrategy
checkParameters, datastoreClosed, datastoreCreated, datastoreOpened, getPRs, getPrTimeMap, resetPrTimeMap, resourceLoaded, resourceRenamed, set, setPRs
addControllerListener, addProgressListener, addStatusListener, fireProcessFinished, fireProgressChanged, fireResourceAdded, fireResourceRemoved, fireStatusChanged, getBenchmarkId, getControllerAwarePRs, init, interrupt, isInterrupted, reInit, removeControllerListener, removeProgressListener, removeStatusListener, setBenchmarkId, setControllerCallbacksEnabled
checkParameterValues, flushBeanInfoCache, forgetBeanInfo, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners, toString
getFeatures, setFeatures
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPRs, setPRs
reInit
cleanup, getParameterValue, init, setParameterValue, setParameterValues
getFeatures, setFeatures
getName, setName
interrupt, isInterrupted
protected boolean runningAsSubPipeline
protected Corpus corpus
protected Document document
LanguageAnalyser
interface, so this value is only used when the controller is used as a
member of another controller.public Document getDocument()
LanguageAnalyser
getDocument
in interface LanguageAnalyser
@Optional @RunTime @CreoleParameter public void setDocument(Document document)
LanguageAnalyser
setDocument
in interface LanguageAnalyser
document
- the document to setpublic Corpus getCorpus()
CorpusController
Corpus
used by this
controller.getCorpus
in interface CorpusController
getCorpus
in interface LanguageAnalyser
public void setCorpus(Corpus corpus)
CorpusController
Corpus
which contains the data on which
the controller is going to run.setCorpus
in interface CorpusController
setCorpus
in interface LanguageAnalyser
public void execute() throws ExecutionException
AbstractController
ControllerAwarePR
s of the start and end of execution, and
delegates to the AbstractController.executeImpl()
method to do the real work.
Subclasses should override AbstractController.executeImpl()
rather than this method.execute
in interface Controller
execute
in interface Executable
execute
in class AbstractController
ExecutionException
protected void executeImpl() throws ExecutionException
executeImpl
in class SerialController
ExecutionException
public void add(ProcessingResource pr)
SerialController
to only allow
LanguageAnalyser
s as components.add
in class ConditionalSerialController
pr
- the PR to be added.public void add(int index, ProcessingResource pr)
SerialController
to only allow
LanguageAnalyser
s as components.add
in class ConditionalSerialController
index
- the position for the PRpr
- the PR to be set.protected void checkLanguageAnalyser(ProcessingResource pr)
protected void setDocToPrs(Document doc)
public List<ProcessingResource> getOffendingPocessingResources() throws ResourceInstantiationException
getOffendingPocessingResources
in class AbstractController
List
of ProcessingResource
s that have required
parameters with null values if they exist null otherwise.ResourceInstantiationException
- if problems occur while
inspecting the parameters for one of the resources. These will normally be
introspection problems and are usually caused by the lack of a parameter
or of the read accessor for a parameter.public void resourceUnloaded(CreoleEvent e)
resourceUnloaded
in interface CreoleListener
resourceUnloaded
in class SerialController
public void controllerExecutionStarted(Controller c) throws ExecutionException
ControllerAwarePR
execute
d on this run.controllerExecutionStarted
in interface ControllerAwarePR
c
- the Controller
that is executing.ExecutionException
- if an error occurs that requires the
controller to abort its execution.public void controllerExecutionFinished(Controller c) throws ExecutionException
ControllerAwarePR
execute
method of any of this controller's PRs in
this run.controllerExecutionFinished
in interface ControllerAwarePR
c
- the Controller
that is executing.ExecutionException
- if an error occurs that requires the
controller to abort its execution.public void controllerExecutionAborted(Controller c, Throwable t) throws ExecutionException
ControllerAwarePR
execute
methods, or by the controller
itself. When this method is called, it is guaranteed that there
will be no more calls to the execute
method of any
of this controller's PRs in this run.controllerExecutionAborted
in interface ControllerAwarePR
c
- the Controller
that is executing.t
- the Throwable
that caused the controller to
abort. This will be either an ExecutionException
,
a RuntimeException
or an Error
.ExecutionException
- if an error occurs in this method that
requires the controller to abort its execution. This
method should not rethrow t
, as the
controller will do this after informing any other
ControllerAware
PRs it contains.public void invokeControllerExecutionStarted() throws ExecutionException
invokeControllerExecutionStarted
in class AbstractController
ExecutionException
public void invokeControllerExecutionFinished() throws ExecutionException
invokeControllerExecutionFinished
in class AbstractController
ExecutionException
public void invokeControllerExecutionAborted(Throwable thrown) throws ExecutionException
invokeControllerExecutionAborted
in class AbstractController
thrown
- The Throwable to pass on to the controller callback method.ExecutionException
Copyright © 2024 GATE. All rights reserved.