|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.core.resource.Vault
The Vault handles policies for allocating/deallocating scarce resources and stores application configuration properties.
Since our code might be deployed in different environments, this class provides a deployment-neutral way of retrieving scarce resources and configuration properties. Our application code may be deployed as a daemon, command-line interface, graphical user interface, applet, or servlet. Some of the scarce resources we might like to have allocation policies for are database connections, socket connections, RMI connections, CORBA connections, or open temporary files.
Field Summary | |
protected static DbConnectionFactory |
dbConnectionFactory
A delegate object that encapsulates the JDBC database connection allocation management. |
protected static java.lang.String |
homeDir
Stores the directory where the OpenNMS configuration files can be found. |
protected static java.util.Properties |
properties
Holds all the application configuration properties. |
Constructor Summary | |
private |
Vault()
Private, empty constructor so that this class cannot be instantiated. |
Method Summary | |
static java.sql.Connection |
getDbConnection()
Retrieve a database connection from the database connection factory. |
static java.lang.String |
getHomeDir()
Get the directory that holds the OpenNMS configuration files. |
static java.util.Properties |
getProperties()
Return the entire set of application configuration properties. |
static java.lang.String |
getProperty(java.lang.String key)
Return property from the configuration parameter list. |
static void |
releaseDbConnection(java.sql.Connection connection)
Replace a database connection from the database connection factory. |
static void |
setDbConnectionFactory(DbConnectionFactory factory)
Set the delegate class for managing JDBC database connection pools. |
static void |
setHomeDir(java.lang.String homeDir)
Set the directory so we will know where we can get the OpenNMS configuration files. |
static void |
setProperties(java.util.Properties properties)
Set the application configuration properties. |
static boolean |
supplementSystemPropertiesFromKey(java.lang.String key)
Adds new keys to the system properties using the passed key name a the properties location instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.util.Properties properties
protected static java.lang.String homeDir
protected static DbConnectionFactory dbConnectionFactory
Constructor Detail |
private Vault()
Method Detail |
public static void setDbConnectionFactory(DbConnectionFactory factory)
Vault
in different
environments and using different database connection pooling models.
public static java.sql.Connection getDbConnection() throws java.sql.SQLException
DbConnectionFactory
, this method may wait
until a connection is available.
java.sql.SQLException
- If a SQL error occurs while requesting or allocating the
connection. This depends on the implementation of
DbConnectionFactory
being used.
java.lang.IllegalStateException
- If no DbConnectionFactory
has
been specified.public static void releaseDbConnection(java.sql.Connection connection) throws java.sql.SQLException
connection
- the connection to release
java.sql.SQLException
- If a SQL error occurs while replacing or deallocating the
connection. This depends on the implementation of
DbConnectionFactory
being used.
java.lang.IllegalStateException
- If no DbConnectionFactory
has
been specified.public static void setProperties(java.util.Properties properties)
public static java.util.Properties getProperties()
public static java.lang.String getProperty(java.lang.String key)
public static void setHomeDir(java.lang.String homeDir)
public static java.lang.String getHomeDir()
public static boolean supplementSystemPropertiesFromKey(java.lang.String key)
Adds new keys to the system properties using the passed key name a the
properties location instance. The passed key is used as a key to the
system property
to find the
supplementary property information. The returned value should be in the
form of a list of file names, each separated by the system
separator
character.
Once the list of files is recovered, each file is visited and loaded into the system properties. If any file cannot be loaded due to an I/O error then it is skipped as a whole. No partial key sets are laoded into the system properties. Also, this method will not overwrite an existing key in the currently loaded properties.
key
- The key name used to lookup the property path values.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |