mwalk Platform 0.3.0

mwalk.core
Class Config

java.lang.Object
  |
  +--mwalk.core.Config

public class Config
extends java.lang.Object

A static class that is used to parse the command-line for options and provides some common functionality to all other system components.

If a configuration file is passed in then that file will be read an its contents will be made available to other components through as key/value pairs.

Version:
1.0
Author:
Robert Chalmers

Field Summary
protected static java.lang.String cfgFile
          Configuration file name
protected static java.util.Properties cfgProp
          Parsed configuration hash table
static java.lang.String[] dirs
          List of directories to check for input files
static boolean gatewayOnly
          Whether to allow only gateway traces
static boolean pause
          Whether to pause at each node before continuing walk
static java.lang.String readTree
          Name of input tree file
protected static boolean skip
          Internal parsing flag
static java.lang.String source
          Source host or IP address to use in new tree
static boolean verbose
          Verbosity flag
static java.lang.String[] visitors
          List of visitors to animate with
static java.lang.String writeTree
          Name of output tree file
 
Constructor Summary
protected Config()
          Default constructor.
 
Method Summary
static java.lang.String getCfg(java.lang.String key)
          Lookup a configuration value based on its key.
static void loadCfg(java.lang.String cfgFile)
          Load configuration file as a set of key/value pairs.
static void parseArgs(java.lang.String[] args)
          Parse the command-line arguments.
private static boolean parseFlag(java.lang.String[] args, int arg, char flag)
          Parse parameter flags.
static void pause()
          Pause and wait for a keystroke if the pause flag is set.
static void pause(java.lang.String prompt)
          Pause and wait for a keystroke if the pause flag is set.
static void pause(Visitor visitor)
          Pause and wait for a keystroke if the pause flag is set and the visitor is verbose.
static void pause(Visitor visitor, java.lang.String prompt)
          Pause and wait for a keystroke if the pause flag is set and the visitor is verbose.
static void printUsage()
          Print usage information.
static void setDirs(java.lang.String dirList)
          Parse an array of directories from a comma separated list.
private static void setSkip()
          Set the skip flag if the next argument has been used.
static void setVisitors(java.lang.String visitorList)
          Parse and array of visitor classes from a comma separated list.
static void verbose(java.lang.Exception debug)
          Print if the verbose flag is set.
static void verbose(java.lang.String debug)
          Print if the verbose flag is set.
static void verbose(Visitor visitor, java.lang.String debug)
          Print if the visitor is verbose and the verbose flag is set.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

readTree

public static java.lang.String readTree
Name of input tree file

writeTree

public static java.lang.String writeTree
Name of output tree file

dirs

public static java.lang.String[] dirs
List of directories to check for input files

visitors

public static java.lang.String[] visitors
List of visitors to animate with

source

public static java.lang.String source
Source host or IP address to use in new tree

verbose

public static boolean verbose
Verbosity flag

pause

public static boolean pause
Whether to pause at each node before continuing walk

gatewayOnly

public static boolean gatewayOnly
Whether to allow only gateway traces

cfgFile

protected static java.lang.String cfgFile
Configuration file name

cfgProp

protected static java.util.Properties cfgProp
Parsed configuration hash table

skip

protected static boolean skip
Internal parsing flag
Constructor Detail

Config

protected Config()
Default constructor. Protected to disallow creation of Config objects. There should only be a single static Config object. used as a static object.
Method Detail

parseArgs

public static void parseArgs(java.lang.String[] args)
Parse the command-line arguments.
Parameters:
String[] - command-line arguments

setSkip

private static void setSkip()
Set the skip flag if the next argument has been used. If skip is already set, then print usage.

parseFlag

private static boolean parseFlag(java.lang.String[] args,
                                 int arg,
                                 char flag)
Parse parameter flags.
Parameters:
String[] - argument list
int - current argument
char - current flag
Returns:
boolean whether the flag was handled

printUsage

public static void printUsage()
Print usage information.

setDirs

public static void setDirs(java.lang.String dirList)
Parse an array of directories from a comma separated list.
Parameters:
String - list of directories

setVisitors

public static void setVisitors(java.lang.String visitorList)
Parse and array of visitor classes from a comma separated list.
Parameters:
String - list of visitors

loadCfg

public static void loadCfg(java.lang.String cfgFile)
Load configuration file as a set of key/value pairs.
Parameters:
String - complete path to config file

getCfg

public static java.lang.String getCfg(java.lang.String key)
Lookup a configuration value based on its key.
Parameters:
String - config key
Returns:
String config value

verbose

public static void verbose(java.lang.String debug)
Print if the verbose flag is set.
Parameters:
String - text to print

verbose

public static void verbose(Visitor visitor,
                           java.lang.String debug)
Print if the visitor is verbose and the verbose flag is set.
Parameters:
Visitor - visitor to check for verbosity
String - text to print

verbose

public static void verbose(java.lang.Exception debug)
Print if the verbose flag is set.
Parameters:
Exception - exception with text to print

pause

public static void pause()
Pause and wait for a keystroke if the pause flag is set.

pause

public static void pause(java.lang.String prompt)
Pause and wait for a keystroke if the pause flag is set.
Parameters:
String - prompt string

pause

public static void pause(Visitor visitor)
Pause and wait for a keystroke if the pause flag is set and the visitor is verbose.
Parameters:
Visitor - visitor to check for verbosity

pause

public static void pause(Visitor visitor,
                         java.lang.String prompt)
Pause and wait for a keystroke if the pause flag is set and the visitor is verbose.
Parameters:
Visitor - visitor to check for verbosity
String - prompt string

mwalk Platform 0.3.0

Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers