edu.isi.pegasus.planner.client
Class Executable

java.lang.Object
  extended by edu.isi.pegasus.planner.client.Executable
Direct Known Subclasses:
CPlanner, NetloggerExitcode, PartitionDAX, PegasusGetSites, PlotNodeUsage, PlotSpaceUsage, RankDAX, SCClient, TCClient, TCConverter, VDS2PegasusProperties

public abstract class Executable
extends Object

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

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

Field Summary
private  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  String mLogMsg
          The error message to be logged.
protected  PegasusProperties mProps
          The object holding all the properties pertaining to Pegasus.
protected  String mVersion
          It stores the verison of the Griphyn Virtual Data System software.
 
Constructor Summary
Executable()
          The default constructor.
Executable(LogManager logger)
          The constructor which ends up initialising the PegasusProperties object.
 
Method Summary
static String convertException(Exception e)
          Returns an error message that chains all the lower order error messages that might have been thrown.
static String convertException(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  String[] getCommandLineOptions()
          Returns the command line arguments passed to the executable
 String getEnvValue(String envVariable)
          Get the value of the environment variable.
 String getGVDSVersion()
          Returns the version of the Griphyn Virtual Data System.
protected  void initialize(String[] opts)
          Initialize the executable object
protected  void initialize(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(String msg, int level)
          Logs messages to the singleton logger.
protected  String lookupConfProperty(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 String mVersion
It stores the verison of the Griphyn Virtual Data System software.


mLogMsg

protected String mLogMsg
The error message to be logged.


commandLineOpts

private 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 String lookupConfProperty(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(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(String[] opts)
Initialize the executable object

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

convertException

public static String convertException(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 String convertException(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 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:
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 String getGVDSVersion()
Returns the version of the Griphyn Virtual Data System.


log

public void log(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 String getEnvValue(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 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.



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