org.apache.commons.configuration
Class DatabaseConfiguration

java.lang.Object
  |
  +--org.apache.commons.configuration.AbstractConfiguration
        |
        +--org.apache.commons.configuration.DatabaseConfiguration
All Implemented Interfaces:
Configuration

public class DatabaseConfiguration
extends AbstractConfiguration

Configuration stored in a database.

Since:
1.0
Version:
$Revision$, $Date: 2005-02-26 13:56:39 +0100 (Sat, 26 Feb 2005) $
Author:
Emmanuel Bourg

Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, 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
protected  void addPropertyDirect(String key, Object obj)
          {@inheritDoc}
 void clear()
          {@inheritDoc}
 void clearProperty(String key)
          {@inheritDoc}
 boolean containsKey(String key)
          {@inheritDoc}
 Iterator getKeys()
          {@inheritDoc}
 Object getProperty(String key)
          {@inheritDoc}
 boolean isEmpty()
          {@inheritDoc}
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addProperty, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolate, interpolateHelper, isThrowExceptionOnMissing, resolveContainerStore, setDelimiter, setProperty, setThrowExceptionOnMissing, subset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseConfiguration

public DatabaseConfiguration(DataSource datasource,
                             String table,
                             String nameColumn,
                             String keyColumn,
                             String valueColumn,
                             String name)
Build a configuration from a table containing multiple configurations.
Parameters:
datasource - the datasource to connect to the database
table - the name of the table containing the configurations
nameColumn - the column containing the name of the configuration
keyColumn - the column containing the keys of the configuration
valueColumn - the column containing the values of the configuration
name - the name of the configuration

DatabaseConfiguration

public DatabaseConfiguration(DataSource datasource,
                             String table,
                             String keyColumn,
                             String valueColumn)
Build a configuration from a table.-
Parameters:
datasource - the datasource to connect to the database
table - the name of the table containing the configurations
keyColumn - the column containing the keys of the configuration
valueColumn - the column containing the values of the configuration
Method Detail

getProperty

public Object getProperty(String key)
{@inheritDoc}
Following copied from interface: org.apache.commons.configuration.Configuration
Parameters:
key - property to retrieve
Returns:
the value to which this configuration maps the specified key, or null if the configuration contains no mapping for this key.

addPropertyDirect

protected void addPropertyDirect(String key,
                                 Object obj)
{@inheritDoc}
Overrides:
addPropertyDirect in class AbstractConfiguration
Following copied from class: org.apache.commons.configuration.AbstractConfiguration
Parameters:
key - key to use for mapping
value - object to store

isEmpty

public boolean isEmpty()
{@inheritDoc}
Overrides:
isEmpty in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Returns:
true if the configuration contains no property, false otherwise.

containsKey

public boolean containsKey(String key)
{@inheritDoc}
Overrides:
containsKey in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Parameters:
key - the key whose presence in this configuration is to be tested
Returns:
true if the configuration contains a value for this key, false otherwise

clearProperty

public void clearProperty(String key)
{@inheritDoc}
Overrides:
clearProperty in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Parameters:
key - the key to remove along with corresponding value.

clear

public void clear()
{@inheritDoc}
Overrides:
clear in class AbstractConfiguration

getKeys

public Iterator getKeys()
{@inheritDoc}
Overrides:
getKeys in class AbstractConfiguration
Following copied from interface: org.apache.commons.configuration.Configuration
Returns:
An Iterator.


Copyright © 2001-2005 The Apache Software Foundation. All Rights Reserved.