New Direction for JBoss AOP
bill.burke Nov 26, 2002 6:32 PMCode is under jboss-head/aop
It compiles but that's about it. Its incomplete.
The new direction is shown in the below xml if you can follow along. Don't have much time for explanation before Thanksgiving, but the idea is POJOs and DynamicProxies married into one framework. Field access, Constructors and methods interceptable on POJOs. More funtionality can be inferred if you read the following XML.
<!-- Interceptor definition. This is just a template
"name" is the string reference to the interceptor
"classname" is its classname
"scope" defines how the interceptor is instantiated
instance - one interceptor instance per object instance
class - one instance per class
global - one instance for entire VM
config - defines any arbitrary xml to pass to component for initialization
-->
</interceptor-service>
<!-- Extensions are classes that can be attached to an object to provide
extended APIs.
"name" is the string reference to the extention
"classname" is its classname
"scope" defines how the extension is instantiated
instance - one extension instance per object instance
class - one instance per class
global - one instance for entire VM
interfaces - are a list of interfaces to extend the aspected object.
Any methods invoked on the aspect that pertain to these
interfaces will be delegated directly to the extension class
config - defines any arbitrary xml to pass to component for initialization
i.e.
Class MyClass {}
interface api { void doSometing(); }
Class MyExtension implements api { public void doSomething(){ ... } }
You could do in code
{
MyClass instance = new MyClass();
api a = (api)instance;
a.doSomething();
}
Even though MyClass doesn't implement the api interface, or has the code for it
you can cast and invoke on it anyways. This is the extension.
-->
<extension name"extension1" classname="" scope="instance,class,global">
<!-- chain of interceptor definition -->
<interceptor-ref name="service1"/>
<!-- interceptor pointcut defines what classes, methods,fields must be intercepted
and by what -->
<interceptor-pointcut name="" class=".*pattern*">
<method-pointcut expr="*set*/>
<!-- Don't intercept method defined in these interfaces -->
<method-pointcut>
<excluded-interfaces/>
</method-pointcut>
<!-- Intercept methods defined in all these interfaces -->
<method-pointcut>
<included-interfaces/>
</method-pointcut>
<field-pointcut expr="*variable*"/>
<field-pointcut expr="{PUBLIC,PRIVATE,PROTECTED}"/>
<stack-ref name="stack1"/>
<interceptor-ref name="">
</interceptor-ref>
</interceptor-pointcut>
<!-- Extension pointcut defines what classes should be extended -->
<extension-pointcut name="" class=".*">
<extension-ref name="extension1"/>
</extension-pointcut>
<!--
A proxy is a template for creating Dynamic Proxies.
-->
<interceptor-pointcuts/>
<!--
Add a pointcut to created proxy
-->
<interceptor-pointcut name="" proxy="">
<method-pointcut>
<included-interfaces/>
</method-pointcut>
<stack-ref name="stack1"/>
<interceptor-ref name="">
</interceptor-ref>
</interceptor-pointcut>