edu.isi.pegasus.planner.client

## Class Executable

- java.lang.Object
- - edu.isi.pegasus.planner.client.Executable

Direct Known Subclasses:
  CPlanner, PartitionDAX, PegasusGetSites, RankDAX, SCClient, TCClient, TCConverter, VDS2PegasusProperties

    public abstract class Executable
    extends java.lang.Object

The interface which defines all the methods , any executable should implement.

Version:
  $Revision$
Author:
  GAURANG MEHTA, KARAN VAHI

### Field Summary

Fields
`private java.lang.String[]` `commandLineOpts` The command line options passed to the executable
`protected LogManager` `mLogger` The LogManager object which is used to log all the messages.
`protected java.lang.String` `mLogMsg` The error message to be logged.
`protected PegasusProperties` `mProps` The object holding all the properties pertaining to Pegasus.
`protected java.lang.String` `mVersion` It stores the verison of the Griphyn Virtual Data System software.

### Constructor Summary

Constructors
Constructor and Description
`Executable()` The default constructor.
`Executable(LogManager logger)` The constructor which ends up initialising the PegasusProperties object.

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`static java.lang.String` `convertException(java.lang.Exception e)` Returns an error message that chains all the lower order error messages that might have been thrown.
`static java.lang.String` `convertException(java.lang.Exception e, int logLevel)` Returns an error message that chains all the lower order error messages that might have been thrown.
`abstract gnu.getopt.LongOpt[]` `generateValidOptions()` Generates an array of valid `LongOpt` objects which contain all the valid options to the Executable.
`protected java.lang.String[]` `getCommandLineOptions()` Returns the command line arguments passed to the executable
`java.lang.String` `getEnvValue(java.lang.String envVariable)` Get the value of the environment variable.
`java.lang.String` `getGVDSVersion()` Returns the version of the Griphyn Virtual Data System.
`protected void` `initialize(java.lang.String[] opts)` Initialize the executable object
`protected void` `initialize(java.lang.String[] opts, char confChar)` Initialize the executable object
`abstract void` `loadProperties()` Loads all the properties that would be needed by the Toolkit classes.
`void` `log(java.lang.String msg, int level)` Logs messages to the singleton logger.
`protected java.lang.String` `lookupConfProperty(java.lang.String[] opts, char confChar)` Looks up for the conf property in the arguments passed to the executable
`abstract void` `printLongVersion()` This method is used to print the long version of the command.
`abstract void` `printShortVersion()` This is used to print the short version of the command.
`protected void` `sanityCheckOnProperties()` Does a sanity check on the properties to make sure that all the required properties are loaded.
`protected void` `setupLogging(LogManager logger, PegasusProperties properties)` Sets up the logging options for this class.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mLogger

    protected LogManager mLogger

The LogManager object which is used to log all the messages.

#### mProps

    protected PegasusProperties mProps

The object holding all the properties pertaining to Pegasus.

#### mVersion

    protected java.lang.String mVersion

It stores the verison of the Griphyn Virtual Data System software.

#### mLogMsg

    protected java.lang.String mLogMsg

The error message to be logged.

#### commandLineOpts

    private java.lang.String[] commandLineOpts

The command line options passed to the executable

### Constructor Detail

#### Executable

    public Executable()

The default constructor.

#### Executable

    public Executable(LogManager logger)

The constructor which ends up initialising the PegasusProperties object.

Parameters:
  `logger` - the logger to use. Can be null.

### Method Detail

#### lookupConfProperty

    protected java.lang.String lookupConfProperty(java.lang.String[] opts,
                                                  char confChar)

Looks up for the conf property in the arguments passed to the executable

Parameters:
  `opts` - command line arguments passed to the executable
  `confChar` - the short option corresponding to the conf property
Returns:

#### initialize

    protected void initialize(java.lang.String[] opts,
                              char confChar)

Initialize the executable object

Parameters:
  `opts` - the command line argument passed by the user
  `confChar` - the short option corresponding the conf property.

#### initialize

    protected void initialize(java.lang.String[] opts)

Initialize the executable object

Parameters:
  `opts` - the command line argument passed to the executable

#### convertException

    public static java.lang.String convertException(java.lang.Exception e)

Returns an error message that chains all the lower order error messages that might have been thrown.

Parameters:
  `e` - the Exception for which the error message has to be composed.
Returns:
  the error message.

#### convertException

    public static java.lang.String convertException(java.lang.Exception e,
                                                    int logLevel)

Returns an error message that chains all the lower order error messages that might have been thrown.

Parameters:
  `e` - the Exception for which the error message has to be composed.
  `logLevel` - the user specified level for the logger
Returns:
  the error message.

#### setupLogging

    protected void setupLogging(LogManager logger,
                                PegasusProperties properties)
                         throws java.io.IOException

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

Parameters:
  `logger` - the logger to use. Can be null.
  `properties` - reference of pegasus properties object.
Throws:
  `java.io.IOException`

#### loadProperties

    public abstract void loadProperties()

Loads all the properties that would be needed by the Toolkit classes.

#### printLongVersion

    public abstract void printLongVersion()

This method is used to print the long version of the command.

#### printShortVersion

    public abstract void printShortVersion()

This is used to print the short version of the command.

#### generateValidOptions

    public abstract gnu.getopt.LongOpt[] generateValidOptions()

Generates an array of valid `LongOpt` objects which contain all the valid options to the Executable.

#### getGVDSVersion

    public java.lang.String getGVDSVersion()

Returns the version of the Griphyn Virtual Data System.

#### log

    public void log(java.lang.String msg,
                    int level)

Logs messages to the singleton logger.

Parameters:
  `msg` - is the message itself.
  `level` - is the level to generate the log message for.

#### getEnvValue

    public java.lang.String getEnvValue(java.lang.String envVariable)

Get the value of the environment variable.

Parameters:
  `envVariable` - the environment variable whose value you want.
Returns:
  String corresponding to the value of the environment variable if it is set. null if the environment variable is not set

#### getCommandLineOptions

    protected java.lang.String[] getCommandLineOptions()

Returns the command line arguments passed to the executable

Returns:
  command line arguments passed to the executable

#### sanityCheckOnProperties

    protected void sanityCheckOnProperties()

Does a sanity check on the properties to make sure that all the required properties are loaded.