edu.isi.pegasus.planner.client
Class TCConverter

java.lang.Object
  extended by edu.isi.pegasus.planner.client.Executable
      extended by edu.isi.pegasus.planner.client.TCConverter

public class TCConverter
extends Executable

A client to convert transformation catalog between different formats.

Version:
$Revision: 4507 $
Author:
Prasanth Thomas

Field Summary
private static String DATABASE_FORMAT
          The database format.
private static String DEFAULT_DATABASE
          The default database .
private static String FILE_FORMAT
          The File format.
private  String mDatabase
          The database type.
private  String mDatabaseHost
          The database host .
private  String mDatabaseName
          The database name.
private  String mDatabasePassword
          The database user password.
private  String mDatabaseURL
          The database type.
private  String mDatabaseUserName
          The database user name.
private  List<String> mInputFiles
          The input files.
private  String mInputFormat
          The input format for the transformation catalog.
private  int mLoggingLevel
          Denotes the logging level that is to be used for logging the messages.
private  String mOutputFile
          The output file that is written out.
private  String mOutputFormat
          The output format for the transformation catalog.
private static String[] SUPPORTED_TRANSFORMATION_FORMAT
          The supported transformation formats.
private static String[] TC_INITIALIZATION_FILES
          List of sql initialization files
private static String TEXT_FORMAT
          The textual format.
 
Fields inherited from class edu.isi.pegasus.planner.client.Executable
mLogger, mLogMsg, mProps, mVersion
 
Constructor Summary
TCConverter()
          The default constructor.
 
Method Summary
private  void convertTC()
          Converts transformation catalog from one format to another
private  TransformationStore convertTCEntryFrom(List<String> inputFiles, String inputFormat)
          Parses the input files in the input format and returns the output as a TransformationStore instance
private  void convertTCEntryTo(TransformationStore output, String format, String filename)
          Converts Transformation store to the given output format.
 void decrementLogging()
          Decrements the logging level by 1.
 void executeCommand()
          Call the correct commands depending on options.
 gnu.getopt.LongOpt[] generateValidOptions()
          Generates the list of valid options for the tc-converter client
 int getLoggingLevel()
          Returns the logging level.
 void incrementLogging()
          Increments the logging level by 1.
protected  void initialize(String[] opts)
          Initialize the executable object
private  boolean isSupportedFormat(String format)
          Checks if it is a supported transformation catalog format
 void loadProperties()
          Loads all the properties that would be needed by the Toolkit classes
static void main(String[] args)
          The main function
private  List<TransformationCatalogEntry> parseTC(PegasusProperties pegasusProperties)
          Parses the input format specified in the properties file and returns list of TransfromationCatalogEntry
 void printLongVersion()
          This method is used to print the long version of the command.
 void printShortVersion()
          Prints the short help.
protected  void setupLogging()
          Sets up the logging options for this class.
 
Methods inherited from class edu.isi.pegasus.planner.client.Executable
convertException, convertException, getCommandLineOptions, getEnvValue, getGVDSVersion, initialize, log, lookupConfProperty, sanityCheckOnProperties, setupLogging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DATABASE

private static String DEFAULT_DATABASE
The default database .


DATABASE_FORMAT

private static String DATABASE_FORMAT
The database format.


FILE_FORMAT

private static String FILE_FORMAT
The File format.


TEXT_FORMAT

private static String TEXT_FORMAT
The textual format.


SUPPORTED_TRANSFORMATION_FORMAT

private static final String[] SUPPORTED_TRANSFORMATION_FORMAT
The supported transformation formats.


TC_INITIALIZATION_FILES

private static final String[] TC_INITIALIZATION_FILES
List of sql initialization files


mInputFiles

private List<String> mInputFiles
The input files.


mOutputFile

private String mOutputFile
The output file that is written out.


mOutputFormat

private String mOutputFormat
The output format for the transformation catalog.


mInputFormat

private String mInputFormat
The input format for the transformation catalog.


mDatabaseURL

private String mDatabaseURL
The database type.


mDatabase

private String mDatabase
The database type.


mDatabaseName

private String mDatabaseName
The database name.


mDatabaseUserName

private String mDatabaseUserName
The database user name.


mDatabasePassword

private String mDatabasePassword
The database user password.


mDatabaseHost

private String mDatabaseHost
The database host .


mLoggingLevel

private int mLoggingLevel
Denotes the logging level that is to be used for logging the messages.

Constructor Detail

TCConverter

public TCConverter()
The default constructor.

Method Detail

initialize

protected void initialize(String[] opts)
Description copied from class: Executable
Initialize the executable object

Overrides:
initialize in class Executable
Parameters:
opts - the command line argument passed to the executable

setupLogging

protected void setupLogging()
Sets up the logging options for this class. Looking at the properties file, sets up the appropriate writers for output and stderr.


loadProperties

public void loadProperties()
Loads all the properties that would be needed by the Toolkit classes

Specified by:
loadProperties in class Executable

generateValidOptions

public gnu.getopt.LongOpt[] generateValidOptions()
Generates the list of valid options for the tc-converter client

Specified by:
generateValidOptions in class Executable
Returns:
LongOpt[] list of valid options

executeCommand

public void executeCommand()
                    throws IOException
Call the correct commands depending on options.

Parameters:
opts - Command options
Throws:
IOException

incrementLogging

public void incrementLogging()
Increments the logging level by 1.


decrementLogging

public void decrementLogging()
Decrements the logging level by 1.


getLoggingLevel

public int getLoggingLevel()
Returns the logging level.

Returns:
the logging level.

convertTC

private void convertTC()
                throws IOException
Converts transformation catalog from one format to another

Throws:
IOException

convertTCEntryFrom

private TransformationStore convertTCEntryFrom(List<String> inputFiles,
                                               String inputFormat)
                                        throws IOException
Parses the input files in the input format and returns the output as a TransformationStore instance

Parameters:
inputFiles - list of input files that need to be converted
inputFormat - input format of the input files
Returns:
TransformationStore reference to the TransformationStore object , null if no transformation catalog entry exists.
Throws:
IOException

parseTC

private List<TransformationCatalogEntry> parseTC(PegasusProperties pegasusProperties)
Parses the input format specified in the properties file and returns list of TransfromationCatalogEntry

Parameters:
pegasusProperties - input format specified in the properties file
Returns:
list of TransfromationCatalogEntry

isSupportedFormat

private boolean isSupportedFormat(String format)
Checks if it is a supported transformation catalog format

Parameters:
format - the format
Returns:
true , if format is supported, false otherwise.

printShortVersion

public void printShortVersion()
Prints the short help.

Specified by:
printShortVersion in class Executable

printLongVersion

public void printLongVersion()
Description copied from class: Executable
This method is used to print the long version of the command.

Specified by:
printLongVersion in class Executable

convertTCEntryTo

private void convertTCEntryTo(TransformationStore output,
                              String format,
                              String filename)
                       throws IOException
Converts Transformation store to the given output format.

Parameters:
output - the reference to TransformationStore object
filename - the given output format.
output - the given output file name, null if the format is database.
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
The main function

Parameters:
args - arguments passed at runtime
Throws:
Exception


Copyright © 2011 The University of Southern California. All Rights Reserved.