Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ojb.broker.util.configuration.impl
Class ConfigurationAbstractImpl  view ConfigurationAbstractImpl download ConfigurationAbstractImpl.java

java.lang.Object
  extended byorg.apache.ojb.broker.util.configuration.impl.ConfigurationAbstractImpl
All Implemented Interfaces:
org.apache.ojb.broker.util.configuration.Configuration
Direct Known Subclasses:
OjbConfiguration

public abstract class ConfigurationAbstractImpl
extends java.lang.Object
implements org.apache.ojb.broker.util.configuration.Configuration

Configuration Base Class that keeps a Properties based configuration persistent in a file. This class provides only basic infrastructure for loading etc.

Version:
$Id: ConfigurationAbstractImpl.java,v 1.5 2002/12/24 13:28:58 arminw Exp $

Field Summary
private  java.lang.String[] falseValues
          Contains all legal values for boolean configuration entries that represent false.
protected  java.lang.String filename
          the name of the properties file
private  org.apache.ojb.broker.util.logging.Logger logger
          the logger used in this class.
protected  java.util.Properties properties
          the properties object holding the configuration data
private  java.lang.String[] trueValues
          Contains all legal values for boolean configuration entries that represent true.
 
Constructor Summary
ConfigurationAbstractImpl()
          The constructor loads the configuration from file
 
Method Summary
 boolean getBoolean(java.lang.String key, boolean defaultValue)
          Returns the boolean value for the specified key.
 byte getByte(java.lang.String key, byte defaultValue)
           
 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.
private  java.lang.String getFilename()
           
 int getInteger(java.lang.String key, int defaultValue)
          Returns the integer value for the specified key.
 long getLong(java.lang.String key, long defaultValue)
           
 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.
protected  void load()
          Loads the Configuration from the properties file.
protected  void setFilename(java.lang.String name)
           
 void setLogger(org.apache.ojb.broker.util.logging.Logger loggerInstance)
          this method allows to set a logger that tracks configuration events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.apache.ojb.broker.util.logging.Logger logger
the logger used in this class.


filename

protected java.lang.String filename
the name of the properties file


properties

protected java.util.Properties properties
the properties object holding the configuration data


trueValues

private java.lang.String[] trueValues
Contains all legal values for boolean configuration entries that represent true.


falseValues

private java.lang.String[] falseValues
Contains all legal values for boolean configuration entries that represent false.

Constructor Detail

ConfigurationAbstractImpl

public ConfigurationAbstractImpl()
The constructor loads the configuration from file

Method Detail

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.

Specified by:
getString in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getStrings in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getStrings in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getInteger in interface org.apache.ojb.broker.util.configuration.Configuration

getLong

public long getLong(java.lang.String key,
                    long defaultValue)

getByte

public byte getByte(java.lang.String key,
                    byte defaultValue)

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.

Specified by:
getBoolean in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getClass in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getClass in interface org.apache.ojb.broker.util.configuration.Configuration

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.

Specified by:
getClass in interface org.apache.ojb.broker.util.configuration.Configuration

load

protected void load()
Loads the Configuration from the properties file.


getFilename

private java.lang.String getFilename()

setFilename

protected void setFilename(java.lang.String name)

setLogger

public void setLogger(org.apache.ojb.broker.util.logging.Logger loggerInstance)
Description copied from interface: org.apache.ojb.broker.util.configuration.Configuration
this method allows to set a logger that tracks configuration events.

Specified by:
setLogger in interface org.apache.ojb.broker.util.configuration.Configuration