net.larsan.urd
Class CmdOptions

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--net.larsan.urd.CmdOptions
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class CmdOptions
extends java.util.HashMap

A simple command line parser class. This class takes the command line arguments and parses them for easier use in the application.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson
See Also:
Control, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
CmdOptions(java.lang.String[] args)
          Create options object
 
Method Summary
 java.lang.String getAddress()
          Get the root address.
 java.io.File getConfDir()
          Get the config folder path.
 java.io.File getLibDir()
          Get the library folder path.
 java.lang.String getPass()
          Get user password.
 int getPort()
          Get the root address port.
 java.io.File getRoot()
          Get the framework root.
 java.io.File getSystemDir()
          Get the system folder path.
 java.lang.String getUser()
          Get user name.
 boolean isVerbose()
          Check for versbose option.
static CmdOptions parse(java.lang.String[] args)
          Parse an array of arguments into a options object.
 boolean printHelp()
          Check for help option.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

CmdOptions

public CmdOptions(java.lang.String[] args)
Create options object

Parameters:
args - Command line arguments, must not be null
Method Detail

parse

public static CmdOptions parse(java.lang.String[] args)
Parse an array of arguments into a options object.

Parameters:
args - Comand line arguments, must not be null

printHelp

public boolean printHelp()
Check for help option.

Returns:
true If a help message is asked for

isVerbose

public boolean isVerbose()
Check for versbose option.

Returns:
true If a help message is asked for

getAddress

public java.lang.String getAddress()
Get the root address. Defaults to 'localhost' is not found.

Returns:
The root address

getUser

public java.lang.String getUser()
Get user name.

Returns:
The user name, or null if not specified

getPass

public java.lang.String getPass()
Get user password.

Returns:
The user password, or null if not specified

getPort

public int getPort()
Get the root address port. Defaults to '8666' is not found.

Returns:
The root address

getRoot

public java.io.File getRoot()
                     throws java.io.IOException
Get the framework root. Defaults to the work directory.

Returns:
The framework root folder
Throws:
java.io.IOException - If the root folder does not exist

getLibDir

public java.io.File getLibDir()
                       throws java.io.IOException
Get the library folder path. Default to 'common' under the work directory.

Returns:
the framework library folder
Throws:
java.io.IOException - If the library folder does not exist

getSystemDir

public java.io.File getSystemDir()
                          throws java.io.IOException
Get the system folder path. Default to 'system' under the work directory.

Returns:
the framework library folder
Throws:
java.io.IOException - If the library folder does not exist

getConfDir

public java.io.File getConfDir()
                        throws java.io.IOException
Get the config folder path. Default to 'conf' under the work directory.

Returns:
the framework library folder
Throws:
java.io.IOException - If the library folder does not exist