|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLogEnabled | +--org.apache.cocoon.components.modules.input.AbstractInputModule | +--org.apache.cocoon.components.modules.input.AbstractMetaModule | +--org.apache.cocoon.components.modules.input.JXPathMetaModule
JXPathModule allows to access properties of any object in generic way. JXPath provides APIs for the traversal of graphs of JavaBeans, DOM and other types of objects using the XPath syntax. This is based on the AbstractJXPathModule and duplicates the code since multiple inheritance is not possible. Please keep both classes in sync.
Configuration example:
<input-module name="request-attr" parameter="foo"/> |
Uses the "request-attr" input module to obtain parameter named "foo" and applies the given JXPath expression to it. |
<function name="java.lang.String" prefix="str"/> |
Imports the class "String" as extension class to the JXPathContext using the prefix "str". Thus "str:length(xpath)" would apply the method "length" to the string object obtained from the xpath expression. Please note that the class needs to be fully qualified. |
<package name="java.util" prefix="util"/> |
Imports all classes in the package "java.util" as extension classes to the JXPathContext using the prefix "util". Thus "util:Date.new()" would create a new java.util.Date object. |
Field Summary | |
protected org.apache.commons.jxpath.FunctionLibrary |
library
Contains all globally registered extension classes and packages. |
protected java.lang.String |
parameter
|
Fields inherited from class org.apache.cocoon.components.modules.input.AbstractMetaModule |
defaultInput, initialized, input, INPUT_MODULE_SELECTOR, inputConf, inputSelector, manager |
Fields inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule |
settings |
Fields inherited from interface org.apache.cocoon.components.modules.input.InputModule |
ROLE |
Constructor Summary | |
JXPathMetaModule()
|
Method Summary | |
void |
configure(org.apache.avalon.framework.configuration.Configuration config)
Configure component. |
java.lang.Object |
getAttribute(java.lang.String name,
org.apache.avalon.framework.configuration.Configuration modeConf,
java.util.Map objectModel)
Standard access to an attribute's value. |
java.util.Iterator |
getAttributeNames(org.apache.avalon.framework.configuration.Configuration modeConf,
java.util.Map objectModel)
Returns an Iterator of String objects containing the names of the attributes available. |
java.lang.Object[] |
getAttributeValues(java.lang.String name,
org.apache.avalon.framework.configuration.Configuration modeConf,
java.util.Map objectModel)
Returns an array of String objects containing all of the values the given attribute has, or null if the attribute does not exist. |
protected java.lang.Object |
getContextObject(org.apache.avalon.framework.configuration.Configuration modeConf,
java.util.Map objectModel)
Looks up object from configured InputModule. |
protected void |
getFunctions(org.apache.commons.jxpath.FunctionLibrary lib,
org.apache.avalon.framework.configuration.Configuration conf)
Register all extension functions listed in the configuration through <function name="fully.qualified.Class"
prefix="prefix"/> in the given FunctionLibrary. |
protected void |
getPackages(org.apache.commons.jxpath.FunctionLibrary lib,
org.apache.avalon.framework.configuration.Configuration conf)
Register all extension packages listed in the configuration through <package name="fully.qualified.package"
prefix="prefix"/> in the given FunctionLibrary. |
protected void |
setupExtensions(org.apache.commons.jxpath.JXPathContext context,
org.apache.avalon.framework.configuration.Configuration conf)
Actually add global functions and packages as well as those listed in the configuration object. |
Methods inherited from class org.apache.cocoon.components.modules.input.AbstractMetaModule |
compose, dispose, getNames, getNames, getValue, getValue, getValues, getValues, initialize, obtainModule, releaseModule |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.commons.jxpath.FunctionLibrary library
protected java.lang.String parameter
Constructor Detail |
public JXPathMetaModule()
Method Detail |
public void configure(org.apache.avalon.framework.configuration.Configuration config) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
configure
in class AbstractInputModule
org.apache.avalon.framework.configuration.ConfigurationException
- if an error occursprotected void getFunctions(org.apache.commons.jxpath.FunctionLibrary lib, org.apache.avalon.framework.configuration.Configuration conf)
<function name="fully.qualified.Class"
prefix="prefix"/>
in the given FunctionLibrary.
lib
- a FunctionLibrary
valueconf
- a Configuration
valueprotected void getPackages(org.apache.commons.jxpath.FunctionLibrary lib, org.apache.avalon.framework.configuration.Configuration conf)
<package name="fully.qualified.package"
prefix="prefix"/>
in the given FunctionLibrary.
lib
- a FunctionLibrary
valueconf
- a Configuration
valueprotected void setupExtensions(org.apache.commons.jxpath.JXPathContext context, org.apache.avalon.framework.configuration.Configuration conf)
context
- a JXPathContext
valueconf
- a Configuration
value holding local
packages and functions.public java.lang.Object getAttribute(java.lang.String name, org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel) throws org.apache.avalon.framework.configuration.ConfigurationException
InputModule
getAttributeSet
or getAttributeNames
and getAttribute
to get them one by one.
getAttribute
in interface InputModule
name
- a String that specifies what the caller thinks
would identify an attribute. This is mainly a fallback if no
modeConf is present.modeConf
- column's mode configuration from resource
description. This argument is optional.objectModel
-
org.apache.avalon.framework.configuration.ConfigurationException
public java.util.Iterator getAttributeNames(org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel) throws org.apache.avalon.framework.configuration.ConfigurationException
InputModule
getAttributeNames
in interface InputModule
modeConf
- column's mode configuration from resource
description. This argument is optional.objectModel
-
org.apache.avalon.framework.configuration.ConfigurationException
public java.lang.Object[] getAttributeValues(java.lang.String name, org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel) throws org.apache.avalon.framework.configuration.ConfigurationException
InputModule
getAttributeNames
together with getAttribute
can be used to get the values one by one.
getAttributeValues
in interface InputModule
name
- a String that specifies what the caller thinks
would identify an attributes. This is mainly a fallback
if no modeConf is present.modeConf
- column's mode configuration from resource
description. This argument is optional.objectModel
-
org.apache.avalon.framework.configuration.ConfigurationException
protected java.lang.Object getContextObject(org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel)
modeConf
- a Configuration
valueobjectModel
- a Map
value
Object
value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |