org.gcube.datatransformation.datatransformationlibrary.model
Class TransformationUnit

java.lang.Object
  extended by org.gcube.datatransformation.datatransformationlibrary.model.TransformationUnit

public class TransformationUnit
extends Object

Author:
Dimitris Katris, NKUA

Each transformation unit describes the way a program can be used in order to perform a transformation from a source to a target content type. The program is the one that the transformation program, in which the transformation unit belongs to, references. The transformation unit determines the behaviour of each program by passing to it the proper program parameters.

Transformation units may reference other (external) transformation units and use them as �black-box� components in the transformation process. Each transformation unit is identified by the pair (transformation program id, transformation unit id).


Constructor Summary
TransformationUnit()
           
 
Method Summary
 void addBridge(String id)
          Adds a new data bridge to this TU.
 void bindHandler(String id, DataHandler handler)
          Binds an id of a data handler with a data handler instance.
 boolean containsHandler(String id)
          Checks if a handler with id id is contained in this TU.
 void fromDOM(Element transformation)
           
 DataHandler getDataHandler(String id)
          Returns the instance of a data handler by its id.
 ArrayList<ExtTransformationUnit> getExtTransformationList()
          Returns the references to external TUs.
 String getId()
          Returns the id of the transformation unit.
 ArrayList<HandlerDesc> getIOs()
          Returns all the handler descriptions of this TU.
 ArrayList<Parameter> getProgramParameters()
          Returns the program parameters.
 ArrayList<Source> getSources()
          Returns the sources of the transformation unit.
 Target getTarget()
          Returns the target of the transformation unit.
 TransformationProgram getTransformationProgram()
          Returns the transformation program in which this TU is contained.
 boolean isComposite()
           
 List<Parameter> mergeProgramParameters()
          Merges the global and the program parameters contained in a TransformationUnit into one List.
 void setComposite(boolean isComposite)
           
 void setExtTransformationList(ArrayList<ExtTransformationUnit> extTransformationList)
          Sets the references to external TUs.
 void setId(String id)
          Sets the id of the transformation unit.
 void setProgramParameters(ArrayList<Parameter> programParameters)
          Sets the program parameters.
 void setSources(ArrayList<Source> sources)
          Sets the sources of the transformation unit.
 void setTarget(Target target)
          Sets the target of the transformation unit.
 void setTransformationProgram(TransformationProgram transformationProgram)
          Sets the transformation program in which this TU is contained.
 void toDOM(Element tp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformationUnit

public TransformationUnit()
Method Detail

getProgramParameters

public ArrayList<Parameter> getProgramParameters()
Returns the program parameters.

Returns:
the program parameters.

setProgramParameters

public void setProgramParameters(ArrayList<Parameter> programParameters)
Sets the program parameters.

Parameters:
programParameters - the program parameters.

fromDOM

public void fromDOM(Element transformation)

toDOM

public void toDOM(Element tp)

getExtTransformationList

public ArrayList<ExtTransformationUnit> getExtTransformationList()
Returns the references to external TUs.

Returns:
the references to external TUs.

setExtTransformationList

public void setExtTransformationList(ArrayList<ExtTransformationUnit> extTransformationList)
Sets the references to external TUs.

Parameters:
extTransformationList - the references to external TUs.

getId

public String getId()
Returns the id of the transformation unit.

Returns:
The id of the transformation unit.

setId

public void setId(String id)
Sets the id of the transformation unit.

Parameters:
id - The id of the transformation unit.

isComposite

public boolean isComposite()
Returns:
true if the TU is composite.

setComposite

public void setComposite(boolean isComposite)
Parameters:
isComposite - if the TU is composite.

getSources

public ArrayList<Source> getSources()
Returns the sources of the transformation unit.

Returns:
the sources of the transformation unit.

setSources

public void setSources(ArrayList<Source> sources)
Sets the sources of the transformation unit.

Parameters:
sources - the sources of the transformation unit.

getTarget

public Target getTarget()
Returns the target of the transformation unit.

Returns:
the target of the transformation unit.

setTarget

public void setTarget(Target target)
Sets the target of the transformation unit.

Parameters:
target - the target of the transformation unit.

getTransformationProgram

public TransformationProgram getTransformationProgram()
Returns the transformation program in which this TU is contained.

Returns:
the transformation program in which this TU is contained.

setTransformationProgram

public void setTransformationProgram(TransformationProgram transformationProgram)
Sets the transformation program in which this TU is contained.

Parameters:
transformationProgram - the transformation program in which this TU is contained.

getIOs

public ArrayList<HandlerDesc> getIOs()
Returns all the handler descriptions of this TU.

Returns:
the handler descriptions of this TU.

addBridge

public void addBridge(String id)
Adds a new data bridge to this TU.

Parameters:
id - The id of this bridge.

containsHandler

public boolean containsHandler(String id)
Checks if a handler with id id is contained in this TU.

Parameters:
id - The id to be checked.
Returns:
True if a handler with id id is contained in this TU.

bindHandler

public void bindHandler(String id,
                        DataHandler handler)
                 throws Exception
Binds an id of a data handler with a data handler instance.

Parameters:
id - The id of the handler.
handler - The data handler instance.
Throws:
Exception - If the id already exists.

getDataHandler

public DataHandler getDataHandler(String id)
                           throws Exception
Returns the instance of a data handler by its id.

Parameters:
id - The id of the handler.
Returns:
The data handler instance.
Throws:
Exception - If the handler could not be found.

mergeProgramParameters

public List<Parameter> mergeProgramParameters()

Merges the global and the program parameters contained in a TransformationUnit into one List.

The program parameters of the TransformationUnit have higher priority in comparison with the grobalProgramParameters.

Parameters:
globalProgramParameters - The global program parameters.
tUnitProgramParameters - The program parameters set by the TransformationUnit.
Returns:
A List with the merged program parameters.


Copyright © 2013. All Rights Reserved.