public abstract class Executable
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Executable()
The default constructor.
|
Executable(LogManager logger)
The constructor which ends up initialising the PegasusProperties object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected LogManager mLogger
protected PegasusProperties mProps
protected java.lang.String mVersion
protected java.lang.String mLogMsg
private java.lang.String[] commandLineOpts
public Executable()
public Executable(LogManager logger)
logger
- the logger to use. Can be null.protected java.lang.String lookupConfProperty(java.lang.String[] opts, char confChar)
opts
- command line arguments passed to the executableconfChar
- the short option corresponding to the conf propertyprotected void initialize(java.lang.String[] opts, char confChar)
opts
- the command line argument passed by the userconfChar
- the short option corresponding the conf property.protected void initialize(java.lang.String[] opts)
opts
- the command line argument passed to the executablepublic static java.lang.String convertException(java.lang.Exception e)
e
- the Exception for which the error message has to be composed.public static java.lang.String convertException(java.lang.Exception e, int logLevel)
e
- the Exception for which the error message has to be composed.logLevel
- the user specified level for the loggerprotected void setupLogging(LogManager logger, PegasusProperties properties) throws java.io.IOException
logger
- the logger to use. Can be null.properties
- reference of pegasus properties object.java.io.IOException
public abstract void loadProperties()
public abstract void printLongVersion()
public abstract void printShortVersion()
public abstract gnu.getopt.LongOpt[] generateValidOptions()
LongOpt
objects which contain
all the valid options to the Executable.public java.lang.String getGVDSVersion()
public void log(java.lang.String msg, int level)
msg
- is the message itself.level
- is the level to generate the log message for.public java.lang.String getEnvValue(java.lang.String envVariable)
envVariable
- the environment variable whose value you want.protected java.lang.String[] getCommandLineOptions()
protected void sanityCheckOnProperties()