SDSU CS 683 Emerging Technologies
Spring Semester, 2003
Aspect Intro
    Lecture Notes Index    Next    
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 21-Jan-03

Contents of Doc 1, Aspect Intro


Reading
The AspectJ Programming Guide, by The AspectJ Team,
PDF version in aspectj-docs-1.0.6.tqz at: http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/downloads.html

HTML version at: http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/index.html


Doc 1, Aspect Intro Slide # 2

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

Doc 1, Aspect Intro Slide # 3

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


Doc 1, Aspect Intro Slide # 4
Running the Example (by Hand)

Compile the example

ajc @Hello.lst

Run the example

java Hello
Output
Start
Hello

Doc 1, Aspect Intro Slide # 5

AspectJ Browsers



AspectJ has it own Browser/IDE called AspectJ Browser

AspectJ has support for


See http://www.eclipse.org/aspectj/ for download information


Doc 1, Aspect Intro Slide # 6

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.


Doc 1, Aspect Intro Slide # 7
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


Doc 1, Aspect Intro Slide # 8
Sample Use of AspectJ Browser

In a directory, called example, create two files


With the contents:

Hello.lst
Hello.java

Hello.java
public class Hello 
   {
   public static void main(String[] args)
      {
      System.out.println(“Hello”);
      }
   }


Doc 1, Aspect Intro Slide # 9
Running the Browser

Start the browser with the command ajbrowser

Load the Hello.lst file by:





Build the project by clicking and holding on the build icon.

Select the project you wish to build

The browser should look like:




Doc 1, Aspect Intro Slide # 10
What does the browser do?


The compiled code is placed in the directory you started the browser in

To change this click on the Options icon and set the “Output path” in the AJBrowser Options panel


Doc 1, Aspect Intro Slide # 11

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


Doc 1, Aspect Intro Slide # 12
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

Unzip the files

This creates two directories


Follow the instructions in org.eclipse.ajdt.ui_0.5.2\releaseNotes\readme.html


Doc 1, Aspect Intro Slide # 13

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