org.gcube.datatransformation.datatransformationlibrary.programs
Class P2PProgram

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

public abstract class P2PProgram
extends Stream2StreamProgram

Author:
Dimitris Katris, NKUA

Abstract helper class that implements the Program interface.

Each class that extends the P2PProgram shall implement the P2PProgram#transformObjectFromItsPath(String, List, ContentType) method which takes as input a file location and returns the location of a file which contains the transformed content.


Constructor Summary
P2PProgram()
           
 
Method Summary
abstract  String transformObjectFromItsPath(String sourceContentPath, List<Parameter> progparameters, ContentType targetContentType, String targetContentPath)
          Transforms the content of a file whose location is contentpath to the targetContentType and returns the transformed content in a file.
 InputStream transformStream(InputStream content, ContentType sourceFormat, List<Parameter> progparameters, 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.Stream2StreamProgram
transformDataElement
 
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

P2PProgram

public P2PProgram()
Method Detail

transformStream

public InputStream transformStream(InputStream content,
                                   ContentType sourceFormat,
                                   List<Parameter> progparameters,
                                   ContentType targetContentType)
                            throws Exception
Description copied from class: Stream2StreamProgram
Transforms the content to the targetContentType and returns the transformed content as a stream.

Specified by:
transformStream in class Stream2StreamProgram
Parameters:
content - The content of the source DataElement.
sourceFormat - The ContentType of the source DataElement.
progparameters - 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.
See Also:
Stream2StreamProgram.transformStream(java.io.InputStream, org.gcube.datatransformation.datatransformationlibrary.model.ContentType, java.util.List, org.gcube.datatransformation.datatransformationlibrary.model.ContentType)

transformObjectFromItsPath

public abstract String transformObjectFromItsPath(String sourceContentPath,
                                                  List<Parameter> progparameters,
                                                  ContentType targetContentType,
                                                  String targetContentPath)
                                           throws Exception
Transforms the content of a file whose location is contentpath to the targetContentType and returns the transformed content in a file.

Parameters:
sourceContentPath - The location of the source file.
progparameters - The parameters of the Program.
targetContentType - The ContentType in which the DataElement will be transformed.
targetContentPath - The path for the transformed content.
Returns:
The path of the transformed content.
Throws:
Exception - If the Program is not capable to transform DataElements.


Copyright © 2013. All Rights Reserved.