edu.isi.pegasus.planner.client

## Class VDS2PegasusProperties

- java.lang.Object
- - edu.isi.pegasus.planner.client.Executable
  - - 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$
Author:
  Karan Vahi, Gaurang Mehta
See Also:
  `org.griphyn.common.util.VDSProperties`

### Field Summary

Fields
`private static java.util.regex.Pattern[]` `mCompiledPatterns` Stores compiled patterns at first use, quasi-Singleton.
`private java.lang.String` `mInputFile` The input directory containing the kickstart records.
`private java.lang.String` `mOutputDir` The output directory where to generate the ploticus output.
`private static java.lang.String[]` `mRegexExpression` Store the regular expressions necessary to match the * properties.
`private static java.lang.String[][]` `mStarReplacements` Replacement 2 D Array for the above properties.
`private static java.util.Map` `mTXFERImplTable` An internal table that resolves the old transfer mode property, to the corresponding transfer implementation.
`private static java.util.Map` `mTXFERRefinerTable` An internal table that resolves the old transfer mode property, to the corresponding transfer refiner.
`private static java.util.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

Constructors
Constructor and Description
`VDS2PegasusProperties()` The default constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`private static void` `associate(java.lang.String vdsProperty, java.lang.String pegasusProperty)` Associates a VDS property with the new pegasus property.
`java.lang.String` `convert(java.lang.String input, java.lang.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(java.lang.String[] opts)` Initialize the executable object
`void` `loadProperties()` Loads all the properties that would be needed by the Toolkit classes.
`static void` `main(java.lang.String[] args)` The main test program.
`protected java.lang.String` `matchForStarProperties(java.lang.String vds)` Returns a matching pegasus property for a VDS star property.
`java.util.Properties` `matchingSubset(java.util.Properties properties, java.lang.String prefix, boolean keepPrefix)` Extracts a specific property key subset from the known properties.
`void` `parseCommandLineArguments(java.lang.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(java.io.File dir)` Checks the destination location for existence, if it can be created, if it is writable etc.
`private static java.util.Map` `transferImplementationTable()` Singleton access to the transfer implementation table.
`private static java.util.Map` `transferRefinerTable()` Singleton access to the transfer refiner table.
`private static java.util.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 java.util.Map mVDSToPegasusPropertiesTable

The handle to the internal map, that maps vds properties to pegasus properties.

#### mTXFERImplTable

    private static java.util.Map mTXFERImplTable

An internal table that resolves the old transfer mode property, to the corresponding transfer implementation.

#### mTXFERRefinerTable

    private static java.util.Map mTXFERRefinerTable

An internal table that resolves the old transfer mode property, to the corresponding transfer refiner.

#### mRegexExpression

    private static final java.lang.String[] mRegexExpression

Store the regular expressions necessary to match the * properties.

#### mStarReplacements

    private static final java.lang.String[][] mStarReplacements

Replacement 2 D Array for the above properties.

#### mCompiledPatterns

    private static java.util.regex.Pattern[] mCompiledPatterns

Stores compiled patterns at first use, quasi-Singleton.

#### mInputFile

    private java.lang.String mInputFile

The input directory containing the kickstart records.

#### mOutputDir

    private java.lang.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(java.lang.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 java.util.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 java.util.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 java.util.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 java.lang.String convert(java.lang.String input,
                                    java.lang.String directory)
                             throws java.io.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:
  `java.io.IOException`

#### matchForStarProperties

    protected java.lang.String matchForStarProperties(java.lang.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(java.lang.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(java.lang.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(java.io.File dir)
                               throws java.io.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:
  `java.io.IOException` - in case of error while writing out files.

#### matchingSubset

    public java.util.Properties matchingSubset(java.util.Properties properties,
                                               java.lang.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(java.lang.String vdsProperty,
                                  java.lang.String pegasusProperty)

Associates a VDS property with the new pegasus property.

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