Class ServerProperties
A property object is checked once and all the errors are stored in collections to be used Meta records specify accepted keys and policies for the expected values.
Policy for defaults:
- If (non-null) default is specified for the Meta record, then behavior is obvious.
- If pattern-type Meta record, then there is no default. A value is required for the property.
- Otherwise null is specified for the Meta record and user must set a value.
If a set of values specified in the Meta record, then the value is checked against the set.
- Since:
- 1.9.0
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperties(Properties props) voidaddProperties(org.hsqldb.persist.HsqlProperties props) static org.hsqldb.persist.HsqlPropertiesargArrayToProps(String[] arg, String type) Creates and populates an HsqlProperties Object from the arguments array of a Main method.static org.hsqldb.persist.HsqlPropertiesdelimitedArgPairsToProps(String s, String pairsep, String dlimiter, String type) Creates and populates a new HsqlProperties Object using a string such as "key1=value1;key2=value2".String[]intgetIntegerProperty(String key, int defaultValue) static intgetIntegerProperty(Properties props, String key, int defaultValue) getProperty(String key) getProperty(String key, String defaultValue) booleanisEmpty()booleanisPropertyTrue(String key) booleanisPropertyTrue(String key, boolean defaultValue) booleanload()static org.hsqldb.persist.HsqlProperties.PropertyMetastatic org.hsqldb.persist.HsqlProperties.PropertyMetastatic org.hsqldb.persist.HsqlProperties.PropertyMetastatic org.hsqldb.persist.HsqlProperties.PropertyMetastatic org.hsqldb.persist.HsqlProperties.PropertyMetastatic org.hsqldb.persist.HsqlProperties.PropertyMetabooleanvoidremoveProperty(String key) voidsave()Saves the properties.voidSaves the propertiesvoidsetFileName(String name) setProperty(String key, boolean value) setProperty(String key, int value) setProperty(String key, String value) setPropertyIfNotExists(String key, String value) toString()voidvalidate()Validates according to Meta map, and sets System Properties for those properties with names matching the requisite pattern.static StringvalidateProperty(String key, String value, org.hsqldb.persist.HsqlProperties.PropertyMeta meta) Performs any range checking for property and return an error message
-
Field Details
-
ANY_ERROR
public static final int ANY_ERROR- See Also:
-
NO_VALUE_FOR_KEY
public static final int NO_VALUE_FOR_KEY- See Also:
-
-
Constructor Details
-
ServerProperties
- Throws:
IOException
-
-
Method Details
-
validate
public void validate()Validates according to Meta map, and sets System Properties for those properties with names matching the requisite pattern. -
setFileName
-
setProperty
-
setProperty
-
setProperty
-
setPropertyIfNotExists
-
getProperties
-
getProperty
-
getProperty
-
getIntegerProperty
-
getIntegerProperty
-
isPropertyTrue
-
isPropertyTrue
-
removeProperty
-
addProperties
-
addProperties
public void addProperties(org.hsqldb.persist.HsqlProperties props) -
propertiesFileExists
public boolean propertiesFileExists() -
load
-
save
-
save
-
argArrayToProps
Creates and populates an HsqlProperties Object from the arguments array of a Main method. Properties are in the form of "-key value" pairs. Each key is prefixed with the type argument and a dot before being inserted into the properties Object."--help" is treated as a key with no value and not inserted.
-
delimitedArgPairsToProps
public static org.hsqldb.persist.HsqlProperties delimitedArgPairsToProps(String s, String pairsep, String dlimiter, String type) Creates and populates a new HsqlProperties Object using a string such as "key1=value1;key2=value2".The string that represents the = sign above is specified as pairsep and the one that represents the semicolon is specified as delimiter, allowing any string to be used for either.
Leading / trailing spaces around the keys and values are discarded.
The string is parsed by (1) subdividing into segments by delimiter (2) subdividing each segment in two by finding the first instance of the pairsep (3) trimming each pair of segments from step 2 and inserting into the properties object.
Each key is prefixed with the type argument and a dot before being inserted.
Any key without a value is added to the list of errors.
-
propertyNames
-
isEmpty
public boolean isEmpty() -
getErrorKeys
-
newMeta
public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, long defaultVal) -
newMeta
-
newMeta
-
newMeta
public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, boolean defaultValue) -
newMeta
public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, int defaultValue, int[] values) -
newMeta
public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, int defaultValue, int rangeLow, int rangeHigh) -
validateProperty
-
toString
-