## gate.creole
Class AbstractProcessingResource

    java.lang.Object
      |
      +--gate.util.AbstractFeatureBearer
            |
            +--gate.creole.AbstractResource
                  |
                  +--gate.creole.AbstractProcessingResource

All Implemented Interfaces:
  Executable, FeatureBearer, NameBearer, ProcessingResource, Resource, Serializable

Direct Known Subclasses:
  AbstractLanguageAnalyser

public abstract class AbstractProcessingResource
extends AbstractResource
implements ProcessingResource

A convenience implementation of ProcessingResource with some default code.

See Also:
  Serialized Form

Inner Class Summary
`protected class` `AbstractProcessingResource.InternalStatusListener` A simple status listener used to forward the events upstream.
`protected class` `AbstractProcessingResource.IntervalProgressListener` A progress listener used to convert a 0..100 interval into a smaller one

Field Summary
`protected boolean` `interrupted`
`private Vector` `progressListeners` The list of `ProgressListener`s registered with this resource
`private Vector` `statusListeners` The list of `StatusListener`s registered with this resource

Fields inherited from class gate.creole.AbstractResource
`name, serialVersionUID`

Fields inherited from class gate.util.AbstractFeatureBearer
`features`

Constructor Summary
`AbstractProcessingResource()`

Method Summary
`void` `addProgressListener(ProgressListener l)` Adds a `ProgressListener` to the list of listeners for this processing resource.
`void` `addStatusListener(StatusListener l)` Adds a `StatusListener` to the list of listeners for this processing resource
`void` `cleanup()` should clear all internal data of the resource.
`void` `execute()` Run the resource.
`protected void` `fireProcessFinished()` Notifies all the `ProgressListener`s of a progress finished.
`protected void` `fireProgressChanged(int e)` Notifies all the `ProgressListener`s of a progress change event.
`protected void` `fireStatusChanged(String e)` Notifies all the `StatusListener`s of a change of status.
`Resource` `init()` Initialise this resource, and return it.
`void` `interrupt()` Notifies this PR that it should stop its execution as soon as possible.
`boolean` `isInterrupted()` Checks whether this PR has been interrupted since the lsat time its `execute()` method was called.
`void` `reInit()` Reinitialises the processing resource.
`void` `removeProgressListener(ProgressListener l)` Removes a `ProgressListener` from the list of listeners for this processing resource.
`void` `removeStatusListener(StatusListener l)` Removes a `StatusListener` from the list of listeners for this processing resource

Methods inherited from class gate.creole.AbstractResource
`checkParameterValues, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners`

Methods inherited from class gate.util.AbstractFeatureBearer
`getFeatures, setFeatures`

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Methods inherited from interface gate.Resource
`getParameterValue, setParameterValue, setParameterValues`

Methods inherited from interface gate.util.FeatureBearer
`getFeatures, setFeatures`

Methods inherited from interface gate.util.NameBearer
`getName, setName`

Field Detail

### statusListeners

    private transient Vector statusListeners

  The list of `StatusListener`s registered with this resource

### progressListeners

    private transient Vector progressListeners

  The list of `ProgressListener`s registered with this resource

### interrupted

    protected boolean interrupted

Constructor Detail

### AbstractProcessingResource

    public AbstractProcessingResource()

Method Detail

### init

    public Resource init()
                  throws ResourceInstantiationException

  Initialise this resource, and return it.
  Specified by:
    `init` in interface `Resource`
  Overrides:
    `init` in class `AbstractResource`

### execute

    public void execute()
                 throws ExecutionException

  Run the resource. It doesn't make sense not to override this in subclasses so the default implementation signals an exception.
  Specified by:
    `execute` in interface `Executable`

### reInit

    public void reInit()
                throws ResourceInstantiationException

  Reinitialises the processing resource. After calling this method the resource should be in the state it is after calling init. If the resource depends on external resources (such as rules files) then the resource will re-read those resources. If the data used to create the resource has changed since the resource has been created then the resource will change too after calling reInit(). The implementation in this class simply calls `init()`. This functionality must be overriden by derived classes as necessary.
  Specified by:
    `reInit` in interface `ProcessingResource`

### cleanup

    public void cleanup()

  should clear all internal data of the resource. Does nothing now
  Specified by:
    `cleanup` in interface `Resource`
  Overrides:
    `cleanup` in class `AbstractResource`

### isInterrupted

    public boolean isInterrupted()

  Checks whether this PR has been interrupted since the lsat time its `execute()` method was called.
  Specified by:
    `isInterrupted` in interface `ProcessingResource`

### interrupt

    public void interrupt()

  Notifies this PR that it should stop its execution as soon as possible.
  Specified by:
    `interrupt` in interface `ProcessingResource`

### removeStatusListener

    public void removeStatusListener(StatusListener l)

  Removes a `StatusListener` from the list of listeners for this processing resource

### addStatusListener

    public void addStatusListener(StatusListener l)

  Adds a `StatusListener` to the list of listeners for this processing resource

### fireStatusChanged

    protected void fireStatusChanged(String e)

  Notifies all the `StatusListener`s of a change of status.
  Parameters:
    `e` - the message describing the status change

### addProgressListener

    public void addProgressListener(ProgressListener l)

  Adds a `ProgressListener` to the list of listeners for this processing resource.

### removeProgressListener

    public void removeProgressListener(ProgressListener l)

  Removes a `ProgressListener` from the list of listeners for this processing resource.

### fireProgressChanged

    protected void fireProgressChanged(int e)

  Notifies all the `ProgressListener`s of a progress change event.
  Parameters:
    `e` - the new value of execution completion

### fireProcessFinished

    protected void fireProcessFinished()

  Notifies all the `ProgressListener`s of a progress finished.