|
|||||||||
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.AbstractJXPathModule
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. JXPathMetaModule is based on this class and duplicates the code since multiple inheritance is not possible. Please keep both classes in sync.
Configuration example:
<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. |
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 | |
AbstractJXPathModule()
|
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 abstract java.lang.Object |
getContextObject(org.apache.avalon.framework.configuration.Configuration modeConf,
java.util.Map objectModel)
Returns the object which should be used as JXPath context. |
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.AbstractInputModule |
dispose |
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
Constructor Detail |
public AbstractJXPathModule()
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.
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
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.
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 abstract java.lang.Object getContextObject(org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |