org.edg.data.util
Class CommandConfiguration

java.lang.Object
  |
  +--org.edg.data.util.CommandConfiguration

public class CommandConfiguration
extends java.lang.Object

Encapsulates the configuration file for a command. Currently this usesa properties file

Version:
$ Id:$
Author:
James Casey

Constructor Summary
CommandConfiguration(java.lang.String configResource)
          create a new configuratio object
 
Method Summary
 org.edg.data.util.CommandDescriptor getCommandDescriptor(java.lang.String command)
          Take a possible command name or shortcut, and return the actual command name it maps to.
 java.lang.String getProgramName()
          the program name that is being run
 java.lang.String getProperty(java.lang.String key)
          Deprecated. Get a property from the configuration resource specified in the constructor, throwing an exception if it is not found.
 void printHelp(boolean withCommandList, org.apache.commons.cli.Options opts, java.io.PrintStream output)
          Print the usage message on the screen, with additional help on the list of available commands if requested with the -h option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandConfiguration

public CommandConfiguration(java.lang.String configResource)
                     throws InvalidConfigurationException,
                            java.io.FileNotFoundException
create a new configuratio object

Parameters:
configResource - the resource on the classpath from which to read our configuration
Throws:
InvalidConfigurationException - if a problem
java.io.FileNotFoundException
Method Detail

getProgramName

public java.lang.String getProgramName()
the program name that is being run

Returns:
the program name

getProperty

public java.lang.String getProperty(java.lang.String key)
                             throws InvalidConfigurationException
Deprecated. Get a property from the configuration resource specified in the constructor, throwing an exception if it is not found.

Parameters:
key - the key
Returns:
the property string
Throws:
InvalidConfigurationException - if the key is not found in the file.

getCommandDescriptor

public org.edg.data.util.CommandDescriptor getCommandDescriptor(java.lang.String command)
Take a possible command name or shortcut, and return the actual command name it maps to.

Parameters:
command - the command or shortcut to check
Returns:
the command. This returns null if the command is not found in the configuration object

printHelp

public void printHelp(boolean withCommandList,
                      org.apache.commons.cli.Options opts,
                      java.io.PrintStream output)
               throws InvalidConfigurationException
Print the usage message on the screen, with additional help on the list of available commands if requested with the -h option.

Parameters:
withCommandList -
opts -
output -
Throws:
InvalidConfigurationException