|
-
What is AspectWerkz?
-
AspectWerkz
is a dynamic, lightweight and
high-performant AOP/AOSD framework for Java.
-
How can I use it without starting up the application or application server with the command line tool?
-
You can post-process (instrument/transform) your source files before use. See t
he
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.
-
What does the aspectwerkz command line tool do?
-
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 on
line mode (dump class, verbosity), you should
avoid using the command line tool.
Read more in the
Online architecture
section.
-
If I use the post-processor, I'll lose the possibility to change my configurations at runtime, right?
-
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.
-
Is there any DTD or XML Schema I can use to write the AspectWerkz XML definition file ?
-
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.8.1//EN"
"http://aspectwerkz.codehaus.org/dtd/aspectwerkz_0_8_1.dtd">
The 0.8 and 0.8.1 DTD are the same so you can also use
<!DOCTYPE aspectwerkz PUBLIC
"-//AspectWerkz//DTD 0.8//EN"
"http://aspectwerkz.codehaus.org/dtd/aspectwerkz_0_8.dtd">
The DTD for the latest release is also referen
ced with
<!DOCTYPE aspectwerkz PUBLIC
"-//AspectWerkz//DTD//EN"
"http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
-
What should I change in my project running on 0.7.4 to make it run on 0.8 and later ?
-
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
.
Refer to the
online architecture section
since there are now several other options to start
a JVM in online mode.
-
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).
-
Are there any files not needed starting from 0.8 release ?
-
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
).
-
Does AspectWerkz supports custom JRE like IBM ones ?
-
AspectWerkz supports all java environment thru offline mode. With online mode, AspectWerkz hooks at the class loader level.
Since the IBM JRE bundles a specific
java.lang.ClassLoader
, a work is in progress to fully support it (planned for 0.9).
|