|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.event.EventSource
org.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.DatabaseConfiguration
public class DatabaseConfiguration
Configuration stored in a database.
| Field Summary |
|---|
| Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
|---|
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN |
| Constructor Summary | |
|---|---|
DatabaseConfiguration(DataSource datasource,
String table,
String keyColumn,
String valueColumn)
Build a configuration from a table |
|
DatabaseConfiguration(DataSource datasource,
String table,
String nameColumn,
String keyColumn,
String valueColumn,
String name)
Build a configuration from a table containing multiple configurations. |
|
| Method Summary | |
|---|---|
void |
addProperty(String key,
Object value)
Adds a property to this configuration. |
protected void |
addPropertyDirect(String key,
Object obj)
Adds a property to this configuration. |
void |
clear()
Removes all entries from this configuration. |
void |
clearProperty(String key)
Removes the specified value from this configuration. |
boolean |
containsKey(String key)
Checks whether this configuration contains the specified key. |
protected Connection |
getConnection()
Returns a Connection object. |
DataSource |
getDatasource()
Returns the used DataSource object. |
Iterator |
getKeys()
Returns an iterator with the names of all properties contained in this configuration. |
Object |
getProperty(String key)
Returns the value of the specified property. |
boolean |
isEmpty()
Checks if this configuration is empty. |
| Methods inherited from class org.apache.commons.configuration.event.EventSource |
|---|
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, clone, createErrorEvent, createEvent, fireError, fireEvent, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseConfiguration(DataSource datasource,
String table,
String nameColumn,
String keyColumn,
String valueColumn,
String name)
datasource - the datasource to connect to the databasetable - the name of the table containing the configurationsnameColumn - the column containing the name of the configurationkeyColumn - the column containing the keys of the configurationvalueColumn - the column containing the values of the configurationname - the name of the configuration
public DatabaseConfiguration(DataSource datasource,
String table,
String keyColumn,
String valueColumn)
datasource - the datasource to connect to the databasetable - the name of the table containing the configurationskeyColumn - the column containing the keys of the configurationvalueColumn - the column containing the values of the configuration| Method Detail |
|---|
public Object getProperty(String key)
EVENT_READ_PROPERTY with the causing exception. The
event's propertyName is set to the passed in property key,
the propertyValue is undefined.
key - the key of the desired property
protected void addPropertyDirect(String key,
Object obj)
EVENT_ADD_PROPERTY
with the causing exception. The event's propertyName is
set to the passed in property key, the propertyValue
points to the passed in value.
addPropertyDirect in class AbstractConfigurationkey - the property keyobj - the value of the property to add
public void addProperty(String key,
Object value)
getProperty()
will take care about delimiters. So list delimiters are fully supported
by DatabaseConfiguration, but internally treated a bit
differently.
addProperty in interface ConfigurationaddProperty in class AbstractConfigurationkey - the key of the new propertyvalue - the value to be addedpublic boolean isEmpty()
EVENT_READ_PROPERTY
with the causing exception. Both the event's propertyName
and propertyValue will be undefined.
isEmpty in interface ConfigurationisEmpty in class AbstractConfigurationpublic boolean containsKey(String key)
EVENT_READ_PROPERTY with the causing exception. The
event's propertyName will be set to the passed in key, the
propertyValue will be undefined.
containsKey in interface ConfigurationcontainsKey in class AbstractConfigurationkey - the key to be checked
public void clearProperty(String key)
EVENT_CLEAR_PROPERTY with the causing exception. The
event's propertyName will be set to the passed in key, the
propertyValue will be undefined.
clearProperty in interface ConfigurationclearProperty in class AbstractConfigurationkey - the key of the property to be removedpublic void clear()
EVENT_CLEAR with the causing exception. Both the
event's propertyName and the propertyValue
will be undefined.
clear in interface Configurationclear in class AbstractConfigurationpublic Iterator getKeys()
EVENT_READ_PROPERTY with the causing exception. Both the
event's propertyName and the propertyValue
will be undefined.
getKeys in interface ConfigurationgetKeys in class AbstractConfigurationpublic DataSource getDatasource()
DataSource object.
protected Connection getConnection()
throws SQLException
Connection object. This method is called when
ever the database is to be accessed. This implementation returns a
connection from the current DataSource.
Connection object to be used
SQLException - if an error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||