org.cesta.trans
Class AbstractTransformation

java.lang.Object
  extended by org.cesta.trans.AbstractTransformation
All Implemented Interfaces:
Transformation
Direct Known Subclasses:
AbstractRewriteTransformation

public abstract class AbstractTransformation
extends java.lang.Object
implements Transformation

Abstract transformation, which can be base of any transformation. It implements part of the Transformation interface.


Field Summary
protected  java.util.logging.Logger logger
          Default logger for transformation
 
Constructor Summary
AbstractTransformation()
          Default constructor, which initializes logger and default parameters.
 
Method Summary
 void addMappedFile(MappedFile filePair)
          Adds one mapped fileswhich should be transformed
 void clearParams()
          Clears all parameters
abstract  void execute()
          Main logic of transformation.
 java.util.Map<java.lang.String,java.lang.Object> getDefaultParams()
          Returns default parameters
 java.util.List<MappedFile> getMappedFiles()
          Returns list of mapped files, which should be transformed
 java.lang.Object getParam(java.lang.String name)
          Returns previously set parameter with given name
 java.lang.Object getParam(java.lang.String name, java.lang.Object defaultValue)
          Returns previously set parameter with given name
 java.lang.Boolean getParamB(java.lang.String name)
          Helper method for getting Boolean parameters
 java.lang.Boolean getParamB(java.lang.String name, java.lang.Boolean defaultValue)
          Helper method for getting Boolean parameters
 java.util.Map<java.lang.String,java.lang.Object> getParams()
          Returns all set parameters for this transformation
 java.lang.String getParamS(java.lang.String name)
          Helper method for getting String parameters
 java.lang.String getParamS(java.lang.String name, java.lang.String defaultValue)
          Helper method for getting String parameters
 void setMappedFiles(java.util.List<MappedFile> filePairs)
          Sets list of mapped files, which should be transformed
 void setParam(java.lang.String name, java.lang.Object value)
          Sets one single parameter
 void setParams(java.util.Map<java.lang.String,java.lang.Object> params)
          Sets list of parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected java.util.logging.Logger logger
Default logger for transformation

Constructor Detail

AbstractTransformation

public AbstractTransformation()
Default constructor, which initializes logger and default parameters.

Method Detail

getMappedFiles

public java.util.List<MappedFile> getMappedFiles()
Description copied from interface: Transformation
Returns list of mapped files, which should be transformed

Specified by:
getMappedFiles in interface Transformation
Returns:
the files

setMappedFiles

public void setMappedFiles(java.util.List<MappedFile> filePairs)
Description copied from interface: Transformation
Sets list of mapped files, which should be transformed

Specified by:
setMappedFiles in interface Transformation
Parameters:
filePairs - the file pairs to set

addMappedFile

public void addMappedFile(MappedFile filePair)
Description copied from interface: Transformation
Adds one mapped fileswhich should be transformed

Specified by:
addMappedFile in interface Transformation
Parameters:
filePair - the file pair to add

getParams

public java.util.Map<java.lang.String,java.lang.Object> getParams()
Returns all set parameters for this transformation

Specified by:
getParams in interface Transformation
Returns:
collection of parameters

getParam

public java.lang.Object getParam(java.lang.String name)
Returns previously set parameter with given name

Specified by:
getParam in interface Transformation
Parameters:
name - name of parameter
Returns:
parameter or null

getParam

public java.lang.Object getParam(java.lang.String name,
                                 java.lang.Object defaultValue)
Returns previously set parameter with given name

Specified by:
getParam in interface Transformation
Parameters:
name - name of parameter
defaultValue - default value
Returns:
previously set parameter or parameter default value

getParamS

public java.lang.String getParamS(java.lang.String name)
Helper method for getting String parameters


getParamS

public java.lang.String getParamS(java.lang.String name,
                                  java.lang.String defaultValue)
Helper method for getting String parameters


getParamB

public java.lang.Boolean getParamB(java.lang.String name)
Helper method for getting Boolean parameters


getParamB

public java.lang.Boolean getParamB(java.lang.String name,
                                   java.lang.Boolean defaultValue)
Helper method for getting Boolean parameters


setParams

public void setParams(java.util.Map<java.lang.String,java.lang.Object> params)
Sets list of parameters. Previous parameters are not cleared, you can call clearParams() before.

Specified by:
setParams in interface Transformation
Parameters:
params - list of parameters

setParam

public void setParam(java.lang.String name,
                     java.lang.Object value)
Sets one single parameter

Specified by:
setParam in interface Transformation
Parameters:
name - name of parameter
value - value of parameter

clearParams

public void clearParams()
Clears all parameters

Specified by:
clearParams in interface Transformation

getDefaultParams

public java.util.Map<java.lang.String,java.lang.Object> getDefaultParams()
Returns default parameters

Returns:
map of parameters

execute

public abstract void execute()
                      throws TransformationException
Main logic of transformation. Has to be implemented in child class.

Specified by:
execute in interface Transformation
Throws:
TransformationException