uk.ac.starlink.ttools.task
Class ConsumerTask

java.lang.Object
  extended by uk.ac.starlink.ttools.task.ConsumerTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
MapperTask, RegQuery, SingleMapperTask, TableLoop, TapResume

public abstract class ConsumerTask
extends Object
implements Task

Abstract task which takes an input table and disposes of it. Concrete subclasses must supply the table.

Since:
29 Aug 2005
Author:
Mark Taylor

Constructor Summary
ConsumerTask(String purpose, ProcessingMode outMode, boolean useOutFilter)
          Constructor.
 
Method Summary
 Executable createExecutable(Environment env)
          Creates an executable object which will do the work of this task in the given Environment.
abstract  TableProducer createProducer(Environment env)
          Returns an object which can produce the effective output table which will be consumed by this task.
static TableProducer createProducer(Environment env, FilterParameter filterParam, InputTableParameter inParam)
          Constructs a table producer given an input parameter and an input filter parameter.
 ProcessingMode getOutputMode()
          Returns this task's output mode.
protected  List getParameterList()
          Returns the parameter list for this task; it may be modified.
 Parameter[] getParameters()
          Returns the list of parameters which may be used by this task.
 String getPurpose()
          Returns a short (one-line) description of the purpose of this task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerTask

public ConsumerTask(String purpose,
                    ProcessingMode outMode,
                    boolean useOutFilter)
Constructor.

Parameters:
purpose - one-line description of the task
outMode - processing mode which determines the destination of the processed table
useOutFilter - allow specification of filters for output table
Method Detail

getPurpose

public String getPurpose()
Description copied from interface: Task
Returns a short (one-line) description of the purpose of this task.

Specified by:
getPurpose in interface Task
Returns:
plain text description of this task's purpose

getParameters

public Parameter[] getParameters()
Description copied from interface: Task
Returns the list of parameters which may be used by this task.

Specified by:
getParameters in interface Task
Returns:
an array of the Parameter objects this task may request values for during its invocation

getParameterList

protected List getParameterList()
Returns the parameter list for this task; it may be modified.

Returns:
parameter list

createProducer

public abstract TableProducer createProducer(Environment env)
                                      throws TaskException
Returns an object which can produce the effective output table which will be consumed by this task.

Parameters:
env - execution environment
Returns:
table producer
Throws:
TaskException

createExecutable

public Executable createExecutable(Environment env)
                            throws TaskException
Description copied from interface: Task
Creates an executable object which will do the work of this task in the given Environment. This method should do all of the parameter processing and prepare an object which just executes. The idea is that any communication with the user related to the supplied parameter values can be done before the task starts to execute in earnest. Consequently, the returned Executable object ought not to make any reference to env, though this is not absolutely prohibited.

Specified by:
createExecutable in interface Task
Parameters:
env - the environment in which the task will operate
Throws:
TaskException - if no executable can be created; this should usually be a UsageException or some subclass

getOutputMode

public ProcessingMode getOutputMode()
Returns this task's output mode.

Returns:
output mode

createProducer

public static TableProducer createProducer(Environment env,
                                           FilterParameter filterParam,
                                           InputTableParameter inParam)
                                    throws TaskException
Constructs a table producer given an input parameter and an input filter parameter. Tables which are generated by equal input parameters will evaluate as equal in the sense of Object.equals().

Parameters:
env - execution environment
filterParam - parameter giving filter steps (or null)
inParam - parameter giving input table
Returns:
table producer, or null if the table input parameter has a (permitted) blank value
Throws:
TaskException


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.