org.apache.jetspeed.pipeline.valve.impl
Class PropertyLoaderValve
java.lang.Object
org.apache.jetspeed.pipeline.valve.impl.PropertyLoaderValve
- All Implemented Interfaces:
- Valve
public class PropertyLoaderValve
- extends java.lang.Object
- implements Valve
The purpose of this valve is to load a property file and make the information
available on the request as an attribute. The name of the attribute is the
key that is passed into the constructor.
There are 3 different ways to use this object: 1. Provide a key and a
PropertiesConfiguration object 2. Provide a key and a path to a properties
file 3. Provide a string which is used for both the key and as an environment
lookup to find the path to a properties file.
The PropertiesConfiguration object is put on the request and can be consumed
by anyone downstream of this valve
Multiple valves can be configured via Spring and put into the pipeline if
more than one property file is needed.
Spring configuration samples are shown below:
/apps/jetspeed/etc/jetspeed-production.properties
php-properties
php-properties
/apps/jetspeed/etc/jetspeed-production.properties
app.props
For this last one, an environment variable with the name "app.props" would
contain the file path to the properties file.
- Author:
- David Gurney
Constructor Summary |
PropertyLoaderValve(java.lang.String p_sEnvironmentKey)
|
PropertyLoaderValve(java.lang.String p_sKey,
org.apache.commons.configuration.PropertiesConfiguration p_oPropertiesConfiguration)
|
PropertyLoaderValve(java.lang.String p_sKey,
java.lang.String p_sPropertyFilePath)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_sKey
protected java.lang.String m_sKey
m_oPropertiesConfiguration
protected org.apache.commons.configuration.PropertiesConfiguration m_oPropertiesConfiguration
m_sPropertyFilePath
protected java.lang.String m_sPropertyFilePath
PropertyLoaderValve
public PropertyLoaderValve(java.lang.String p_sKey,
org.apache.commons.configuration.PropertiesConfiguration p_oPropertiesConfiguration)
PropertyLoaderValve
public PropertyLoaderValve(java.lang.String p_sKey,
java.lang.String p_sPropertyFilePath)
PropertyLoaderValve
public PropertyLoaderValve(java.lang.String p_sEnvironmentKey)
- Parameters:
p_sEnvironmentKey
- -
This value will be used both as the storage key and as the
name to use when looking up an environment variable. The
environment variable should contain the file path of the
properties file to be loaded
initialize
public void initialize()
throws PipelineException
- Description copied from interface:
Valve
- Initialize the valve before using in a pipeline.
- Specified by:
initialize
in interface Valve
- Throws:
PipelineException
invoke
public void invoke(RequestContext p_oRequest,
ValveContext p_oContext)
throws PipelineException
- Specified by:
invoke
in interface Valve
- Throws:
PipelineException
Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.