General
Migration
Other
AspectWerkz
is a dynamic, lightweight and
high-performant AOP/AOSD framework for Java.
You can post-process (instrument/transform) your source files before use. See the Startup and transformations section.
You can also use one of the several options to start your application with AspectWerkz enabled without
the command line tool.
For a complete discussion on this topic, see the Online architecture section.
Basically it just invokes the normal java command line tool
by calling a class that intercepts the normal class loading
scheme before it invokes the main class specified. This means
that you can just substitute the normal call to:
java -cp .. -D.. mainclass args
with:
aspectwerkz -cp .. -D.. mainclass args
and everything should work as before, the only difference
is that all classes that are loaded will be transformed
(if they are defined to). You can even hack the startup
script of your favorite application server and start it up
using the aspectwerkz
command line tool as
outlined above, or using directly aspectwerkz-core-version.jar facilities.
The key advantage of the command line tool when you startup your application
thru it is that it provides an autodetection mechanism for java 1.3 / java 1.4 support.
The online architecture differs between these two java version.
For full control on the behavior of AspectWerkz online mode (dump class, verbosity), you should
avoid using the command line tool.
Read more in the Online architecture section.
Actually no. You will still be able to to all the things covered in the Hot deployment section of the documentation. Like swapping the implementation of a Introduction or change the order or of advices and so on. The only things you can not do are introducing new Introductions and advise new methods.
The DTD is provided since 0.8. Each distribution comes with a bundled DTD so that it is not looked
for on the web at runtime.
When you write your XML definition file, add the following at the top of your XML.
<!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD 0.9//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz_0_9.dtd">
<!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
The Ant or Maven based build will fail if the ASPECTWERKZ_HOME
(basedir) is a directory
whose name contains whitespace(s). This would drastically complexify the script if we had to
escape the whitespaces and thus this is not supported for convenience reason.
The AspectWerkz online and offline mode (command line tool etc) support path whose elements contains whitespace(s) in their names.
The DTD has been made more strict and some deprecated elements or attributes have been removed. By referencing the DTD when you edit your XML definition files from within any IDE you will have basic color syntax highlighting.
The list of DTD elements is mainly related to system
element, *-def
and *-ref
style within
bind-*
elements, and advice=...
replaced by class=
.
See the DTD itself for a more detailled list.
The 0.8 Aspect model is now called Model 1 - XML centric and basically core classes
have been moved to org.codehaus.aspectwerkz.xmldef.
package (except JoinPoint and related).
The 0.8 brings a new architecture, and we limited the impact it has on end users and added value projects redistributing AspectWerkz. There might still be some change to reflect in your projects.
The command line tool bin/aspectwerkz
hides you the details. For online mode, you have nothing to change
if you are using this script. For offline mode, the definition file must now be the first argument given - as detailled
here.
If you were using directly the java classes instead of the command line tool, note the following changes:
org.codehaus.aspectwerkz.hook.ProcessStarter
can be used to start a JVM in online
mode (instead of org.cs3.jmangler.hook.starter.CLSubstitutor
). This class is packaged
in aspectwerkz-core-<version>.jar
, and you will need to add in the classpath
bcel.jar
and JAVA_HOME/lib/tools.jar
.org.codehaus.aspectwerkz.compiler.AspectWerkzC
must be used for offline
compilation (instead of org.cs3.jmangler.offline.starter.Main
). This class is packaged
in aspectwerkz-<version>.jar
, and you will need to add in the classpath
bcel.jar
and ant-1.5.2.jar
(or any Ant version 1.5 or later).
The JMangler jars are not needed. AspectWerkz has now total source and architecture control over the low layer
part of enabling online mode, which allow us to bring state of the art features.
As a consequence, the JMangler specific configuration files have been removed (ASPECTWERKZ_HOME/config
).
java.lang.ClassLoader
.