SMILA 1.0 API documentation

org.eclipse.smila.processing.pipelets
Class ATransformationPipelet

java.lang.Object
  extended by org.eclipse.smila.processing.pipelets.ATransformationPipelet
All Implemented Interfaces:
Pipelet
Direct Known Subclasses:
AXmlTransformationPipelet, CopyPipelet, HtmlToTextPipelet, XmlSplitterPipelet

public abstract class ATransformationPipelet
extends java.lang.Object
implements Pipelet

Abstract base class for transformation pipelets. The general properties are:


Field Summary
protected  AnyMap _config
          the configuration.
protected  Log _log
          local logger.
static java.lang.String ENCODING_ATTACHMENT
          encoding to use for storing results as attachments.
static java.lang.String PROP_INPUT_NAME
          Name of the input Attribute/Attachment.
static java.lang.String PROP_INPUT_TYPE
          The type of the inputName: Attribute/Attachment.
static java.lang.String PROP_OUTPUT_NAME
          Name of the output Attribute/Attachment.
static java.lang.String PROP_OUTPUT_TYPE
          The type of the inputName: Attribute/Attachment.
 
Constructor Summary
ATransformationPipelet()
           
 
Method Summary
 void configure(AnyMap configuration)
          set configuration of pipelet.
 java.lang.String getInputName(ParameterAccessor paramAccessor)
           
 SourceType getInputType(ParameterAccessor paramAccessor)
           
 java.lang.String getOutputName(ParameterAccessor paramAccessor)
           
 SourceType getOutputType(ParameterAccessor paramAccessor)
           
 boolean isReadFromAttribute(SourceType inputType)
          Checks if to read the input from an Attribute.
 boolean isStoreInAttribute(SourceType outputType)
          Checks if to store the output in an Attribute.
protected  byte[] readInput(Blackboard blackboard, java.lang.String id, ParameterAccessor paramAccessor)
          Reads input data from the Blackboard as byte[].
protected  java.lang.String readStringInput(Blackboard blackboard, java.lang.String id, ParameterAccessor paramAccessor)
          Reads input data from the Blackboard as a String.
protected  void storeResult(Blackboard blackboard, java.lang.String id, byte[] bytes, ParameterAccessor paramAccessor)
          Stores result byte[] on the blackboard.
protected  void storeResult(Blackboard blackboard, java.lang.String id, java.lang.String result, ParameterAccessor paramAccessor)
          store result strings on the blackboard.
protected  void storeResults(Blackboard blackboard, java.lang.String id, java.util.Collection<java.lang.String> results, ParameterAccessor paramAccessor)
          store result strings on the blackboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.smila.processing.Pipelet
process
 

Field Detail

PROP_INPUT_TYPE

public static final java.lang.String PROP_INPUT_TYPE
The type of the inputName: Attribute/Attachment.

See Also:
Constant Field Values

PROP_OUTPUT_TYPE

public static final java.lang.String PROP_OUTPUT_TYPE
The type of the inputName: Attribute/Attachment.

See Also:
Constant Field Values

PROP_INPUT_NAME

public static final java.lang.String PROP_INPUT_NAME
Name of the input Attribute/Attachment.

See Also:
Constant Field Values

PROP_OUTPUT_NAME

public static final java.lang.String PROP_OUTPUT_NAME
Name of the output Attribute/Attachment.

See Also:
Constant Field Values

ENCODING_ATTACHMENT

public static final java.lang.String ENCODING_ATTACHMENT
encoding to use for storing results as attachments.

See Also:
Constant Field Values

_log

protected final Log _log
local logger.


_config

protected AnyMap _config
the configuration.

Constructor Detail

ATransformationPipelet

public ATransformationPipelet()
Method Detail

configure

public void configure(AnyMap configuration)
               throws ProcessingException
set configuration of pipelet. called once after instantiation before the pipelet is actually used in a workflow.

Specified by:
configure in interface Pipelet
Parameters:
configuration - configuration of pipelet.
Throws:
ProcessingException - configuration is not applicable for pipelet (missing properties, wrong datatypes)

getInputType

public SourceType getInputType(ParameterAccessor paramAccessor)
                        throws MissingParameterException
Returns:
input type
Throws:
MissingParameterException

getInputName

public java.lang.String getInputName(ParameterAccessor paramAccessor)
                              throws MissingParameterException
Returns:
input name
Throws:
MissingParameterException

getOutputType

public SourceType getOutputType(ParameterAccessor paramAccessor)
                         throws MissingParameterException
Returns:
output type
Throws:
MissingParameterException

getOutputName

public java.lang.String getOutputName(ParameterAccessor paramAccessor)
                               throws MissingParameterException
Returns:
output name
Throws:
MissingParameterException

isReadFromAttribute

public boolean isReadFromAttribute(SourceType inputType)
Checks if to read the input from an Attribute.

Returns:
true if to read the input from an Attribute, false otherwise

isStoreInAttribute

public boolean isStoreInAttribute(SourceType outputType)
Checks if to store the output in an Attribute.

Returns:
true if to store the output in an Attribute, false otherwise

storeResult

protected void storeResult(Blackboard blackboard,
                           java.lang.String id,
                           java.lang.String result,
                           ParameterAccessor paramAccessor)
                    throws ProcessingException
store result strings on the blackboard.

Parameters:
blackboard - blackboard
id - record id
result - result string
Throws:
ProcessingException - error.

storeResults

protected void storeResults(Blackboard blackboard,
                            java.lang.String id,
                            java.util.Collection<java.lang.String> results,
                            ParameterAccessor paramAccessor)
                     throws ProcessingException,
                            BlackboardAccessException
store result strings on the blackboard.

Parameters:
blackboard - blackboard
id - record id
results - result strings
Throws:
ProcessingException - error.
BlackboardAccessException - error.

storeResult

protected void storeResult(Blackboard blackboard,
                           java.lang.String id,
                           byte[] bytes,
                           ParameterAccessor paramAccessor)
                    throws java.lang.Exception
Stores result byte[] on the blackboard.

Parameters:
blackboard - the Blackboard
id - the Id of the record
bytes - the byte[] to save
Throws:
java.lang.Exception - if any error occurs

readInput

protected byte[] readInput(Blackboard blackboard,
                           java.lang.String id,
                           ParameterAccessor paramAccessor)
                    throws BlackboardAccessException,
                           java.io.UnsupportedEncodingException,
                           MissingParameterException
Reads input data from the Blackboard as byte[].

Parameters:
blackboard - the Blackboard
id - the Id of the record
Returns:
a byte[]
Throws:
BlackboardAccessException - if any error occurs
java.io.UnsupportedEncodingException - if converting string to bytes fails
MissingParameterException

readStringInput

protected java.lang.String readStringInput(Blackboard blackboard,
                                           java.lang.String id,
                                           ParameterAccessor paramAccessor)
                                    throws BlackboardAccessException,
                                           java.io.UnsupportedEncodingException,
                                           MissingParameterException
Reads input data from the Blackboard as a String.

Parameters:
blackboard - the Blackboard
id - the Id of the record
Returns:
a String
Throws:
BlackboardAccessException - if any error occurs
java.io.UnsupportedEncodingException - if converting bytes to string fails
MissingParameterException

SMILA 1.0 API documentation