This page details the designs for adding custom interceptors declaratively into JBossCache.
UPDATED: See JBC3Config for details of all new config elements in JBoss Cache 3.x.
Configuration
The end goal is for users to be able to provide the following in their configurations:
<attribute name="CustomInterceptors"> <config> <interceptor> <class>com.myCompany.MyInterceptor</class> <properties> x=y i=10 </properties> <position first="true" ></position> <!-- could also be either of: <position last="true" ></position> <position index="4" ></position> <position before="org.jboss.cache.interceptors.CallInterceptor" ></position> <position after="org.jboss.cache.interceptors.CallInterceptor" ></position> --> </interceptor> ... </config> </attribute>
Custom interceptor design
Custom interceptors must extend org.jboss.cache.interceptors.CommandInterceptor.
Custom interceptors must declare a public, empty constructor to enable construction.
Custom interceptors will have any properties declared passed in as a Properties object, in CommandInterceptor's setProperties(Properties p) method.
Custom interceptors will not be able to participate in any lifecycle or injection (at this time). Annotating methods as @Inject, @Start, @Stop or @Destroy will have no effect.
Comments