gate.creole
Class SerialController

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractController
              extended by gate.creole.SerialController
All Implemented Interfaces:
Controller, CustomDuplication, CreoleListener, Executable, ProcessingResource, Resource, Benchmarkable, FeatureBearer, NameBearer, Serializable, EventListener
Direct Known Subclasses:
ConditionalSerialController, SerialAnalyserController

@CreoleResource(name="Pipeline",
                comment="A simple serial controller for PR pipelines.",
                helpURL="http://gate.ac.uk/userguide/sec:developer:apps")
public class SerialController
extends AbstractController
implements CreoleListener, CustomDuplication

Execute a list of PRs serially.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gate.creole.AbstractController
AbstractController.InternalStatusListener, AbstractController.IntervalProgressListener
 
Field Summary
protected static org.apache.log4j.Logger log
           
protected  List prList
          The list of contained PRs
protected  Profiler prof
          Profiler to track PR execute time
protected  HashMap<String,Long> prTimeMap
           
protected  StatusListener sListener
          A proxy for status events
protected  HashMap timeMap
           
 
Fields inherited from class gate.creole.AbstractController
benchmarkFeatures, benchmarkID, interrupted, name
 
Fields inherited from class gate.creole.AbstractResource
serialVersionUID
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
SerialController()
           
 
Method Summary
 void add(int index, ProcessingResource pr)
           
 void add(ProcessingResource pr)
           
protected  void checkParameters()
          Verifies that all PRs have all their required rutime parameters set.
 void cleanup()
          Cleans the internal data and prepares this object to be collected
 void datastoreClosed(CreoleEvent e)
          Called when a DataStore has been closed
 void datastoreCreated(CreoleEvent e)
          Called when a DataStore has been created
 void datastoreOpened(CreoleEvent e)
          Called when a DataStore has been opened
 Resource duplicate(Factory.DuplicationContext ctx)
          Duplicate this controller.
protected  void executeImpl()
          Run the Processing Resources in sequence.
 Collection getPRs()
          Returns all the ProcessingResources contained by thisFeature controller as an unmodifiable list.
 HashMap<String,Long> getPrTimeMap()
          Returns the HashMap that lists the total time taken by each PR
 ProcessingResource remove(int index)
           
 boolean remove(ProcessingResource pr)
           
 void resetPrTimeMap()
          Resets the Time taken by various PRs
 void resourceLoaded(CreoleEvent e)
          Called when a new Resource has been loaded into the system
 void resourceRenamed(Resource resource, String oldName, String newName)
          Called when the creole register has renamed a resource.1
 void resourceUnloaded(CreoleEvent e)
          Called when a Resource has been removed from the system
protected  void runComponent(int componentIndex)
          Executes a ProcessingResource.
 ProcessingResource set(int index, ProcessingResource pr)
           
 void setPRs(Collection prs)
          Populates this controller from a collection of ProcessingResources (optional operation).
 
Methods inherited from class gate.creole.AbstractController
addControllerListener, addProgressListener, addStatusListener, execute, fireProcessFinished, fireProgressChanged, fireResourceAdded, fireResourceRemoved, fireStatusChanged, getBenchmarkId, getControllerAwarePRs, getName, getOffendingPocessingResources, init, interrupt, isInterrupted, reInit, removeControllerListener, removeProgressListener, removeStatusListener, setBenchmarkId, setName
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getParameterValue, getParameterValue, removeResourceListeners, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 

Field Detail

log

protected static final org.apache.log4j.Logger log

prof

protected Profiler prof
Profiler to track PR execute time


timeMap

protected HashMap timeMap

prTimeMap

protected HashMap<String,Long> prTimeMap

prList

protected List prList
The list of contained PRs


sListener

protected StatusListener sListener
A proxy for status events

Constructor Detail

SerialController

public SerialController()
Method Detail

getPRs

public Collection getPRs()
Returns all the ProcessingResources contained by thisFeature controller as an unmodifiable list.

Specified by:
getPRs in interface Controller

setPRs

public void setPRs(Collection prs)
Populates this controller from a collection of ProcessingResources (optional operation). Controllers that are serializable must implement this method needed by GATE to restore the contents of the controllers.

Specified by:
setPRs in interface Controller
Overrides:
setPRs in class AbstractController
Throws:
UnsupportedOperationException - if the setPRs method is not supported by this controller.

add

public void add(int index,
                ProcessingResource pr)

add

public void add(ProcessingResource pr)

remove

public ProcessingResource remove(int index)

remove

public boolean remove(ProcessingResource pr)

set

public ProcessingResource set(int index,
                              ProcessingResource pr)

checkParameters

protected void checkParameters()
                        throws ExecutionException
Verifies that all PRs have all their required rutime parameters set.

Throws:
ExecutionException

executeImpl

protected void executeImpl()
                    throws ExecutionException
Run the Processing Resources in sequence.

Overrides:
executeImpl in class AbstractController
Throws:
ExecutionException

resetPrTimeMap

public void resetPrTimeMap()
Resets the Time taken by various PRs


getPrTimeMap

public HashMap<String,Long> getPrTimeMap()
Returns the HashMap that lists the total time taken by each PR

Returns:

runComponent

protected void runComponent(int componentIndex)
                     throws ExecutionException
Executes a ProcessingResource.

Throws:
ExecutionException

cleanup

public void cleanup()
Cleans the internal data and prepares this object to be collected

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class AbstractController

duplicate

public Resource duplicate(Factory.DuplicationContext ctx)
                   throws ResourceInstantiationException
Duplicate this controller. We perform a default duplication of the controller itself, then recursively duplicate its contained PRs and add these duplicates to the copy.

Specified by:
duplicate in interface CustomDuplication
Parameters:
ctx - the current duplication context. If an implementation of this method needs to duplicate any other resources as part of the custom duplication process it should pass this context back to the two-argument form of Factory.duplicate rather than using the single-argument form.
Returns:
an independent copy of this resource.
Throws:
ResourceInstantiationException

resourceLoaded

public void resourceLoaded(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a new Resource has been loaded into the system

Specified by:
resourceLoaded in interface CreoleListener

resourceUnloaded

public void resourceUnloaded(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a Resource has been removed from the system

Specified by:
resourceUnloaded in interface CreoleListener

resourceRenamed

public void resourceRenamed(Resource resource,
                            String oldName,
                            String newName)
Description copied from interface: CreoleListener
Called when the creole register has renamed a resource.1

Specified by:
resourceRenamed in interface CreoleListener

datastoreOpened

public void datastoreOpened(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a DataStore has been opened

Specified by:
datastoreOpened in interface CreoleListener

datastoreCreated

public void datastoreCreated(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a DataStore has been created

Specified by:
datastoreCreated in interface CreoleListener

datastoreClosed

public void datastoreClosed(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a DataStore has been closed

Specified by:
datastoreClosed in interface CreoleListener