org.gcube.datatransformation.datatransformationlibrary
Class DTSCore

java.lang.Object
  extended by org.gcube.datatransformation.datatransformationlibrary.DTSCore

public class DTSCore
extends java.lang.Object

Author:
Dimitris Katris, NKUA DTSCore is the class invoked by any interface (as the web service interface) which needs to utilize the data transformationUnit functionality.

Constructor Summary
DTSCore(org.gcube.datatransformation.datatransformationlibrary.imanagers.IManager iManager, org.gcube.datatransformation.datatransformationlibrary.model.graph.TransformationsGraph graph)
          Constructor of DTSCore.
 
Method Summary
 void destroy()
          Destroys the information kept by the DTSCore instance.
 java.util.ArrayList<org.gcube.datatransformation.datatransformationlibrary.model.TransformationUnit> findApplicableTransformationUnits(org.gcube.datatransformation.datatransformationlibrary.model.ContentType sourceContentType, org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType, boolean createAndPublishCompositeTP)
          Searches for TransformationUnits that are able to perform a transformationUnit from a source to a target ContentType.
 java.util.ArrayList<org.gcube.datatransformation.datatransformationlibrary.model.ContentType> getAvailableTargetContentTypes(org.gcube.datatransformation.datatransformationlibrary.model.ContentType sourceContentType)
          Searches for ContentTypes to which an object can be transformed.
static org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataBridge getDataBridge()
          Returns an instance of a DataBridge.
static org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataBridge getHardDataBridge()
          Returns an instance of a DataBridge.
 org.gcube.datatransformation.datatransformationlibrary.imanagers.IManager getIManager()
          Returns the iManager object.
 void initializeAdaptor(org.gcube.datatransformation.datatransformationlibrary.transformation.model.TransformationDescription desc)
           
 void transformData(org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataSource source, org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType)
          This method transforms the input data which are fetched by the DataSource to the target ContentType and stores the transformed DataElements to the DataSink.
 void transformDataWithTransformationProgram(org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataSource source, java.lang.String transformationProgramID, org.gcube.datatransformation.datatransformationlibrary.model.Parameter[] programUnboundParameters, org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType)
           This method transforms the input data which are fetched by the DataSources to the target ContentType and stores the transformed DataElements to the DataSink.
 void transformDataWithTransformationUnit(java.lang.String transformationProgramID, java.lang.String transformationUnitID, org.gcube.datatransformation.datatransformationlibrary.model.Parameter[] programUnboundParameters, org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType, boolean filterSources)
          This method transforms the input data which are fetched by the DataSources to the target ContentType and stores the transformed DataElements to the DataSink.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTSCore

public DTSCore(org.gcube.datatransformation.datatransformationlibrary.imanagers.IManager iManager,
               org.gcube.datatransformation.datatransformationlibrary.model.graph.TransformationsGraph graph)
        throws java.lang.Exception
Constructor of DTSCore. DTSCore requires a IManager instance and a TransformationsGraph instance in order to be initialized.

Parameters:
iManager - The IManager from which the DTSCore instance will retrieve the TransformationPrograms.
graph - The TransformationsGraph which the DTSCore instance will use in order to search for applicable TransformationUnits.
Throws:
java.lang.Exception - If imanager or graph is not set.
Method Detail

getIManager

public org.gcube.datatransformation.datatransformationlibrary.imanagers.IManager getIManager()
Returns the iManager object.

Returns:
The iManager.

destroy

public void destroy()
Destroys the information kept by the DTSCore instance.


initializeAdaptor

public void initializeAdaptor(org.gcube.datatransformation.datatransformationlibrary.transformation.model.TransformationDescription desc)
                       throws java.lang.Exception
Throws:
java.lang.Exception

transformDataWithTransformationProgram

public void transformDataWithTransformationProgram(org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataSource source,
                                                   java.lang.String transformationProgramID,
                                                   org.gcube.datatransformation.datatransformationlibrary.model.Parameter[] programUnboundParameters,
                                                   org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType)
                                            throws java.lang.Exception

