org.gcube.datatransformation.datatransformationlibrary.programs
Class Stream2StreamProgram

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

public abstract class Stream2StreamProgram
extends Elm2ElmProgram

Author:
Dimitris Katris, NKUA

Abstract helper class that implements the Program interface.

Each class that extends the Stream2StreamProgram shall implement the transformStream(InputStream, ContentType, List, ContentType) method which takes as input an InputStream and returns an InputStream of the transformed content.


Constructor Summary
Stream2StreamProgram()
           
 
Method Summary
 DataElement transformDataElement(DataElement sourceDataElement, List<Parameter> programParameters, ContentType targetContentType)
          Transforms the sourceDataElement to the targetContentType and returns the transformed DataElement.
abstract  InputStream transformStream(InputStream content, ContentType sourceContentType, List<Parameter> programParameters, ContentType targetContentType)
          Transforms the content to the targetContentType and returns the transformed content as a stream.
 
Methods inherited from class org.gcube.datatransformation.datatransformationlibrary.programs.Elm2ElmProgram
transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stream2StreamProgram

public Stream2StreamProgram()
Method Detail

transformDataElement

public DataElement transformDataElement(DataElement sourceDataElement,
                                        List<Parameter> programParameters,
                                        ContentType targetContentType)
                                 throws Exception
Description copied from class: Elm2ElmProgram
Transforms the sourceDataElement to the targetContentType and returns the transformed DataElement.

Specified by:
transformDataElement in class Elm2ElmProgram
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.
See Also:
Elm2ElmProgram.transformDataElement(org.gcube.datatransformation.datatransformationlibrary.dataelements.DataElement, java.util.List, org.gcube.datatransformation.datatransformationlibrary.model.ContentType)

transformStream

public abstract InputStream transformStream(InputStream content,
                                            ContentType sourceContentType,
                                            List<Parameter> programParameters,
                                            ContentType targetContentType)
                                     throws Exception
Transforms the content to the targetContentType and returns the transformed content as a stream.

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


Copyright © 2013. All Rights Reserved.