Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

Using Aspects to Autonomic-Enable Legacy Applications

By Brian Temple
2005-05-13


Example legacy application

I'll start with a very simple application to demonstrate legacy autonomic enablement. The application used is a variation on the "Hello World" code, which contains an encapsulated variable and makes several method calls in its execution.

Listing 1. HelloWorld.java

package com.mycompany.myapp;


public class HelloWorld {
private String helloWorldString = "Hello World";

public static void main(String[] args) {
HelloWorld helloWorld = new HelloWorld();
helloWorld.run();
}

public void run() {
String helloWorldString = getHelloWorldString();
System.out.println(helloWorldString);
setHelloWorldString("Goodbye World");
helloWorldString = getHelloWorldString();
System.out.println(helloWorldString);
}

public String getHelloWorldString() {
return helloWorldString;
}

public void setHelloWorldString(String helloWorldString) {
this.helloWorldString = helloWorldString;
}
}
This application contains one source directory and is built using Ant, as shown in Listing 2.

Listing 2. Original Ant Build Script

...

<javac srcdir="src/" destdir="build">
<include name="com/**/*"/>
</javac>
...


Tutorial Pages:
» Using Aspects to autonomic-enable legacy applications
» Introduction
» Example legacy application
» Incorporating Aspects
» An example Aspect framework to generate Common Base Events
» How to use and extend the example Aspect framework
» Next steps
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources