org.apache.cocoon.util
Class PropertySettings

java.lang.Object
  extended by org.apache.cocoon.util.PropertySettings
All Implemented Interfaces:
Settings

public class PropertySettings
extends Object
implements Settings

This object holds the property settings for Cocoon. This interface is loosely based on the Settings interface introduced in 2.2 but is note equivalent to it as it is only meant to hold configuration properties.

Version:
$Id: PropertySettings.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected static Map CONTEXT_PARAMETERS
          Parameter map for the context protocol
 
Fields inherited from interface org.apache.cocoon.util.Settings
PROPERTY_USER_SETTINGS, ROLE
 
Constructor Summary
PropertySettings(SourceResolver resolver, Logger logger)
          Initialize the settings for Cocoon.
 
Method Summary
 List getProperties()
          Return all available properties
 List getProperties(String keyPrefix)
          Return all available properties starting with the prefix.
 String getProperty(String name)
          Get the value of a property.
 String getProperty(String key, String defaultValue)
          Get the value of a property.
 int size()
          Return the number of properties that have been defined
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_PARAMETERS

protected static final Map CONTEXT_PARAMETERS
Parameter map for the context protocol

Constructor Detail

PropertySettings

public PropertySettings(SourceResolver resolver,
                        Logger logger)
Initialize the settings for Cocoon. This method reads several property files and merges the result. If there is more than one definition for a property, the last one wins. The property files are read in the following order: 1) context://WEB-INF/properties/*.properties Default values for the core and each block - the order in which the files are read is not guaranteed. 2) Property providers (ToBeDocumented) 3) The environment (CLI, Servlet etc.) adds own properties (e.g. from web.xml) 4) Additional property file specified by the "org.apache.cocoon.settings" system property or if the property is not found, the file ".cocoon/settings.properties" is tried to be read from the user directory. 5) System properties

Parameters:
resolver - The SourceResolver.
logger - the Logger to use.
Method Detail

getProperty

public String getProperty(String name)
Description copied from interface: Settings
Get the value of a property.

Specified by:
getProperty in interface Settings
Parameters:
name - The name of the property.
Returns:
The value of the property or null.
See Also:
Settings.getProperty(java.lang.String)

getProperty

public String getProperty(String key,
                          String defaultValue)
Description copied from interface: Settings
Get the value of a property.

Specified by:
getProperty in interface Settings
Parameters:
key - The name of the property.
defaultValue - The value returned if the property is not available.
Returns:
The value of the property or if the property cannot be found the default value.
See Also:
Settings.getProperty(java.lang.String, java.lang.String)

getProperties

public List getProperties(String keyPrefix)
Description copied from interface: Settings
Return all available properties starting with the prefix.

Specified by:
getProperties in interface Settings
Parameters:
keyPrefix - The prefix each property name must have.
Returns:
A list of property names (including the prefix) or an empty list.
See Also:
Settings.getProperties(java.lang.String)

getProperties

public List getProperties()
Description copied from interface: Settings
Return all available properties

Specified by:
getProperties in interface Settings
Returns:
A list of all property names or an empty list.
See Also:
Settings.getProperties()

size

public int size()
Description copied from interface: Settings
Return the number of properties that have been defined

Specified by:
size in interface Settings
Returns:
The number of properties that have been defined.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.