We have some interesting things going on in CVS that will be in the RC2 release later this month. Let's take a look
Configuration
Kabir Khan is doing some great work. Recently he added the ability to configure Aspects and Interceptors like Java Beans. (In the past Aspects/Interceptor classes or their factories had to implement XmlLoadable and parse XML themselves) Here's a simple example:
<aspect class="SomeAspect" scope="PER_INSTANCE">
<attribute name="IntegerAttribute">5555</attribute>
<attribute name="StringArray">aspect,per,class</attribute>
<advisor-attribute name="MyAdvisor"/>
<instance-advisor-attribute name="MyInstanceAdvisor"/>
<joinpoint-attribute name="MyJoinpoint"/>
</aspect>
The advisor-attribute, instance-advisor-attribute, and joinpoint-attribute allow you to inject the JBoss AOP manager classes so that the aspect can obtain additional information about the objects/joinpoints it is intercepting.
We have also refactored interceptor and aspect configuration so that you can plug in your own factories to delegate to insert-your-favorite-IOC-framework-here.
Annotation configuration model
We're also providing an annotation alternative to XML. You can declare your pointcuts, bindings, introductions, etc... within an annotated Java class.
@Aspect(scope=Scope.PER_VM)
public class MyAspect {
@PointcutDef("call(public * Foo->*(..))")
public static Pointcut fooPublicMethods;
@Bind(pointcut="MyAspect.fooPublicMethod OR get(* Foo->*)")
public Object myAdvice(Invocation invocation) throws Throwable {
... advice implementation ...
}
}
Annotated aspect configuration can also be done with JDK 1.4 and our Annotation Compiler.
/** @@org.jboss.aop.Aspect(scope=org.jboss.aop.advice.Scope.PER_VM) */
public class MyAspect {
/** @@org.jboss.aop.PointcutDef("call(public * Foo->*(..))") */
public static Pointcut fooPublicMethods;
/** @@org.jboss.aop.Bind(pointcut="MyAspect.fooPublicMethod OR get(* Foo->*)") */
public Object myAdvice(Invocation invocation) throws Throwable {
... advice implementation ...
}
}
@Aspect, @PointcutDef, and @Bind are already supported in CVS. We'll be adding support for the rest for the scheduled RC2 release later this month.
Enjoy,
Bill