|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
edu.sdsc.inca.util.ConfigProperties
public class ConfigProperties
This is an extension of the standard Properties class that can generate elements by command-line parsing and by stripping prefixes from the elements of Properties objects--both useful in generating configuration values.
| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
ConfigProperties()
|
|
| Method Summary | |
|---|---|
void |
loadFromFile(java.lang.String path,
java.lang.String prefix)
Reads properties from a file, retaining only those properties that have a name starting with the given prefix. |
void |
loadFromResource(java.lang.String res,
java.lang.String prefix)
Reads properties from a resource, retaining only those properties that have a name starting with the given prefix. |
void |
loadFromStream(java.io.InputStream stream,
java.lang.String prefix)
Reads properties from an input stream, retaining only those properties that have a name starting with the given prefix. |
static java.lang.String |
mergeValidOptions(java.lang.String valid1,
java.lang.String valid2,
boolean sort)
Merges two strings of the form accepted by setPropertiesFromArgs. |
void |
putAllTrimmed(java.util.Properties p,
java.lang.String prefix)
Like putAll, but only copies those elements that have a name starting with the given prefix. |
void |
setPropertiesFromArgs(java.lang.String valid,
java.lang.String[] args)
Parses command-line arguments, storing each option/value pair as a property. |
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigProperties()
| Method Detail |
|---|
public void loadFromFile(java.lang.String path,
java.lang.String prefix)
throws java.io.IOException
path - Path to file to open and load.prefix - Property name prefix to test and trim.
java.io.IOException
public void loadFromResource(java.lang.String res,
java.lang.String prefix)
throws java.io.IOException
res - Resource to open and load.prefix - Property name prefix to test and trim.
java.io.IOException
public void loadFromStream(java.io.InputStream stream,
java.lang.String prefix)
throws java.io.IOException
stream - Resource to open and load.prefix - Property name prefix to test and trim.
java.io.IOException
public void putAllTrimmed(java.util.Properties p,
java.lang.String prefix)
p - Properties to copy.prefix - Property name prefix to test and trim.
public void setPropertiesFromArgs(java.lang.String valid,
java.lang.String[] args)
throws ConfigurationException
valid - A newline-delimited list of descriptions about valid options.
The tokens in each option description list the option name
(or names, separated by "|") and option type ("null" for
options that take no value). Any text after the option type
is ignored, making it easy to reuse the valid option
description for user help.args - Command-line arguments from main().
ConfigurationException
public static java.lang.String mergeValidOptions(java.lang.String valid1,
java.lang.String valid2,
boolean sort)
valid1 - the first set of optionsvalid2 - the second set of options
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||