net.sf.okapi.common.pipeline
Class BasePipelineStep

java.lang.Object
  extended by net.sf.okapi.common.pipeline.BasePipelineStep
All Implemented Interfaces:
IPipelineStep

public abstract class BasePipelineStep
extends java.lang.Object
implements IPipelineStep

Abstract implementation of the IPipelineStep interface.


Constructor Summary
BasePipelineStep()
           
 
Method Summary
 void cancel()
          Cancel processing on this pipeline.
 void destroy()
          Executes any cleanup code for this step.
 java.lang.String getHelpLocation()
          Gets the relative directory location for the help of this step.
 IParameters getParameters()
          Gets the current parameters for this step.
protected  Event handleCustom(Event event)
          Handles the EventType.CUSTOM event.
protected  Event handleDocumentPart(Event event)
          Handles the EventType.DOCUMENT_PART event.
protected  Event handleEndBatch(Event event)
          Handles the EventType.END_BATCH event.
protected  Event handleEndBatchItem(Event event)
          Handles the EventType.END_BATCH_ITEM event.
protected  Event handleEndDocument(Event event)
          Handles the EventType.END_DOCUMENT event.
protected  Event handleEndGroup(Event event)
          Handles the EventType.END_GROUP event.
protected  Event handleEndSubDocument(Event event)
          Handles the EventType.END_SUBDOCUMENT event.
 Event handleEvent(Event event)
          Processes each event sent though the pipeline.
protected  Event handleMultiEvent(Event event)
          Handles the EventType.MULTI_EVENT event.
protected  Event handlePipelineParameters(Event event)
          Handles the EventType.PIPELINE_PARAMETERS event.
protected  Event handleRawDocument(Event event)
          Handles the EventType.RAW_DOCUMENT event.
protected  Event handleStartBatch(Event event)
          Handles the EventType.START_BATCH event.
protected  Event handleStartBatchItem(Event event)
          Handles the EventType.START_BATCH_ITEM event.
protected  Event handleStartDocument(Event event)
          Handles the EventType.START_DOCUMENT event.
protected  Event handleStartGroup(Event event)
          Handles the EventType.START_GROUP event.
protected  Event handleStartSubDocument(Event event)
          Handles the EventType.START_SUBDOCUMENT event.
protected  Event handleTextUnit(Event event)
          Handles the EventType.TEXT_UNIT event.
 boolean isDone()
          Steps that can generate Events such as IFilters return false until no more events can be created.
 boolean isLastOutputStep()
          Is this step the last step with output in the pipeline?
 void setLastOutputStep(boolean isLastStep)
          Tell the step if it is the last one on the pipeline with output.
 void setParameters(IParameters params)
          Sets new parameters for this step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.okapi.common.pipeline.IPipelineStep
getDescription, getName
 

Constructor Detail

BasePipelineStep

public BasePipelineStep()
Method Detail

getParameters

public IParameters getParameters()
Description copied from interface: IPipelineStep
Gets the current parameters for this step.

Specified by:
getParameters in interface IPipelineStep
Returns:
the current parameters for this step or null if there are no parameters.

setParameters

public void setParameters(IParameters params)
Description copied from interface: IPipelineStep
Sets new parameters for this step.

Specified by:
setParameters in interface IPipelineStep
Parameters:
params - the new parameters to use.

isDone

public boolean isDone()
Description copied from interface: IPipelineStep
Steps that can generate Events such as IFilters return false until no more events can be created. Steps which do not create Events always return true.

Specified by:
isDone in interface IPipelineStep
Returns:
false if can generate more events, true otherwise.

getHelpLocation

public java.lang.String getHelpLocation()
Description copied from interface: IPipelineStep
Gets the relative directory location for the help of this step. The main help file for the step must be at that location and its name must be the name of the class implementing the step in lowercase with a .html extension.

Specified by:
getHelpLocation in interface IPipelineStep
Returns:
the relative directory location for the help of this step.

handleEvent

public Event handleEvent(Event event)
Description copied from interface: IPipelineStep
Processes each event sent though the pipeline.

Specified by:
handleEvent in interface IPipelineStep
Parameters:
event - the event to process.
Returns:
the event to pass down the pipeline.

cancel

public void cancel()
Description copied from interface: IPipelineStep
Cancel processing on this pipeline. Each IPipelineStep is responsible to implement a cancel method that will interrupt long running operations

Specified by:
cancel in interface IPipelineStep

destroy

public void destroy()
Description copied from interface: IPipelineStep
Executes any cleanup code for this step. Called once at the end of the pipeline lifecycle.

Specified by:
destroy in interface IPipelineStep

isLastOutputStep

public boolean isLastOutputStep()
Description copied from interface: IPipelineStep
Is this step the last step with output in the pipeline?

Specified by:
isLastOutputStep in interface IPipelineStep
Returns:
true if last step with output, false otherwise.

setLastOutputStep

public void setLastOutputStep(boolean isLastStep)
Description copied from interface: IPipelineStep
Tell the step if it is the last one on the pipeline with output.

Specified by:
setLastOutputStep in interface IPipelineStep
Parameters:
isLastStep - true if last step with output, false otherwise.

handleStartBatch

protected Event handleStartBatch(Event event)
Handles the EventType.START_BATCH event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleEndBatch

protected Event handleEndBatch(Event event)
Handles the EventType.END_BATCH event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleStartBatchItem

protected Event handleStartBatchItem(Event event)
Handles the EventType.START_BATCH_ITEM event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleEndBatchItem

protected Event handleEndBatchItem(Event event)
Handles the EventType.END_BATCH_ITEM event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleRawDocument

protected Event handleRawDocument(Event event)
Handles the EventType.RAW_DOCUMENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleStartDocument

protected Event handleStartDocument(Event event)
Handles the EventType.START_DOCUMENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleEndDocument

protected Event handleEndDocument(Event event)
Handles the EventType.END_DOCUMENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleStartSubDocument

protected Event handleStartSubDocument(Event event)
Handles the EventType.START_SUBDOCUMENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleEndSubDocument

protected Event handleEndSubDocument(Event event)
Handles the EventType.END_SUBDOCUMENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleStartGroup

protected Event handleStartGroup(Event event)
Handles the EventType.START_GROUP event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleEndGroup

protected Event handleEndGroup(Event event)
Handles the EventType.END_GROUP event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleTextUnit

protected Event handleTextUnit(Event event)
Handles the EventType.TEXT_UNIT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleDocumentPart

protected Event handleDocumentPart(Event event)
Handles the EventType.DOCUMENT_PART event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleCustom

protected Event handleCustom(Event event)
Handles the EventType.CUSTOM event.

Parameters:
event - event to handle.
Returns:
the event returned.

handleMultiEvent

protected Event handleMultiEvent(Event event)
Handles the EventType.MULTI_EVENT event.

Parameters:
event - event to handle.
Returns:
the event returned.

handlePipelineParameters

protected Event handlePipelineParameters(Event event)
Handles the EventType.PIPELINE_PARAMETERS event. This method relies on the configuration parameters set in each step to set the corresponding values.

Parameters:
event - event to handle.
Returns:
the event returned.