com.bitmechanic.maxq
Class Config

java.lang.Object
  extended by com.bitmechanic.maxq.Config

public class Config
extends java.lang.Object

This singleton class stores all config information for MAXQ. Config data can be set through the maxq.properties file, or the command line.

Some people might think that this class is overkill, duplicating settings that need not be stored, etc. However those cynics should consider that this class is referred to in unit tests, and would also enable someone running MaxQ scripts from a JUnit test harness to modify options. Otherwise this would be impossible because the command-line would never be parsed.


Nested Class Summary
static class Config.ProxySettings
          This class represents the settings for the proxy *THAT MAXQ USES*.
 
Method Summary
 void addPythonPath(java.lang.String path)
           
 void completeInit()
          Call this when all configuration options have been set.
static Config getConfig()
           
static java.lang.String getDriverPkgName()
           
 java.util.List getExcludePatterns()
           
 java.lang.String getExist()
           
 java.util.List getIncludePatterns()
           
 int getPort()
           
 java.lang.String getProperty(java.lang.String prop)
          Returns null if the property is not found.
 java.lang.String getProperty(java.lang.String prop, java.lang.String def)
          Returns the string value of the property, or the given default if the property is missing or empty.
 java.lang.Integer getPropertyInt(java.lang.String prop)
          Returns the property as an integer.
 Config.ProxySettings getProxySettings()
           
 java.lang.String getPythonPath()
           
 java.lang.String getReplace()
           
 java.lang.String getScriptArg()
           
static org.apache.commons.logging.Log getTestLogger()
           
static java.lang.String getValidatorPkgName()
           
static void initConfig()
          Set up the properties file from the properties.file system property, defaulting to maxq.properties if it exists.
 boolean isDebug()
           
 boolean isQuiet()
           
 void setDebug(boolean d)
           
 void setExcludePatterns(java.lang.String[] pats)
           
 void setExist(java.lang.String e)
           
 void setIncludePatterns(java.lang.String[] pats)
           
 void setPort(int pt)
           
 void setProperty(java.lang.String property, java.lang.String value)
           
 void setProxySettings(Config.ProxySettings proxySettings)
           
 void setQuiet(boolean q)
           
 void setReplace(java.lang.String e)
           
 void setScriptArg(java.lang.String arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConfig

public static Config getConfig()

initConfig

public static void initConfig()
Set up the properties file from the properties.file system property, defaulting to maxq.properties if it exists.


completeInit

public void completeInit()
                  throws Utils.UserException
Call this when all configuration options have been set.

Throws:
Utils.UserException

getProperty

public java.lang.String getProperty(java.lang.String prop)
Returns null if the property is not found.


getProperty

public java.lang.String getProperty(java.lang.String prop,
                                    java.lang.String def)
Returns the string value of the property, or the given default if the property is missing or empty.


setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)

getPropertyInt

public java.lang.Integer getPropertyInt(java.lang.String prop)
                                 throws Utils.UserException
Returns the property as an integer.

Throws:
Utils.UserException

addPythonPath

public void addPythonPath(java.lang.String path)

getPythonPath

public java.lang.String getPythonPath()

setPort

public void setPort(int pt)

getPort

public int getPort()

setDebug

public void setDebug(boolean d)

isDebug

public boolean isDebug()

setQuiet

public void setQuiet(boolean q)

isQuiet

public boolean isQuiet()

setExist

public void setExist(java.lang.String e)

getExist

public java.lang.String getExist()

setReplace

public void setReplace(java.lang.String e)

getReplace

public java.lang.String getReplace()

setIncludePatterns

public void setIncludePatterns(java.lang.String[] pats)

setExcludePatterns

public void setExcludePatterns(java.lang.String[] pats)

getIncludePatterns

public java.util.List getIncludePatterns()

getExcludePatterns

public java.util.List getExcludePatterns()

setScriptArg

public void setScriptArg(java.lang.String arg)

getScriptArg

public java.lang.String getScriptArg()

getDriverPkgName

public static java.lang.String getDriverPkgName()

getValidatorPkgName

public static java.lang.String getValidatorPkgName()

getTestLogger

public static org.apache.commons.logging.Log getTestLogger()

getProxySettings

public Config.ProxySettings getProxySettings()

setProxySettings

public void setProxySettings(Config.ProxySettings proxySettings)