This method transforms the input data which are fetched by the DataSources to the target ContentType and stores the transformed DataElements to the DataSink. The TransformationProgram which will be used by the service is indicated by the client.

This method should be only used externally as internally the transformationUnit id is known. Putting a TP without the transformationUnit id is useful when having a TP that is created in order to perform an operation over some variable input content types, performed by different programs and the target format has common semantics.

Parameters:
source - The DataSource from which the DTSCore#transformDataWithTransformationProgram(DataSource, String, Parameter[], ContentType, DataSink) method fetches the DataElements.
transformationProgramID - The id of the TransformationProgram.
programUnboundParameters - The unbound program parameters which are set by the client.
targetContentType - The ContentType to which the DataElements are transformed.
Throws:
java.lang.Exception - If an error occurred in the transformationUnit process.

transformDataWithTransformationUnit

public void transformDataWithTransformationUnit(java.lang.String transformationProgramID,
                                                java.lang.String transformationUnitID,
                                                org.gcube.datatransformation.datatransformationlibrary.model.Parameter[] programUnboundParameters,
                                                org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType,
                                                boolean filterSources)
                                         throws java.lang.Exception
This method transforms the input data which are fetched by the DataSources to the target ContentType and stores the transformed DataElements to the DataSink. The TransformationUnit which will be used by the service is indicated by the client.

Parameters:
transformationProgramID - The id of the TransformationProgram.
transformationUnitID - The id of the TransformationUnit.
programUnboundParameters - A list with Program parameters set by the client.
targetContentType - The ContentType to which the DataElements are transformed.
filterSources - If true then the ContentType of each DataElement from the DataSources is checked if it conforms to the input expected by the TransformationUnit.
Throws:
java.lang.Exception - If an error occurred in the transformationUnit process.

transformData

public void transformData(org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataSource source,
                          org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType)
This method transforms the input data which are fetched by the DataSource to the target ContentType and stores the transformed DataElements to the DataSink. In this method the service by its self discovers the TransformationProgram to use.

Parameters:
source - The DataSource from which the DTSCore#transformData(DataSource, ContentType, DataSink) method fetches the DataElements.
targetContentType - The ContentType to which the DataElements are transformed.

getDataBridge

public static org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataBridge getDataBridge()
Returns an instance of a DataBridge. The class name of the DataBridge is set in the "dtslib.properties" file.

Returns:
The instance of the DataBridge.

getHardDataBridge

public static org.gcube.datatransformation.datatransformationlibrary.datahandlers.DataBridge getHardDataBridge()
Returns an instance of a DataBridge. The class name of the DataBridge is set in the "dtslib.properties" file. The difference with the getDataBridge() method is that hard DataBridges copies the content of each DataElement in the hard disk.

Returns:
The instance of the DataBridge.

findApplicableTransformationUnits

public java.util.ArrayList<org.gcube.datatransformation.datatransformationlibrary.model.TransformationUnit> findApplicableTransformationUnits(org.gcube.datatransformation.datatransformationlibrary.model.ContentType sourceContentType,
                                                                                                                                              org.gcube.datatransformation.datatransformationlibrary.model.ContentType targetContentType,
                                                                                                                                              boolean createAndPublishCompositeTP)
Searches for TransformationUnits that are able to perform a transformationUnit from a source to a target ContentType.

Parameters:
sourceContentType - The source ContentType.
targetContentType - The target ContentType.
createAndPublishCompositeTP - If true then the TransformationsGraph creates and publishes the composite TransformationPrograms.
Returns:
A list of applicable TransformationUnits.

getAvailableTargetContentTypes

public java.util.ArrayList<org.gcube.datatransformation.datatransformationlibrary.model.ContentType> getAvailableTargetContentTypes(org.gcube.datatransformation.datatransformationlibrary.model.ContentType sourceContentType)
Searches for ContentTypes to which an object can be transformed.

Parameters:
sourceContentType - The source ContentType.
Returns:
One or more available target ContentTypes.