[
http://jira.jboss.com/jira/browse/JBCACHE-89?page=all ]
Manik Surtani updated JBCACHE-89:
---------------------------------
Fix Version/s: 3.0.0
(was: 2.2.0.GA)
Allow Specifying Custom Interceptors in XML Configuration
---------------------------------------------------------
Key: JBCACHE-89
URL:
http://jira.jboss.com/jira/browse/JBCACHE-89
Project: JBoss Cache
Issue Type: Feature Request
Affects Versions: 1.2
Reporter: Daniel Gredler
Assigned To: Manik Surtani
Fix For: 3.0.0
Original Estimate: 1 day
Time Spent: 30 minutes
Remaining Estimate: 7 hours, 30 minutes
It would be nice to be able to add interceptors via the XML configuration files. Indeed,
in TreeCache.java the following comment exists, which may indicate that this feature is
already planned:
// Create the interceptors in the correct order (later to be defined in XML file)
createInterceptorChain();
A possible example configuration would be:
<server>
<classpath codebase="./lib" archives="jboss-cache.jar,
jgroups.jar" />
<mbean code="org.jboss.cache.TreeCache"
name="jboss.cache:service=TreeCache">
...
<attribute name="Interceptors">
<interceptor>com.foo.project.MyInterceptor</interceptor>
</attribute>
...
</mbean>
</server>
Something along the lines of the following method would then be able to add the custom
interceptors (in TreeCache.java):
public void setInterceptors(Element interceptors) throws Exception {
NodeList list = interceptors.getChildNodes();
for(int i = 0; i < list.getLength(); i++) {
org.w3c.dom.Node node = list.item(i);
if(node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
continue;
NodeList children = node.getChildNodes();
if(children.getLength() != 1)
continue;
org.w3c.dom.Node childNode = list.item(0);
if(childNode.getNodeType() != org.w3c.dom.Node.TEXT_NODE)
continue;
String className = childNode.getNodeValue();
if(className == null || className.length() == 0)
continue;
Interceptor interceptor = createInterceptor(className);
addInterceptor(interceptor_chain, interceptor);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira