edu.isi.pegasus.planner.client
Class VDS2PegasusProperties

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

public class VDS2PegasusProperties
extends Executable

A Central Properties class that keeps track of all the properties used by Pegasus. All other classes access the methods in this class to get the value of the property. It access the VDSProperties class to read the property file.

Version:
$Revision: 4507 $
Author:
Karan Vahi, Gaurang Mehta
See Also:
org.griphyn.common.util.VDSProperties

Field Summary
private static Pattern[] mCompiledPatterns
          Stores compiled patterns at first use, quasi-Singleton.
private  String mInputFile
          The input directory containing the kickstart records.
private  String mOutputDir
          The output directory where to generate the ploticus output.
private static String[] mRegexExpression
          Store the regular expressions necessary to match the * properties.
private static String[][] mStarReplacements
          Replacement 2 D Array for the above properties.
private static Map mTXFERImplTable
          An internal table that resolves the old transfer mode property, to the corresponding transfer implementation.
private static Map mTXFERRefinerTable
          An internal table that resolves the old transfer mode property, to the corresponding transfer refiner.
private static Map mVDSToPegasusPropertiesTable
          The handle to the internal map, that maps vds properties to pegasus properties.
 
Fields inherited from class edu.isi.pegasus.planner.client.Executable
mLogger, mLogMsg, mProps, mVersion
 
Constructor Summary
VDS2PegasusProperties()
          The default constructor.
 
Method Summary
private static void associate(String vdsProperty, String pegasusProperty)
          Associates a VDS property with the new pegasus property.
 String convert(String input, String directory)
          Convert a VDS Properties file to Pegasus properties.
 void executeCommand()
          Executes the command on the basis of the options specified.
 gnu.getopt.LongOpt[] generateValidOptions()
          Tt generates the LongOpt which contain the valid options that the command will accept.
 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)
          The main test program.
protected  String matchForStarProperties(String vds)
          Returns a matching pegasus property for a VDS star property.
 Properties matchingSubset(Properties properties, String prefix, boolean keepPrefix)
          Extracts a specific property key subset from the known properties.
 void parseCommandLineArguments(String[] args)
          Parses the command line arguments using GetOpt and returns a PlannerOptions contains all the options passed by the user at the command line.
 void printLongVersion()
          Prints the long description, displaying in detail what the various options to the command stand for.
 void printShortVersion()
          Prints out a short description of what the command does.
protected static void sanityCheck(File dir)
          Checks the destination location for existence, if it can be created, if it is writable etc.
private static Map transferImplementationTable()
          Singleton access to the transfer implementation table.
private static Map transferRefinerTable()
          Singleton access to the transfer refiner table.
private static Map vdsToPegasusPropertiesTable()
          Singleton access to the transfer implementation table.
 
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

mVDSToPegasusPropertiesTable

private static Map mVDSToPegasusPropertiesTable
The handle to the internal map, that maps vds properties to pegasus properties.


mTXFERImplTable

private static Map mTXFERImplTable
An internal table that resolves the old transfer mode property, to the corresponding transfer implementation.


mTXFERRefinerTable

private static Map mTXFERRefinerTable
An internal table that resolves the old transfer mode property, to the corresponding transfer refiner.


mRegexExpression

private static final String[] mRegexExpression
Store the regular expressions necessary to match the * properties.


mStarReplacements

private static final String[][] mStarReplacements
Replacement 2 D Array for the above properties.


mCompiledPatterns

private static Pattern[] mCompiledPatterns
Stores compiled patterns at first use, quasi-Singleton.


mInputFile

private String mInputFile
The input directory containing the kickstart records.


mOutputDir

private String mOutputDir
The output directory where to generate the ploticus output.

Constructor Detail

VDS2PegasusProperties

public VDS2PegasusProperties()
The default constructor. Compiles the patterns only once.

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

transferImplementationTable

private static Map transferImplementationTable()
Singleton access to the transfer implementation table. Contains the mapping of the old transfer property value to the new transfer implementation property value.

Returns:
map

transferRefinerTable

private static Map transferRefinerTable()
Singleton access to the transfer refiner table. Contains the mapping of the old transfer property value to the new transfer refiner property value.

Returns:
map

vdsToPegasusPropertiesTable

private static Map vdsToPegasusPropertiesTable()
Singleton access to the transfer implementation table. Contains the mapping of the old transfer property value to the new transfer implementation property value.

Returns:
map

convert

public String convert(String input,
                      String directory)
               throws IOException
Convert a VDS Properties file to Pegasus properties.

Parameters:
input - the path to the VDS Properties file.
directory - the directory where the Pegasus properties file needs to be written out to.
Returns:
path to the properties file that is written.
Throws:
IOException

matchForStarProperties

protected String matchForStarProperties(String vds)
Returns a matching pegasus property for a VDS star property.

Parameters:
vds - the vds property.
Returns:
the new Pegasus Property if found else, null.

main

public static void main(String[] args)
The main test program.

Parameters:
args - the arguments to the program.

executeCommand

public void executeCommand()
Executes the command on the basis of the options specified.

Parameters:
args - the command line options.

parseCommandLineArguments

public void parseCommandLineArguments(String[] args)
Parses the command line arguments using GetOpt and returns a PlannerOptions contains all the options passed by the user at the command line.

Parameters:
args - the arguments passed by the user at command line.

generateValidOptions

public gnu.getopt.LongOpt[] generateValidOptions()
Tt generates the LongOpt which contain the valid options that the command will accept.

Specified by:
generateValidOptions in class Executable
Returns:
array of LongOpt objects , corresponding to the valid options

printShortVersion

public void printShortVersion()
Prints out a short description of what the command does.

Specified by:
printShortVersion in class Executable

printLongVersion

public void printLongVersion()
Prints the long description, displaying in detail what the various options to the command stand for.

Specified by:
printLongVersion in class Executable

loadProperties

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

Specified by:
loadProperties in class Executable

sanityCheck

protected static void sanityCheck(File dir)
                           throws IOException
Checks the destination location for existence, if it can be created, if it is writable etc.

Parameters:
dir - is the new base directory to optionally create.
Throws:
IOException - in case of error while writing out files.

matchingSubset

public Properties matchingSubset(Properties properties,
                                 String prefix,
                                 boolean keepPrefix)
Extracts a specific property key subset from the known properties. The prefix may be removed from the keys in the resulting dictionary, or it may be kept. In the latter case, exact matches on the prefix will also be copied into the resulting dictionary.

Parameters:
properties - is the properties from where to get the subset.
prefix - is the key prefix to filter the properties by.
keepPrefix - if true, the key prefix is kept in the resulting dictionary. As side-effect, a key that matches the prefix exactly will also be copied. If false, the resulting dictionary's keys are shortened by the prefix. An exact prefix match will not be copied, as it would result in an empty string key.
Returns:
a property dictionary matching the filter key. May be an empty dictionary, if no prefix matches were found.

associate

private static void associate(String vdsProperty,
                              String pegasusProperty)
Associates a VDS property with the new pegasus property.

Parameters:
vdsProperty - the old VDS property.
pegasusProperty - the new Pegasus property.


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