edu.isi.pegasus.planner.client
Class SCClient

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

public class SCClient
extends Executable

A client to convert site catalog between different formats.

Version:
$Revision: 3532 $
Author:
Karan Vahi, Gaurang Mehta gmehta@isi.edu

Field Summary
private static String DEFAULT_OUTPUT_FORMAT
          The default output format.
private  List<String> mInputFiles
          The input files.
private  String mInputFormat
          The input format for the site 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 site catalog.
private static String TEXT_FORMAT
          The textual format.
private static String XML_FORMAT
          The XML format.
private static String XML_NAMESPACE
           
private static String XML_VERSION
           
 
Fields inherited from class edu.isi.pegasus.planner.client.Executable
mLogger, mLogMsg, mProps, mVersion
 
Constructor Summary
SCClient()
          The default constructor.
 
Method Summary
 void decrementLogging()
          Decrements the logging level by 1.
 void executeCommand()
          Call the correct commands depending on options.
 gnu.getopt.LongOpt[] generateValidOptions()
          Generates an array of valid LongOpt objects which contain all the valid options to the Executable.
 int getLoggingLevel()
          Returns the logging level.
 PoolConfig getTextToPoolConfig(String file)
          Generates the old site catalog object reading in from text file.
 void incrementLogging()
          Increments the logging level by 1.
 void initialize(String[] opts)
          Initialize the executable object
 void loadProperties()
          Loads all the properties that would be needed by the Toolkit classes
static void main(String[] args)
           
 String parseInputFiles(List<String> inputFiles, String inputFormat, String outputFormat)
          Parses the input files in the input format and returns a String in the output format.
private  String parseInputFilesForBackwardCompatibility(List<String> inputFiles, String inputFormat, String outputFormat)
          Parses the input files in the input format and returns a String in the old XML output format.
 void printLongVersion()
          This method is used to print the long version of the command.
 void printShortVersion()
          Returns the short help.
protected  void setupLogging()
          Sets up the logging options for this class.
 void toFile(String filename, String output)
          Writes out to a file, a string.
 String toMultiLine(PoolConfig cfg)
          Returns the String description of the contents of PoolConfig object passed.
 String toXML(PoolConfig cfg)
          Returns the XML description of the contents of PoolConfig object passed, conforming to pool config schema found at http://pegasus.isi.edu/schema/sc-2.0.xsd.
 
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_OUTPUT_FORMAT

private static String DEFAULT_OUTPUT_FORMAT
The default output format.


XML_FORMAT

private static String XML_FORMAT
The XML format.


TEXT_FORMAT

private static String TEXT_FORMAT
The textual format.


XML_NAMESPACE

private static final String XML_NAMESPACE
See Also:
Constant Field Values

XML_VERSION

private static final String XML_VERSION
See Also:
Constant Field Values

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 site catalog.


mInputFormat

private String mInputFormat
The input format for the site catalog.


mLoggingLevel

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

Constructor Detail

SCClient

public SCClient()
The default constructor.

Method Detail

initialize

public 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()
Description copied from class: Executable
Generates an array of valid LongOpt objects which contain all the valid options to the Executable.

Specified by:
generateValidOptions in class Executable

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.

parseInputFiles

public String parseInputFiles(List<String> inputFiles,
                              String inputFormat,
                              String outputFormat)
                       throws IOException
Parses the input files in the input format and returns a String in the output format.

Parameters:
inputFiles - list of input files that need to be converted
inputFormat - input format of the input files
outputFormat - output format of the output file
Returns:
String in output format
Throws:
IOException

parseInputFilesForBackwardCompatibility

private String parseInputFilesForBackwardCompatibility(List<String> inputFiles,
                                                       String inputFormat,
                                                       String outputFormat)
Parses the input files in the input format and returns a String in the old XML output format.

Parameters:
inputFiles - list of input files that need to be converted
inputFormat - input format of the input files
outputFormat - output format of the output file
Returns:
String in output format ( old XML )
Throws:
IOException

printShortVersion

public void printShortVersion()
Returns 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

getTextToPoolConfig

public PoolConfig getTextToPoolConfig(String file)
Generates the old site catalog object reading in from text file.

Parameters:
file - text file to parse.
Returns:
PoolConfig

toXML

public String toXML(PoolConfig cfg)
Returns the XML description of the contents of PoolConfig object passed, conforming to pool config schema found at http://pegasus.isi.edu/schema/sc-2.0.xsd.

Parameters:
cfg - the PoolConfig object whose xml description is desired.
Returns:
the xml description.

toMultiLine

public String toMultiLine(PoolConfig cfg)
Returns the String description of the contents of PoolConfig object passed.

Parameters:
cfg - the PoolConfig object whose description is desired.
Returns:
the String description.

toFile

public void toFile(String filename,
                   String output)
            throws IOException
Writes out to a file, a string.

Parameters:
filename - the fully qualified path name to the file.
output - the text that needs to be written to the file.
Throws:
IOException

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


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