Package edu.isi.pegasus.planner.client
Class TCConverter
- java.lang.Object
-
- edu.isi.pegasus.planner.client.Executable
-
- edu.isi.pegasus.planner.client.TCConverter
-
public class TCConverter extends Executable
A client to convert transformation catalog between different formats.- Version:
- $Revision$
- Author:
- Prasanth Thomas
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDATABASE_FORMATThe database format.private static java.lang.StringDEFAULT_DATABASEThe default database .private static java.lang.StringFILE_FORMATThe File format.private java.lang.StringmDatabaseThe database type.private java.lang.StringmDatabaseHostThe database host .private java.lang.StringmDatabaseNameThe database name.private java.lang.StringmDatabasePasswordThe database user password.private java.lang.StringmDatabaseURLThe database type.private java.lang.StringmDatabaseUserNameThe database user name.private java.util.List<java.lang.String>mInputFilesThe input files.private java.lang.StringmInputFormatThe input format for the transformation catalog.private intmLoggingLevelDenotes the logging level that is to be used for logging the messages.private java.lang.StringmOutputFileThe output file that is written out.private java.lang.StringmOutputFormatThe output format for the transformation catalog.private static java.lang.String[]SUPPORTED_TRANSFORMATION_FORMATThe supported transformation formats.private static java.lang.String[]TC_INITIALIZATION_FILESList of sql initialization filesprivate static java.lang.StringTEXT_FORMATThe textual format.-
Fields inherited from class edu.isi.pegasus.planner.client.Executable
mLogger, mLogMsg, mProps, mVersion
-
-
Constructor Summary
Constructors Constructor Description TCConverter()The default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidconvertTC()Converts transformation catalog from one format to anotherprivate TransformationStoreconvertTCEntryFrom(java.util.List<java.lang.String> inputFiles, java.lang.String inputFormat)Parses the input files in the input format and returns the output as a TransformationStore instanceprivate voidconvertTCEntryTo(TransformationStore output, java.lang.String format, java.lang.String filename)Converts Transformation store to the given output format.voiddecrementLogging()Decrements the logging level by 1.voidexecuteCommand()Call the correct commands depending on options.gnu.getopt.LongOpt[]generateValidOptions()Generates the list of valid options for the tc-converter clientintgetLoggingLevel()Returns the logging level.voidincrementLogging()Increments the logging level by 1.protected voidinitialize(java.lang.String[] opts)Initialize the executable objectprivate booleanisSupportedFormat(java.lang.String format)Checks if it is a supported transformation catalog formatvoidloadProperties()Loads all the properties that would be needed by the Toolkit classesstatic voidmain(java.lang.String[] args)The main functionprivate java.util.List<TransformationCatalogEntry>parseTC(PegasusProperties pegasusProperties)Parses the input format specified in the properties file and returns list of TransfromationCatalogEntryvoidprintLongVersion()This method is used to print the long version of the command.voidprintShortVersion()Prints the short help.protected voidsetupLogging()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
-
-
-
-
Field Detail
-
DEFAULT_DATABASE
private static java.lang.String DEFAULT_DATABASE
The default database .
-
DATABASE_FORMAT
private static java.lang.String DATABASE_FORMAT
The database format.
-
FILE_FORMAT
private static java.lang.String FILE_FORMAT
The File format.
-
TEXT_FORMAT
private static java.lang.String TEXT_FORMAT
The textual format.
-
SUPPORTED_TRANSFORMATION_FORMAT
private static final java.lang.String[] SUPPORTED_TRANSFORMATION_FORMAT
The supported transformation formats.
-
TC_INITIALIZATION_FILES
private static final java.lang.String[] TC_INITIALIZATION_FILES
List of sql initialization files
-
mInputFiles
private java.util.List<java.lang.String> mInputFiles
The input files.
-
mOutputFile
private java.lang.String mOutputFile
The output file that is written out.
-
mOutputFormat
private java.lang.String mOutputFormat
The output format for the transformation catalog.
-
mInputFormat
private java.lang.String mInputFormat
The input format for the transformation catalog.
-
mDatabaseURL
private java.lang.String mDatabaseURL
The database type.
-
mDatabase
private java.lang.String mDatabase
The database type.
-
mDatabaseName
private java.lang.String mDatabaseName
The database name.
-
mDatabaseUserName
private java.lang.String mDatabaseUserName
The database user name.
-
mDatabasePassword
private java.lang.String mDatabasePassword
The database user password.
-
mDatabaseHost
private java.lang.String mDatabaseHost
The database host .
-
mLoggingLevel
private int mLoggingLevel
Denotes the logging level that is to be used for logging the messages.
-
-
Method Detail
-
initialize
protected void initialize(java.lang.String[] opts)
Description copied from class:ExecutableInitialize the executable object- Overrides:
initializein classExecutable- 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:
loadPropertiesin classExecutable
-
generateValidOptions
public gnu.getopt.LongOpt[] generateValidOptions()
Generates the list of valid options for the tc-converter client- Specified by:
generateValidOptionsin classExecutable- Returns:
- LongOpt[] list of valid options
-
executeCommand
public void executeCommand() throws java.io.IOExceptionCall the correct commands depending on options.- Parameters:
opts- Command options- Throws:
java.io.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 java.io.IOExceptionConverts transformation catalog from one format to another- Throws:
java.io.IOException
-
convertTCEntryFrom
private TransformationStore convertTCEntryFrom(java.util.List<java.lang.String> inputFiles, java.lang.String inputFormat) throws java.io.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 convertedinputFormat- input format of the input files- Returns:
- TransformationStore reference to the TransformationStore object , null if no transformation catalog entry exists.
- Throws:
java.io.IOException
-
parseTC
private java.util.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(java.lang.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:
printShortVersionin classExecutable
-
printLongVersion
public void printLongVersion()
Description copied from class:ExecutableThis method is used to print the long version of the command.- Specified by:
printLongVersionin classExecutable
-
convertTCEntryTo
private void convertTCEntryTo(TransformationStore output, java.lang.String format, java.lang.String filename) throws java.io.IOException
Converts Transformation store to the given output format.- Parameters:
output- the reference to TransformationStore objectfilename- the given output format.output- the given output file name, null if the format is database.- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionThe main function- Parameters:
args- arguments passed at runtime- Throws:
java.lang.Exception
-
-