org.apache.commons.configuration
Class ClassPropertiesConfiguration

java.lang.Object
  extended byorg.apache.commons.configuration.AbstractConfiguration
      extended byorg.apache.commons.configuration.BaseConfiguration
          extended byorg.apache.commons.configuration.BasePathConfiguration
              extended byorg.apache.commons.configuration.BasePropertiesConfiguration
                  extended byorg.apache.commons.configuration.ClassPropertiesConfiguration
All Implemented Interfaces:
BasePathLoader, Configuration

public class ClassPropertiesConfiguration
extends BasePropertiesConfiguration
implements Configuration

Loads the configuration from the classpath utilizing a specified class to get the classloader from. The properties file will be attempted to be loaded first from the classes package directory and then from the class path in general.

This class does not support an empty constructor and saving of a synthesized properties file. Use PropertiesConfiguration for this.

Version:
$Id: ClassPropertiesConfiguration.java,v 1.7 2004/06/23 11:15:45 ebourg Exp $
See Also:
BasePropertiesConfiguration

Field Summary
 
Fields inherited from class org.apache.commons.configuration.BasePropertiesConfiguration
include
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
DELIMITER, END_TOKEN, START_TOKEN
 
Constructor Summary
ClassPropertiesConfiguration(Class baseClass, String resource)
          Creates and loads an extended properties file from the Class Resources.
 
Method Summary
protected  InputStream getPropertyStream(String resourceName)
          Gets a resource relative to the supplied base class or from the class loader if it is not found from the supplied base class.
 
Methods inherited from class org.apache.commons.configuration.BasePropertiesConfiguration
getInclude, getIncludesAllowed, load, load, save, save, save, save, setInclude, setIncludesAllowed, unescapeJava
 
Methods inherited from class org.apache.commons.configuration.BasePathConfiguration
getBasePath, setBasePath
 
Methods inherited from class org.apache.commons.configuration.BaseConfiguration
addPropertyDirect, clearProperty, containsKey, getKeys, getPropertyDirect, isEmpty
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addProperty, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolateHelper, setProperty, split, subset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.configuration.Configuration
addProperty, clearProperty, containsKey, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, isEmpty, setProperty, subset
 

Constructor Detail

ClassPropertiesConfiguration

public ClassPropertiesConfiguration(Class baseClass,
                                    String resource)
                             throws ConfigurationException
Creates and loads an extended properties file from the Class Resources. Uses the class loader.

Parameters:
baseClass - The class providing the FileStream.
resource - The name of the Resource.
Throws:
ConfigurationException - Error while loading the properties file
Method Detail

getPropertyStream

protected InputStream getPropertyStream(String resourceName)
                                 throws IOException
Gets a resource relative to the supplied base class or from the class loader if it is not found from the supplied base class.

Specified by:
getPropertyStream in class BasePropertiesConfiguration
Parameters:
resourceName - The resource Name
Returns:
An Input Stream
Throws:
IOException - Error while loading the properties file


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