|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ail.core.configure.AbstractConfigurationLoader
com.ail.core.configure.JDBCConfigurationLoader
public class JDBCConfigurationLoader
This class handles the loading and saving of property (configuration) information held in a JDBC datastore.
This loader expects the loader.property file to define the following (as a minimum):
driver - the JDBC driver class to use.url - The database connection url.databaseName - The name of the database in which table can be found.table - The name of the database table holding configuration information.user - The db user to use when accessing the database.password - The db user's password.table above) is expected to match the
description below. Assuming that the user has the necessary
privilages, this table will be created automatically:+---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ | namespace | varchar(255) | | | | | | manager | varchar(255) | | | | | | configuration | longblob | | | | | | validfrom | bigint(20) | | | 0 | | | validto | bigint(20) | YES | | NULL | | | who | varchar(32) | | | | | | version | varchar(32) | | | | | +---------------+---------------+------+-----+---------+-------+
| Constructor Summary | |
|---|---|
JDBCConfigurationLoader()
|
|
| Method Summary | |
|---|---|
void |
deleteConfigurationRepository()
Delete the repository holding configuration information. |
java.util.Collection<java.lang.String> |
getNamespaces()
Return a list of all the namespaces in the database which have a validTo date of 0. |
java.util.Collection<ConfigurationSummary> |
getNamespacesHistorySummary(java.lang.String namespace)
Return details of a namespaces versions. |
java.util.Collection<ConfigurationSummary> |
getNamespacesSummary()
Return a list of details of all the namespaces in the database which have a validTo date of 0. |
Configuration |
loadConfiguration(java.lang.String namespace,
VersionEffectiveDate date)
Load a namespace's configuration. |
java.sql.Connection |
openConnection()
Open a connection to the configuration database. |
void |
purgeAllConfigurations()
Delete ALL configuration information. |
void |
reset()
When the configuration handler is asked to "reset", it passes that request onto the loader currently in user. |
void |
saveConfiguration(java.lang.String namespace,
Configuration config)
Save a configuration into the database. |
| Methods inherited from class com.ail.core.configure.AbstractConfigurationLoader |
|---|
getLoaderParams, loadLoader |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDBCConfigurationLoader()
| Method Detail |
|---|
public java.sql.Connection openConnection()
public Configuration loadConfiguration(java.lang.String namespace,
VersionEffectiveDate date)
validFrom and
validTo timestamp. The latest version of the configuration
will have the validTo set to zero.NOTE: If either the database or table specified in loader.properties do not exist when the system starts, this method handles this like a missing namespace. But if the system is live, and the table disappears, that is recognised as an error.
loadConfiguration in class AbstractConfigurationLoadernamespace - The namespace to load.date - The date to load the namespace for.
UnknownNamespaceError - if the namespace does not exist, or is not valid for the date specificed.
public void saveConfiguration(java.lang.String namespace,
Configuration config)
If either the database or table specified in loader.properties does not exist on the first attempt to save a configuration, this method will attempt to create both. For this to work the db user specified in loader.properties must have the necessary 'GRANTS' for table and database creation.
saveConfiguration in class AbstractConfigurationLoadernamespace - The namespace the configuration is associated with.config - The configuration to be saved.
BootstrapConfigurationError - if the configuration cannot be serialized, or the database access fails.public java.util.Collection<java.lang.String> getNamespaces()
getNamespaces in class AbstractConfigurationLoaderpublic java.util.Collection<ConfigurationSummary> getNamespacesSummary()
getNamespacesSummary in class AbstractConfigurationLoaderpublic java.util.Collection<ConfigurationSummary> getNamespacesHistorySummary(java.lang.String namespace)
getNamespacesHistorySummary in class AbstractConfigurationLoadernamespace - The namespace to fetch the history for.
ConfigurationSummary representing
the history of the specified namespace.public void reset()
reset in class AbstractConfigurationLoaderpublic void deleteConfigurationRepository()
purgeAllConfigurations() but also removes the
repository itself.NOTE: ALL CONFIGURATION INFORMATION WILL BE LOST!
In the context of the JDBCConfigurationLoader this simply means droping the config table.
deleteConfigurationRepository in class AbstractConfigurationLoaderpublic void purgeAllConfigurations()
NOTE: ALL CONFIGURATION INFORMATION WILL BE LOST! In the context of the JDBCConfigurationLoader this means delete all the records from the configuration table.
purgeAllConfigurations in class AbstractConfigurationLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||