org.apache.ojb.broker.util.configuration
Interface Configuration

All Known Subinterfaces:
LoggingConfiguration
All Known Implementing Classes:
ConfigurationAbstractImpl, OjbConfiguration

public interface Configuration

The Configuration interface defines lookup-methods to lookup typed configuration-values. For example boolean getBoolean(String key, boolean defaultValue) looks up a boolean value associated with key. If no value is found for key the boolean defaultValue is returned.

Version:
$Id: Configuration.java,v 1.3 2002/06/28 22:36:47 thma Exp $
Author:
Thomas Mahler

Method Summary
 boolean getBoolean(java.lang.String key, boolean defaultValue)
          Returns the boolean value for the specified key.
 java.lang.Class getClass(java.lang.String key, java.lang.Class defaultValue)
          Returns the class specified by the value for the specified key.
 java.lang.Class getClass(java.lang.String key, java.lang.Class defaultValue, java.lang.Class assignable)
          Returns the class specified by the value for the specified key.
 java.lang.Class getClass(java.lang.String key, java.lang.Class defaultValue, java.lang.Class[] assignables)
          Returns the class specified by the value for the specified key.
 int getInteger(java.lang.String key, int defaultValue)
          Returns the integer value for the specified key.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
          Returns the string value for the specified key.
 java.lang.String[] getStrings(java.lang.String key, java.lang.String defaultValue)
          Gets an array of Strings from the value of the specified key, seperated by ";".
 java.lang.String[] getStrings(java.lang.String key, java.lang.String defaultValue, java.lang.String seperators)
          Gets an array of Strings from the value of the specified key, seperated by any key from seperators.
 void setLogger(Logger loggerInstance)
          this method allows to set a logger that tracks configuration events.
 

Method Detail

setLogger

public void setLogger(Logger loggerInstance)
this method allows to set a logger that tracks configuration events.

Parameters:
loggerInstance - the logger to set

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Returns the boolean value for the specified key. If no value for this key is found in the configuration or the value is not an legal boolean defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
Returns:
the value for the key, or defaultValue

getClass

public java.lang.Class getClass(java.lang.String key,
                                java.lang.Class defaultValue,
                                java.lang.Class assignable)
Returns the class specified by the value for the specified key. If no value for this key is found in the configuration, no class of this name can be found or the specified class is not assignable assignable defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
assignable - a classe and/or interface the specified class must extend/implement.
Returns:
the value for the key, or defaultValue

getClass

public java.lang.Class getClass(java.lang.String key,
                                java.lang.Class defaultValue,
                                java.lang.Class[] assignables)
Returns the class specified by the value for the specified key. If no value for this key is found in the configuration, no class of this name can be found or the specified class is not assignable to each class/interface in assignables defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
assignables - classes and/or interfaces the specified class must extend/implement.
Returns:
the value for the key, or defaultValue

getClass

public java.lang.Class getClass(java.lang.String key,
                                java.lang.Class defaultValue)
Returns the class specified by the value for the specified key. If no value for this key is found in the configuration or no class of this name can be found defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
Returns:
the value for the key, or defaultValue

getInteger

public int getInteger(java.lang.String key,
                      int defaultValue)
Returns the integer value for the specified key. If no value for this key is found in the configuration or the value is not an legal integer defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
Returns:
the value for the key, or defaultValue

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Returns the string value for the specified key. If no value for this key is found in the configuration defaultValue is returned.

Parameters:
key - the key
defaultValue - the default value
Returns:
the value for the key, or defaultValue

getStrings

public java.lang.String[] getStrings(java.lang.String key,
                                     java.lang.String defaultValue,
                                     java.lang.String seperators)
Gets an array of Strings from the value of the specified key, seperated by any key from seperators. If no value for this key is found the array contained in defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
seperators - the seprators to be used
Returns:
the strings for the key, or the strings contained in defaultValue

getStrings

public java.lang.String[] getStrings(java.lang.String key,
                                     java.lang.String defaultValue)
Gets an array of Strings from the value of the specified key, seperated by ";". If no value for this key is found the array contained in defaultValue is returned.

Parameters:
key - the key
defaultValue - the default Value
Returns:
the strings for the key, or the strings contained in defaultValue


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14