org.apache.jetspeed.pipeline.valve.impl
Class PropertyLoaderValve
java.lang.Object
org.apache.jetspeed.pipeline.valve.impl.PropertyLoaderValve
- All Implemented Interfaces:
- org.apache.jetspeed.pipeline.valve.Valve
public class PropertyLoaderValve
- extends Object
- implements org.apache.jetspeed.pipeline.valve.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
Method Summary |
void |
initialize()
|
void |
invoke(org.apache.jetspeed.request.RequestContext p_oRequest,
org.apache.jetspeed.pipeline.valve.ValveContext p_oContext)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_sKey
protected String m_sKey
m_oPropertiesConfiguration
protected org.apache.commons.configuration.PropertiesConfiguration m_oPropertiesConfiguration
m_sPropertyFilePath
protected String m_sPropertyFilePath
PropertyLoaderValve
public PropertyLoaderValve(String p_sKey,
org.apache.commons.configuration.PropertiesConfiguration p_oPropertiesConfiguration)
PropertyLoaderValve
public PropertyLoaderValve(String p_sKey,
String p_sPropertyFilePath)
PropertyLoaderValve
public PropertyLoaderValve(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 org.apache.jetspeed.pipeline.PipelineException
- Specified by:
initialize
in interface org.apache.jetspeed.pipeline.valve.Valve
- Throws:
org.apache.jetspeed.pipeline.PipelineException
invoke
public void invoke(org.apache.jetspeed.request.RequestContext p_oRequest,
org.apache.jetspeed.pipeline.valve.ValveContext p_oContext)
throws org.apache.jetspeed.pipeline.PipelineException
- Specified by:
invoke
in interface org.apache.jetspeed.pipeline.valve.Valve
- Throws:
org.apache.jetspeed.pipeline.PipelineException
Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.