CS 683 Emerging Technologies Spring Semester, 2003 Aspect Intro |
||
---|---|---|
© 2003, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 21-Jan-03 |
Aspect-Oriented Programming Intro
Resources & Links
Main Web Sites
http://aosd.net/ Aspect-Oriented Program Development
http://www.eclipse.org/aspectj/ Aspectj site
http://www.parc.com/groups/csl/projects/aspectj/index.html Parc Research site on Aspect-Oriented Programming
AspectJCommand line Java Compiler + Browser
Go to download section of http://www.eclipse.org/aspectj/
The class will use version 1.0.6
Eclipse Plug-in version
http://www.eclipse.org/ajdt/
AspectS http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/
Includes documentation and download
An Example
The Files
Hello.java public class Hello { public static void main(String[] args ) { System.out.println("Hello"); } }
HelloAspect.java public aspect HelloAspect { before() : call(static void main(String[]) ) { System.out.println( "Start"); } }
Hello.lst Hello.java HelloAspect.java
Running the Example (by Hand)
Compile the example
ajc @Hello.lst
Run the example
java HelloOutput Start
Hello
AspectJ Browsers
AspectJ has it own Browser/IDE called AspectJ Browser
AspectJ has support for
AspectJ Browser
A minimal browser
Download at http://www.eclipse.org/aspectj/ and click on Downloads
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/dl/aspectj-tools-1.0.6.jar Compiler and Browser
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/dl/aspectj-docs-1.0.6.tgz AspectJ Documentation
See Documentation section http://www.eclipse.org/aspectj/
In particular look at: http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/devguide/index.html
Short instructions for Installing AspectJ Browser
Download the aspectj-tools-1.0.6.jar file
Install by using the command:
java –jar aspectj-tools-1.0.6.jar
In the directory created there is a file README-TOOLS.html
Follow the directions in that file to finish installation.
AspectJ Browser on Rohan
Installed in /home/ma/whitney/aspectj1.0
To use
Add to your classpath:
/home/ma/whitney/aspectj1.0/lib/aspectjrt.jar
Add to your path: /home/ma/whitney/aspectj1.0/bin
Start the browser with the command:
ajbrowser
Sample Use of AspectJ Browser
In a directory, called example, create two files
Hello.java
public class Hello { public static void main(String[] args) { System.out.println(“Hello”); } }
Running the Browser
Start the browser with the command ajbrowser
Load the Hello.lst file by:
What does the browser do?
Eclipse
An open extensible IDE for anything and nothing in particular
Open source IDE from IBM
Becoming popular for Java development
AspectJ claims to require version 2.0
Main web site: http://www.eclipse.org/
FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
You can download Eclipse 2.0 at:
http://download.eclipse.org/downloads/drops/R-2.0-200206271835/index.php
On Window download the correct file and unzip it.
In the eclipse directory run the eclipse.exe file
Documentation is at:
http://www.eclipse.org/documentation/main.html
Eclipse and AspectJ
Main web page for using AspectJ in Eclipse
http://www.eclipse.org/ajdt/
Installing AspectJ in Eclipse Go to:
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/org.eclipse.ajdt/download.html
Download
Aspect S
http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/
Included in VisualWorks 7
See goodies/other/AspectS in the VisualWorks 7 directory
Read the file goodies/other/AspectS/Readme.txt for installation instructions
Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.
    visitors since 21-Jan-03    Next