|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object seda.sandStorm.main.SandstormConfig
public class SandstormConfig
This class is used to pass configuration parameters into Sandstorm at startup time. It reads initial configuration parameters from a file, using an XML-like format. Various operations can be performed upon this class to modify the configuration of the Sandstorm runtime.
Sandstorm
,
Main
Nested Class Summary | |
---|---|
(package private) class |
SandstormConfig.configSection
|
(package private) class |
SandstormConfig.directiveReader
Internal class to preprocess special directives in the config file. |
Field Summary | |
---|---|
private java.util.Hashtable |
cmdLineArgs
|
static java.lang.String |
CONFIG_FALSE
String value for setting boolean configuration entries to false. |
static java.lang.String |
CONFIG_TRUE
String value for setting boolean configuration entries to true. |
private static boolean |
DEBUG
|
java.util.Hashtable |
defaultInitArgs
Default initialization arguments passed to every stage. |
static java.lang.String[] |
defaults
The set of default values for the Sandstorm configuration. |
private static java.lang.String |
DELIM_CHAR
|
static java.lang.String |
LIST_ELEMENT_DELIMITER
|
private static int |
MAX_DIRECTIVE_LENGTH
|
private SandstormConfig.configSection |
root
|
private java.util.Hashtable |
stages
|
static java.lang.String |
THREADMGR_AggTPSTM
Value for defaultThreadMgr to use the aggregating TPSTM. |
static java.lang.String |
THREADMGR_TPPTM
Value for defaultThreadMgr to use the thread-per-CPU thread manager. |
static java.lang.String |
THREADMGR_TPSTM
Value for defaultThreadMgr to use the thread-per-stage thread manager. |
Constructor Summary | |
---|---|
SandstormConfig()
Create a new SandstormConfig with the default settings. |
|
SandstormConfig(java.lang.String fname)
Create a new SandstormConfig, reading the configration from the given file. |
|
SandstormConfig(java.lang.String[] defaultArgs)
Create a new SandstormConfig with the default settings, with the given default init args, which will be passed to every stage. |
|
SandstormConfig(java.lang.String fname,
java.lang.String[] defaultArgs)
Create a new SandstormConfig, reading the configration from the given file. |
Method Summary | |
---|---|
void |
addStage(java.lang.String stageName,
java.lang.String className,
java.lang.String[] initargs)
Add a stage to this SandstormConfig. |
boolean |
getBoolean(java.lang.String key)
Return the configuration option associated with the given key as a boolean. |
boolean |
getBoolean(java.lang.String key,
boolean defaultval)
Return the configuration option associated with the given key as a boolean. |
SandstormConfig |
getCopy()
Return a copy of this object. |
double |
getDouble(java.lang.String key)
Return the configuration option associated with the given key as a double. |
double |
getDouble(java.lang.String key,
double defaultval)
Return the configuration option associated with the given key as a double. |
int |
getInt(java.lang.String key)
Return the configuration option associated with the given key as an int. |
int |
getInt(java.lang.String key,
int defaultval)
Return the configuration option associated with the given key as an int. |
java.util.Enumeration |
getKeys()
Return an enumeration of the top-level keys in this configuration. |
private java.util.Enumeration |
getKeys(SandstormConfig.configSection cs,
java.lang.String prefix)
|
java.util.Enumeration |
getKeys(java.lang.String prefix)
Return an enumeration of the keys matching the given prefix. |
java.util.Enumeration |
getStages()
Return an Enumeration of the stages specified by this SandstormConfig. |
java.lang.String |
getString(java.lang.String key)
Return the configuration option associated with the given key as a String. |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultval)
Return the configuration option associated with the given key as a String. |
java.lang.String[] |
getStringList(java.lang.String key)
Get the string list value corresponding to the given key. |
private java.lang.String |
getVal(SandstormConfig.configSection cs,
java.lang.String key)
|
void |
putBoolean(java.lang.String key,
boolean val)
Set the given configuration option specified as a boolean. |
void |
putDouble(java.lang.String key,
double val)
Set the given configuration option specified as an int. |
void |
putInt(java.lang.String key,
int val)
Set the given configuration option specified as an int. |
void |
putString(java.lang.String key,
java.lang.String val)
Set the given configuration option specified as a String. |
void |
puttStringList(java.lang.String key,
java.lang.String[] valarr)
Set the given key to the given string list value. |
private void |
putVal(SandstormConfig.configSection cs,
java.lang.String key,
java.lang.String val)
|
void |
readFile(java.lang.String fname)
Read the configuration from the given file. |
private java.util.Hashtable |
stringArrayToHT(java.lang.String[] arr)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final java.lang.String DELIM_CHAR
private static final int MAX_DIRECTIVE_LENGTH
public static final java.lang.String LIST_ELEMENT_DELIMITER
private SandstormConfig.configSection root
private java.util.Hashtable stages
public static final java.lang.String THREADMGR_TPPTM
public static final java.lang.String THREADMGR_TPSTM
public static final java.lang.String THREADMGR_AggTPSTM
public static final java.lang.String CONFIG_TRUE
public static final java.lang.String CONFIG_FALSE
public static final java.lang.String[] defaults
private java.util.Hashtable cmdLineArgs
public java.util.Hashtable defaultInitArgs
Constructor Detail |
---|
public SandstormConfig()
public SandstormConfig(java.lang.String[] defaultArgs) throws java.io.IOException
java.io.IOException
public SandstormConfig(java.lang.String fname) throws java.io.IOException
java.io.IOException
public SandstormConfig(java.lang.String fname, java.lang.String[] defaultArgs) throws java.io.IOException
defaultInitArgs
- Default initialization arguments passed to
every stage. These override any arguments found in the config file.
Each element of this array must be a string with the format
"key=value".
java.io.IOException
Method Detail |
---|
private java.lang.String getVal(SandstormConfig.configSection cs, java.lang.String key)
private void putVal(SandstormConfig.configSection cs, java.lang.String key, java.lang.String val)
public java.lang.String getString(java.lang.String key)
public java.lang.String getString(java.lang.String key, java.lang.String defaultval)
public void putString(java.lang.String key, java.lang.String val)
public boolean getBoolean(java.lang.String key)
public boolean getBoolean(java.lang.String key, boolean defaultval)
public void putBoolean(java.lang.String key, boolean val)
public int getInt(java.lang.String key)
public int getInt(java.lang.String key, int defaultval)
public void putInt(java.lang.String key, int val)
public double getDouble(java.lang.String key)
public double getDouble(java.lang.String key, double defaultval)
public java.lang.String[] getStringList(java.lang.String key)
public void putDouble(java.lang.String key, double val)
public void puttStringList(java.lang.String key, java.lang.String[] valarr)
private java.util.Enumeration getKeys(SandstormConfig.configSection cs, java.lang.String prefix)
public java.util.Enumeration getKeys(java.lang.String prefix)
public java.util.Enumeration getKeys()
public SandstormConfig getCopy()
public void addStage(java.lang.String stageName, java.lang.String className, java.lang.String[] initargs) throws StageNameAlreadyBoundException, java.io.IOException
stageName
- The name of the stage as it should be registered.className
- The fully-qualified class name of the stage event
handler.initargs
- The initial arguments to pass into the stage.
StageNameAlreadyBoundException
java.io.IOException
public java.util.Enumeration getStages()
public void readFile(java.lang.String fname) throws java.io.IOException
java.io.IOException
private java.util.Hashtable stringArrayToHT(java.lang.String[] arr) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |