public final class ConfigProperties
extends java.lang.Object
DeltaXML's configuration properties are used to control the behaviour of DeltaXML products. For example, for those products that support OASIS catalogs, they provide a facility to specify where these catalogs are located. Each product will specify the properties that can be configured.
A configuration property is constructed from a triple:
A configuration properties object will contain those properties that are specified by an external DeltaXML configuration file (
deltaxmlConfig.xml
), which is typically located in the same directory as the product's library (e.g.
product.jar
file). We refer to this directory as the installation directory for the remainder of this
discussion on configuration properties. If the file cannot be found in the installation directory then it is looked for in the
user's home directory, and then the current working directory.
It is sometimes useful to be able to specify a property in terms of other properties. For example, it would be possible to
specify a property P
in terms of a property Q
by including the text ${Q}
in
P
's value. Note that Java system properties, such as user.home
and user.dir
can be
referred to in this way (i.e. ${user.home}
and ${user.dir}
respectively). We also provide an
install.dir
property, for locating the product's installation directory, when this information is obtainable from
the JVM. Some application servers prevent the automatic installation directory detection from working.
A DeltaXML configuration file can specify a search path list to look for additional properties to be set (or overridden - if they have not previously been fixed). Here, the first search path in the list that exists is loaded; all other entries in the search path are ignored. Further, any attempt to reload a previously visited configuration file will finish the configuration file loading process.
Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(java.lang.String key)
Get the boolean value of a property.
|
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Get the boolean value of a property.
|
java.lang.String |
getProperty(java.lang.String key)
Get the value of a property.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Get the value of a property.
|
static ConfigProperties |
getSystemConfig()
Get the system wide configuration properties.
|
boolean |
loadPropsFile(java.io.File propsFile)
Load a DeltaXML configuration file.
|
void |
resolveProperties()
Add the DeltaXML configuration properties to the standard system properties.
|
java.lang.String |
setProperty(java.lang.String key,
java.lang.String value,
boolean fixed)
Set a DeltaXML configuration property.
|
public static ConfigProperties getSystemConfig()
public boolean loadPropsFile(java.io.File propsFile)
propsFile
- the configuration file to load.public java.lang.String getProperty(java.lang.String key)
key
- The property to be found.public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- The property to be found.defaultValue
- The value to be used if the property does not exist.public boolean getBoolean(java.lang.String key)
key
- The property to be found.public boolean getBoolean(java.lang.String key, boolean defaultValue)
key
- The property to be found.defaultValue
- The value to be used if the property does not exist.public void resolveProperties()
public java.lang.String setProperty(java.lang.String key, java.lang.String value, boolean fixed)
key
- The property name.value
- The property value. Note this may contain references to other properties using the
${name}syntax.
fixed
- Whether this property can be overridden in the future.Copyright © 2001-2016 DeltaXML Ltd. All Rights Reserved.