|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.service.dashboard.DashboardConfig
public abstract class DashboardConfig
An abstract class giving access to the global Dashboard configuration. It also allows to add additional configuration files (which may be useful for new panels).
The class uses Apache
Commons Configuration - the method get()
gives back
directly an Apache's CompositeConfiguration instance
allowing to fine-tune your configuration (if needed, at all).
Field Summary | |
---|---|
static String |
DASHBOARD_CONFIG_FILENAME
A filename indicating a file containing Dasboard run-time properties. |
static String |
PROP_DASHBOARD_CONFIGURATION
A property name. |
Constructor Summary | |
---|---|
DashboardConfig()
|
Method Summary | |
---|---|
static boolean |
addConfigPropertyFile(String configFilename)
Add new configuration properties from a property file. |
static org.apache.commons.configuration.CompositeConfiguration |
get()
The main method returning a configuration object. |
static int |
getInt(String key,
int defaultValue)
Get an integer value associated with the given configuration key, or - if not found or not of integer value - get the given default value. |
static String |
getString(String key,
String defaultValue)
Get a string associated with the given configuration key, or - if not found - get the given default value (which still may be null). |
static String[] |
getStrings(String key,
String defaultValue)
Almost the same functionality as getString
method. |
static boolean |
isEnabled(String key,
boolean defaultValue,
String serviceName,
Object owner)
Get a boolean value associated with the given configuration key, or - if not found - get the given default value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DASHBOARD_CONFIG_FILENAME
PROP_DASHBOARD_CONFIGURATION
to point to a
different file name.
public static final String PROP_DASHBOARD_CONFIGURATION
DASHBOARD_CONFIG_FILENAME
.
Constructor Detail |
---|
public DashboardConfig()
Method Detail |
---|
public static org.apache.commons.configuration.CompositeConfiguration get()
The configuration object contains all Java system properties
and properties read from a Dashboard configuration file. This
file name is given by the system property PROP_DASHBOARD_CONFIGURATION
, or using a default name DASHBOARD_CONFIG_FILENAME
. If the filename does not specify
an absolute path, the file will be searched automatically in
the following locations:
The System properties take precedence over properties read from the Dashboard property file.
The configuration object can be anytime extended by properties
from other sources by using either methods defined in the
CompositeConfiguration's API, or using a convenient
method addConfigPropertyFile(java.lang.String)
defined here. Properties
from these additional files have higher priority than
properties added earlier - except System properties, they are
always the most prioritized.
public static boolean addConfigPropertyFile(String configFilename)
The newly added properties have higher priority than properties added earlier - except System properties, they are always the most prioritized.
configFilename
- is a filename indicating a file
(formatted as a Java properties file) with new properties (see
get()
explaining where is this file looked for)
public static String getString(String key, String defaultValue)
It is a convenient way to say:
String value = Config.get().getString ("my.property", "yes");
key
- is a property namedefaultValue
- used if the 'key' cannot be found
public static String[] getStrings(String key, String defaultValue)
getString
method. The different is the return value: this method allows
to return several values of the same property. In the
configuration file, a property can be repeated, or can have
several comma-separated values. By the way, the importance of a comma in a property value also means that any 'normal' (the one not meant as a value separator) commas in property values, must be escaped by backslashes.
public static int getInt(String key, int defaultValue)
key
- is a property namedefaultValue
- used if the 'key' cannot be found, or if it
is not an integer
public static boolean isEnabled(String key, boolean defaultValue, String serviceName, Object owner)
key
- is a property namedefaultValue
- used if the 'key' cannot be found, or if
its value is empty
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |