public abstract class Executable extends Object
Modifier and Type | Field and Description |
---|---|
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 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 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.
|
protected LogManager mLogger
protected PegasusProperties mProps
protected String mVersion
protected String mLogMsg
private String[] commandLineOpts
public Executable()
public Executable(LogManager logger)
logger
- the logger to use. Can be null.protected String lookupConfProperty(String[] opts, char confChar)
opts
- command line arguments passed to the executableconfChar
- the short option corresponding to the conf propertyprotected void initialize(String[] opts, char confChar)
opts
- the command line argument passed by the userconfChar
- the short option corresponding the conf property.protected void initialize(String[] opts)
opts
- the command line argument passed to the executablepublic static String convertException(Exception e)
e
- the Exception for which the error message has to be composed.public static String convertException(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 IOException
logger
- the logger to use. Can be null.properties
- reference of pegasus properties object.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 String getGVDSVersion()
public void log(String msg, int level)
msg
- is the message itself.level
- is the level to generate the log message for.public String getEnvValue(String envVariable)
envVariable
- the environment variable whose value you want.protected String[] getCommandLineOptions()
protected void sanityCheckOnProperties()