Tuesday, July 20, 2004

AspectWerkz in WebLogic - domain wizard

(imported from http://blogs.codehaus.org/people/avasseur, read comments there)

I have sketeched a BEA WebLogic domain wizard, so that it is now possible to install a WebLogic server with AspectWerkz AOP in a minute.

AspectWerkz AOP WebLogic domain wizard

Requirements:
- WebLogic 8.1 SP2 (8.1 whatever should work).
- Use of JRockit is mandatory for now (included in WebLogic 8.1 or other version if you want).

How to:
- Download the jar (7 Mo, includes the whole AspectWerkz 1.0beta1 distribution with some extra fix).
- Drop the jar file in your BEA_HOME/weblogic81/common/templates/domains.
- Start the BEA Configuration Wizard from the start menu.
- Select the AspectWerkz node and the "WebLogic WorkShop domain".
- Select JRockit
(for other screens, refer to the usual BEA installation documentation)

Limitations:
- It is a WebLogic WorkShop domain wizard. You can probably adapt it for WebLogic Server only, or WebLogic Integration and WebLogic Portal
- Use of JRockit is mandatory, although it is possible with some minimal change to adapt the generated "startWebLogic" script for Sun HotSpot VM (I would do it with the AspectWerkz Plug utility and -Xbootclasspath option - refer to the documentation).
- If you are not using 8.1 SP2, you might need to adapt the "startWebLogic" script to set your JAVA_HOME to the correct JRockit version.

Extra bonus:
- There is draft version of a WebLogic AOP console extension included, that allows you to browse the META-INF/aop.xml definitions accross the class loader hierarchy of your deployed applications.
Just start the weblogic admin console as usual and the extension will appear on the left navigation pane.

Friday, July 9, 2004

AOP in J2EE, Tomcat tutorial

(imported from http://blogs.codehaus.org/people/avasseur, read comments there)

Since we released AspectWerkz 1.0 beta 1 some days ago, with a real cool feature we had in our roadmap since the very begining, I have written a small tutorial for you to practice.

AspectWerkz now supports the concept of an AOP container. No other AOP framework out there supports this idea in the way we do it : class loader aware and cross platform.
It is now possible to have an AOP deployment descriptor within your application, and interesting point in an AOP world: have several of them, all along your application.

The standard way of doing so is to use META-INF/aop.xml files, and for some container like Tomcat it is possible to use WEB-INF/aop.xml as well.
If you add a jar file in your application and this jar file contains a META-INF/aop.xml descriptor, it will also be taken into account. It is thus easy to distribute aspect jar file with predefined behavior.

You can drop Aspect classes at your system classpath and those will affect all deployed application, AND, you can have Aspect classes within your web application that will only affect this specific deployed application.

Read the tutorial here.


Note that if an Aspect is deployed within an application, the pointcut it defines will be limited by the class loader isolation principle. Even if the pointcut assumes to match all method in all classes, it will only "see" all methods in classes loaded by this classlaoder and the child classloader.

Try it now !