AspectWerkz
uses a class bytecode manipulation technique for applying aspects to
existing Java classes. This means there is no additional language syntax or precompiler necessary.
It does mean that class bytecode must be intercepted and changed some time before it gets executed.
Fortunately,
AspectWerkz
provides both offline and online class interception and
manipulation. Offline manipulation means all class files are scanned and modified in place sometime
before the application gets executed. Online interception means classes are intercepted as they
are loaded by a running application. Both techniques provide costs and benefits. Offline interception
allows an entire set of classes to be changed once, making runtime execution more efficient, at the
cost of making the development cycle less efficient (you've have to manipulate a class file every time
you recompiled the Java source). Online interception makes application execution less efficient
(because the class must be modified while the program is running), but eliminates the extra step of
changing the class file on every compile.
These instructions describe how to create an execution type and a debugger type in
NetBeans
to implement online interception for use during the development cycle.
Creating the execution and debugger types affects only the project you have open at the time.
You must follow these instructions for each separate
NetBeans
project.
The instructions have been prepared for
NetBeans 3.6
.
These instructions demonstrate using the prepared bootclasspath approach to online weaving, by creating a new execution type and debugger type. This approach works well with NetBeans.
Install the
AspectWerkz
distribution, or copy the following jars to an accessible
location.
Using instructions located
here to create the
enhanced class loader jar. Place the jar in a location accessible by
NetBeans
.
The following instructions must be repeated for each project
that will use
AspectWerkz
.
-Xbootclasspath/p:/path/to/enhanced/class/loader.jar -Xbootclasspath/a:{bootclasspath} {assertEnabled} -cp {filesystems}{:}{classpath} {classname} {arguments}
{bootclasspath}
and
{assertEnable}
.
-Xbootclasspath/p:/path/to/enhanced/class/loader.jar -Xbootclasspath/a:{bootclasspath} {classic}{assertEnabled}{debuggerOptions} -Djava.compiler=NONE -classpath {q}{filesystems}{q} {main}
{bootclasspath}
and
{classic}
.
So far, we've only created the customized execution and debugger types. To actually use these in the project, the following steps are necessary.