JBoss AOP applications are supported in the standard and all configurations in JBoss AS 4.0.0 (the default and all configurations in JBoss AS 4.0.1). The jboss-aop.deployer service in the deploy directory deploys AOP applications inside the JBoss application server. The structure of the jboss-aop.deployer directory is shown in Figure 14.1. Notice that the jboss-aop.deployer service archive in JBoss AS 4.0.0 is a zip file instead of a directory. It includes the following components:
Figure 14.1. The directory structure of the JBoss AOP deployer in JBoss AS.
Installing the Latest jboss-aop.deployer ServiceBecause JBoss AOP is a fast-evolving technology, it is probably a good idea to keep your jboss-aop.deployer service up-to-date with the latest JBoss AOP release. After you unzip the JBoss AOP release file, the jboss-40-install directory contains the jboss-aop. deployer archive for the JDK 1.4 and JDK 5.0 environments. You can just copy those files to your JBoss server's deploy directory to replace the JBoss AOP service that shipped with the application server. Configuring the AOP ServiceBy default, the jboss-aop.deployer service disables load-time bytecode instrumentation. You have to instrument your code offline with the aopc utility. You should enable load-time instrumentation by editing the META-INF/jboss-service.xml file in the jboss-aop.deployer directory. You can just change the EnableTransformer attribute value to true, as follows: <mbean code="org.jboss.aop.deployment.AspectManagerService" name="jboss.aop:service=AspectManager"> <attribute name="EnableTransformer">false</attribute> <!-- only relevant when EnableTransformer is true --> <attribute name="SuppressTransformationErrors">true</attribute> <!-- only relevant when Enabletransformer is true. Optimization is optional only just in case there is a bug in it --> <attribute name="Optimized">true</attribute> <attribute name="Verbose">false</attribute> </mbean> <mbean code="org.jboss.aop.deployment.AspectDeployer" name="jboss.aop:service=AspectDeployer"> </mbean> Other attributes in this MBean control the behavior of the JBoss AOP deployer. Those attributes are manageable via the JBoss JMX Console when the server is running. The Prepackaged Aspects LibraryThe key value proposition of AOP is to promote code reuse. For example, you can reuse common aspects across different object trees in different applications:
The prepackaged aspect library in JBoss AOP is still under development. For the most up-to-date documentation on the currently available aspects, refer to the docs/aspect-library/index.html document. |