org.gcube.datatransformation.datatransformationlibrary.programs
Class Elm2ElmProgram

java.lang.Object
  extended by org.gcube.datatransformation.datatransformationlibrary.programs.Elm2ElmProgram
All Implemented Interfaces:
Program
Direct Known Subclasses:
File2FileProgram, Stream2StreamProgram

public abstract class Elm2ElmProgram
extends Object
implements Program

Author:
Dimitris Katris, NKUA

Abstract helper class that implements the Program interface.

Each class that extends the Elm2ElmProgram shall implement the transformDataElement(DataElement, List, ContentType) method which takes as input a DataElement and returns the transformed DataElement.


Constructor Summary
Elm2ElmProgram()
           
 
Method Summary
 void transform(List<DataSource> sources, List<Parameter> programParameters, ContentType targetContentType, DataSink sink)
          The method invoked by ProgramExecutor in order for the Program to transform the sources to the targetContentType.
abstract  DataElement transformDataElement(DataElement sourceDataElement, List<Parameter> programParameters, ContentType targetContentType)
          Transforms the sourceDataElement to the targetContentType and returns the transformed DataElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Elm2ElmProgram

public Elm2ElmProgram()
Method Detail

transform

public void transform(List<DataSource> sources,
                      List<Parameter> programParameters,
                      ContentType targetContentType,
                      DataSink sink)
               throws Exception
Description copied from interface: Program
The method invoked by ProgramExecutor in order for the Program to transform the sources to the targetContentType.

Specified by:
transform in interface Program
Parameters:
sources - The DataSources from which the Program will get the DataElements.
programParameters - The parameters of the Program which are primarily set by the TransformationUnit.
targetContentType - The ContentType in which the source data will be transformed.
sink - The DataSink in which the Program will append the transformed DataElements.
Throws:
Exception - If the program is not capable to transform DataElements.
See Also:
Program.transform(java.util.List, java.util.List, org.gcube.datatransformation.datatransformationlibrary.model.ContentType, org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataSink)

transformDataElement

public abstract DataElement transformDataElement(DataElement sourceDataElement,
                                                 List<Parameter> programParameters,
                                                 ContentType targetContentType)
                                          throws Exception
Transforms the sourceDataElement to the targetContentType and returns the transformed DataElement.

Parameters:
sourceDataElement - The source DataElement.
programParameters - The parameters of the Program.
targetContentType - The ContentType in which the DataElement will be transformed.
Returns:
The transformed DataElement.
Throws:
Exception - If the Program is not capable to transform DataElements.


Copyright © 2013. All Rights Reserved.