net.sf.pipet.api
Class SimpleInputOutputModule

java.lang.Object
  extended by net.sf.pipet.api.AbstractModule
      extended by net.sf.pipet.api.VersionedModule
          extended by net.sf.pipet.api.DefaultModuleInterface
              extended by net.sf.pipet.api.SimpleInputOutputModule
All Implemented Interfaces:
ModuleInterface
Direct Known Subclasses:
InputOutputModule

public abstract class SimpleInputOutputModule
extends DefaultModuleInterface

Abstract base class for a PipeT module. Subclasses must provide a title and a description via the constructor, and implement run(java.io.InputStream[], java.io.OutputStream, net.sf.pipet.api.ModuleAttributes, net.sf.qxs.messenger.Messenger).

Since:
1.2.13

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.pipet.api.ModuleInterface
ModuleInterface.ModuleConfigurator, ModuleInterface.ModuleInstance
 
Field Summary
protected static String INPUT_NAME
           
protected static String OUTPUT_NAME
           
 
Fields inherited from interface net.sf.pipet.api.ModuleInterface
ATT_PIPELINE_NAME, FAIL_CONFIGURATOR, UI_GUI, UI_NONINTERACTIVE
 
Constructor Summary
SimpleInputOutputModule(String title, String description)
          Constructs a module with default input and output types.
SimpleInputOutputModule(String title, String description, String input_type, String output_type)
          Constructs a module.
 
Method Summary
 ModuleInterface.ModuleInstance createInstance(ModuleData data, net.sf.qxs.messenger.Messenger logger)
          Instantiates a module to be part of a pipeline instance.
 String getDescription(ModuleAttributes atts)
          Returns a description of the module.
 Map<String,String> getInputPipeTypes(ModuleAttributes atts)
          Returns an empty set.
protected  String getInputType()
           
 Map<String,String> getOutputPipeTypes(ModuleAttributes atts)
          Returns an empty set.
protected  String getOutputType()
           
 String getTitle(ModuleAttributes atts)
          Returns the title (a short description) of the module.
abstract  boolean run(InputStream[] is, OutputStream os, ModuleAttributes atts, net.sf.qxs.messenger.Messenger messenger)
          Runs the module in a pipeline.
 
Methods inherited from class net.sf.pipet.api.DefaultModuleInterface
getInstallationConfigurator, getPipelineConfigurator, getRuntimeConfigurator
 
Methods inherited from class net.sf.pipet.api.VersionedModule
getAPIVersionString
 
Methods inherited from class net.sf.pipet.api.AbstractModule
getGlobalParameters, getInputPipeNames, getLeftOver, getOutputPipeNames, getPipelineParameters, getPipeTypes, getRuntimeParameters, isAvailable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_NAME

protected static final String INPUT_NAME
See Also:
Constant Field Values

OUTPUT_NAME

protected static final String OUTPUT_NAME
See Also:
Constant Field Values
Constructor Detail

SimpleInputOutputModule

public SimpleInputOutputModule(String title,
                               String description)
Constructs a module with default input and output types.

Parameters:
title -
description -

SimpleInputOutputModule

public SimpleInputOutputModule(String title,
                               String description,
                               String input_type,
                               String output_type)
Constructs a module.

Parameters:
title -
description -
input_type - the content type of the module's input, or null if no input is accepted.
output_type - the content type of the module's output, or null if no output is accepted.
Method Detail

getInputType

protected String getInputType()

getOutputType

protected String getOutputType()

getTitle

public String getTitle(ModuleAttributes atts)
Description copied from interface: ModuleInterface
Returns the title (a short description) of the module.

Specified by:
getTitle in interface ModuleInterface
Overrides:
getTitle in class AbstractModule
Parameters:
atts - The module data.

getDescription

public String getDescription(ModuleAttributes atts)
Description copied from interface: ModuleInterface
Returns a description of the module.

Parameters:
atts - The module data.

createInstance

public ModuleInterface.ModuleInstance createInstance(ModuleData data,
                                                     net.sf.qxs.messenger.Messenger logger)
                                              throws Exception
Description copied from interface: ModuleInterface
Instantiates a module to be part of a pipeline instance.

Parameters:
data - an object which provides access to runtime data needed by the module.
logger - a logging interface.
Returns:
a module instance, or null if the module cannot be instantiated with the given configuration.
Throws:
Exception - if an unexpected error occurred.

getInputPipeTypes

public Map<String,String> getInputPipeTypes(ModuleAttributes atts)
Description copied from class: DefaultModuleInterface
Returns an empty set.

Specified by:
getInputPipeTypes in interface ModuleInterface
Overrides:
getInputPipeTypes in class DefaultModuleInterface
Parameters:
atts - The module data.

getOutputPipeTypes

public Map<String,String> getOutputPipeTypes(ModuleAttributes atts)
Description copied from class: DefaultModuleInterface
Returns an empty set.

Specified by:
getOutputPipeTypes in interface ModuleInterface
Overrides:
getOutputPipeTypes in class DefaultModuleInterface
Parameters:
atts - The module attributes.

run

public abstract boolean run(InputStream[] is,
                            OutputStream os,
                            ModuleAttributes atts,
                            net.sf.qxs.messenger.Messenger messenger)
Runs the module in a pipeline.

Parameters:
is - the module's input.
os - the module's output.
atts - parameters for the module.
messenger - a Messenger object for sending messages back to the user.
Returns:
true if the module completed successfully; false otherwise.


Copyright © 2012 VU University Amsterdam. All Rights Reserved.