@@ -0,0 +1,92 @@ | |||
AspectJ Figures Exercises | |||
------------------------------ | |||
THIS FILE IS OUT-OF-DATE !!! (2003-3-17) | |||
These exercises are designed to be used with AspectJ 1.0.6. | |||
THEY MUST NOT BE DISTRIBUTED ELECTRONICALLY WITHOUT THINKING FIRST!!! | |||
There may be licence issues with just sticking the junit jar in there | |||
that I don't understand. | |||
To build distribution zips, use ant -f build.xml. This will create | |||
EV-exercises.zip -- the contents of these exercises, minus AspectJ | |||
EV-answers.zip -- some answers to these exercises. | |||
EV-setup.zip -- the exercises bundled with AspectJ | |||
EV-allcontent.zip -- the exercises bundled with the answers | |||
If you don't want to be bothered with specifying where AspectJ is, | |||
feel free to just do ant -f build.xml answers.zip. By default it will | |||
build both exercises and answers. | |||
------------------------------ | |||
Required environment | |||
In order to actually do the exercises, the three very important files | |||
to have are: | |||
EV-exercises.zip | |||
aspectj-tools-1.0.6.jar | |||
<some installer of java> | |||
It is almost certainly a good idea to hope that Java is already | |||
installed on the students' systems, but to provide two installers | |||
(windows and linux) anyway. | |||
http://java.sun.com | |||
You may want to also include the rest of the AspectJ installers as | |||
well, but that might be a bit of a distraction | |||
http://aspectj.org/dl | |||
These require junit.jar. I've included a copy in with the two zip | |||
files, but they might want to be refreshed every now and again. | |||
http://junit.org | |||
------------------------------ | |||
Printing | |||
It would be really nice to have an automated solution to generate the | |||
documents, but no such luck. | |||
* index.html should print out with useful page breaks. It should be | |||
separated into four chunks if possible. | |||
* answers in four chunks. | |||
* quick reference sheets. | |||
Remember to have a one-sided copy of everything as a separate | |||
clean-copy. | |||
------------------------------ | |||
Distribution | |||
/j2sdk-1_4_1_01-linux-i586.bin | |||
/j2sdk-1_4_1_01-windows-i586.exe | |||
/exercises.zip containing: | |||
aj-EV/src/figures.zip | |||
aj-EV/src/aspectj-tools-1.0.6.jar | |||
aj-EV/src/aspectj-docs-1.0.6.jar | |||
aj-EV/<exploded version of figures.zip> | |||
aj-EV/aspectj/<exploded version of aspectj-tools> | |||
aj-EV/aspectj/<exploded version of aspectj-docs> | |||
aj-EV/setpaths | |||
aj-EV/setpaths.bat | |||
/bin/ajc, are edited to make sure that JAVA_HOME is used, as the | |||
defaults will almost certainly be wrong. setpaths scripts do what | |||
they look like they do. All six of these scripts are stored in | |||
scripts under CVS. | |||
---- Instructors | |||
Since the only difference is the answers, just overwrite the | |||
extraction directory with answers.zip. | |||
@@ -1,115 +1,119 @@ | |||
<project name="build" default="dist" basedir="."> | |||
<!-- | |||
This build script will create a directory called burn that is | |||
_almost_ suitable for burning onto a CD. However, there | |||
are a number of things that should be done to this directory | |||
before actually burning: | |||
The PDFs in the print directory need to be manually generated. | |||
Use the content of foo.pdf.contents to generate foo.pdf, and | |||
and then delete the foo.pdf.contents directory. | |||
The powerpoint and packages directory should be populated | |||
with whatever you want to populate it with. The | |||
packages directory is typically filled with Linux installers | |||
and a clean AspectJ installer. | |||
--> | |||
<project name="build" default="burn" basedir="."> | |||
<description> | |||
Build the exercises we do at various conferences | |||
Build a CD image containing AspectJ exercises. | |||
</description> | |||
<!-- this directory needs to hold tools and docs, unpacked --> | |||
<property name="aj.home" value="c:/apps/aspectj106" /> | |||
<!-- CUSTOMIZE THESE PROPERTIES --> | |||
<!-- this is the name of the tutorial event --> | |||
<property name="aj.event" value="aosd2003" /> | |||
<!-- this directory should hold a clean unpacked AspectJ release --> | |||
<property name="aj.home" value="c:/apps/aspectj11" /> | |||
<!-- this is the name of the event --> | |||
<property name="aj.event" value="oopsla2003" /> | |||
<!-- NO CUSTOMIZABLE PROPERTIES BELOW HERE --> | |||
<property name="burndir" value="burn" /> | |||
<property name="eventdir" value="${burndir}/aj-${aj.event}" /> | |||
<property name="packagedir" value="${burndir}/packages" /> | |||
<property name="printdir" value="${burndir}/print" /> | |||
<property name="powerpointdir" value="${burndir}/powerpoint" /> | |||
<!-- now real targets --> | |||
<target name="burn" depends="clean,skeleton,event,answers,printables" /> | |||
<target name="dist" | |||
depends="clean,distdir,exercises.zip,answers.zip" /> | |||
<target name="printables" depends="skeleton"> | |||
<delete dir="${printdir}/answers.pdf.contents" /> | |||
<mkdir dir="${printdir}/answers.pdf.contents" /> | |||
<copy toDir="${printdir}/answers.pdf.contents"> | |||
<fileset dir="answers" includes="*.java" excludes="Answer.java"/> | |||
</copy> | |||
<target name="event.zip" depends="tools,exercises"> | |||
<zip destfile="dist/${aj.event}.zip"> | |||
<zipfileset dir="dist/aj-${aj.event}" | |||
prefix="aj-${aj.event}" | |||
excludes="answers/*.java" | |||
/> | |||
<zipfileset dir="dist/aj-${aj.event}" | |||
prefix="aj-${aj.event}" | |||
includes="answers/Answer.java" | |||
/> | |||
</zip> | |||
<delete dir="${printdir}/exercises.pdf.contents" /> | |||
<mkdir dir="${printdir}/exercises.pdf.contents" /> | |||
<copy toDir="${printdir}/exercises.pdf.contents" file="index.html" /> | |||
<delete dir="${printdir}/install.pdf.contents" /> | |||
<mkdir dir="${printdir}/install.pdf.contents" /> | |||
<copy toDir="${printdir}/install.pdf.contents" file="install.txt" /> | |||
</target> | |||
<target name="exercises.zip" depends="exercises"> | |||
<zip destfile="dist/${aj.event}-exercises.zip"> | |||
<zipfileset dir="dist/aj-${aj.event}" | |||
prefix="aj-${aj.event}" | |||
includes="junit.jar,base.lst,guibase.lst,*.html,support/**/*.java,figures/**/*.java,tests/**/*.java,answers/Answer.java" | |||
<target name="answers" depends="skeleton"> | |||
<zip destfile="${packagedir}/${aj.event}-answers.zip"> | |||
<zipfileset dir="answers" | |||
prefix="aj-${aj.event}/answers" | |||
includes="*.java" | |||
excludes="Answer.java" | |||
/> | |||
</zip> | |||
</zip> | |||
</target> | |||
<target name="event" depends="tools,exercises"> | |||
<filter token="aj.event" value="${aj.event}" /> | |||
<copy file="install.txt" toDir="${eventdir}" filtering="yes" /> | |||
</target> | |||
<target name="answers.zip" depends="answers"> | |||
<zip destfile="dist/${aj.event}-answers.zip"> | |||
<zipfileset dir="dist/aj-${aj.event}" | |||
prefix="aj-${aj.event}" | |||
includes="answers/*.java" | |||
excludes="answers/Answer.java" | |||
<target name="exercises" depends="skeleton"> | |||
<copy toDir="${eventdir}"> | |||
<fileset dir="." | |||
includes="junit.jar,base.lst,guibase.lst,*.html,support/**/*.java,figures/**/*.java,tests/**/*.java,answers/Answer.java" | |||
/> | |||
</zip> | |||
</copy> | |||
</target> | |||
<target name="tools" depends="eventdir"> | |||
<mkdir dir="dist/aj-${aj.event}" /> | |||
<mkdir dir="dist/aj-${aj.event}/aspectj" /> | |||
<target name="tools" depends="skeleton"> | |||
<mkdir dir="${eventdir}/aspectj" /> | |||
<filter token="aj.event" value="${aj.event}" /> | |||
<copy toDir="dist/aj-${aj.event}/aspectj"> | |||
<copy toDir="${eventdir}/aspectj"> | |||
<fileset dir="${aj.home}" excludes="bin/**" /> | |||
</copy> | |||
<copy toDir="dist/aj-${aj.event}/aspectj/bin" filtering="yes"> | |||
<copy toDir="${eventdir}/aspectj/bin" filtering="yes"> | |||
<fileset dir="scripts" excludes="setpaths*" /> | |||
</copy> | |||
<copy toDir="dist/aj-${aj.event}" filtering="yes"> | |||
<copy toDir="${eventdir}" filtering="yes"> | |||
<fileset dir="scripts" includes="setpaths*" /> | |||
</copy> | |||
<fixcrlf srcDir="dist/aj-${aj.event}" | |||
<fixcrlf srcDir="${eventdir}" | |||
includes="setpaths.bat,aspectj/bin/ajbrowser.bat,aspectj/bin/ajc.bat" | |||
eol="crlf" /> | |||
<fixcrlf srcDir="dist/aj-${aj.event}" | |||
<fixcrlf srcDir="${eventdir}" | |||
includes="setpaths.sh,setpaths.csh,aspectj/bin/ajbrowser,aspectj/bin/ajc" | |||
eol="lf" /> | |||
</target> | |||
<target name="exercises" depends="eventdir"> | |||
<filter token="aj.event" value="${aj.event}" /> | |||
<copy file="install.txt" toDir="dist/aj-${aj.event}" filtering="yes" /> | |||
<copy toDir="dist/aj-${aj.event}"> | |||
<fileset dir="." | |||
includes="junit.jar,base.lst,guibase.lst,*.html,support/**/*.java,figures/**/*.java,tests/**/*.java,answers/Answer.java" | |||
/> | |||
</copy> | |||
</target> | |||
<target name="answers" depends="eventdir"> | |||
<copy toDir="dist/aj-${aj.event}"> | |||
<fileset dir="." | |||
includes="answers/*.java" | |||
excludes="answers/Answer.java" | |||
/> | |||
</copy> | |||
</target> | |||
<target name="allcontent.zip" depends="exercises.zip,answers.zip"> | |||
<zip destfile="dist/${aj.event}-notools.zip"> | |||
<zipfileset src="dist/${aj.event}-exercises.zip" /> | |||
<zipfileset src="dist/${aj.event}-answers.zip" /> | |||
</zip> | |||
</target> | |||
<target name="distdir"> | |||
<mkdir dir="dist" /> | |||
</target> | |||
<target name="eventdir" depends="distdir"> | |||
<mkdir dir="dist/aj-${aj.event}" /> | |||
<target name="skeleton"> | |||
<mkdir dir="${burndir}" /> | |||
<mkdir dir="${eventdir}" /> | |||
<mkdir dir="${packagedir}" /> | |||
<mkdir dir="${printdir}" /> | |||
<mkdir dir="${powerpointdir}" /> | |||
</target> | |||
<target name="clean"> | |||
<delete dir="dist" /> | |||
<delete dir="burn" /> | |||
</target> | |||
<target name="javaclean"> | |||
<delete dir="dist" /> | |||
<delete dir="burn" /> | |||
</target> | |||
</project> | |||
@@ -4,7 +4,7 @@ | |||
</head> | |||
<body bgcolor="white"> | |||
<h1>AspectJ Exercises</h1> | |||
<h2>Advanced Aspect-Oriented Programming with AspectJ</h2> | |||
<h3>Organization</h3> | |||
@@ -0,0 +1,63 @@ | |||
0. Install | |||
Now get the directory "aj-@aj.event@/". Just copy the | |||
"aj-@aj.event@/" directory from the provided CD. | |||
If you're running a Windows machine, we recommend you copy into | |||
"c:\". If you're running your favorite Unix (we've had success under | |||
Linux and MacOS X), we recommend you install into "~\". | |||
1. Configure | |||
Our installation is fairly well self-contained, but it does need to know | |||
where Java lives. To do this you must set the environment variable named | |||
JAVA_HOME. This variable should point to something like | |||
c:\apps\jdk1.3.1_04 | |||
/usr/java | |||
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |||
depending on your system. You may either do this globally, or you may | |||
edit the appropriate setpaths script: | |||
setpaths.bat (under Windows) | |||
setpaths.sh (if you run bash/sh/ksh, like most Linux setups) | |||
setpaths.csh (if you run csh, like most MacOS X setups) | |||
Also, if you installed into a directory other than "c:\" or "~/", then you | |||
need to change the EXTRACTION environment variable in the setpaths script. | |||
2. Test | |||
Open a new command shell and change to the "aj-@aj.event@/" directory. | |||
We have provided a "setpaths" script to set permissions and various paths | |||
variables, so run this script: | |||
> setpaths.bat (under Windows) | |||
> source setpaths.sh (if you run bash/sh/ksh, like most Linux setups) | |||
> source setpaths.csh (if you run csh, like most MacOS X setups) | |||
You must remember to run this script every time you open a new command | |||
shell. | |||
Now, compile the core system with ajc: | |||
> ajc -argfile guibase.lst | |||
This should compile the figures application (source code in the figures | |||
directory) as well as a single unit test (source code in the tests | |||
directory). | |||
See if the compile was successful by running the gui figures app you just | |||
compiled: | |||
> java figures.gui.Main | |||
And, after quitting out of the gui figures app, run the unit test: | |||
> java tests.Test | |||
.... | |||
Time: 0.076 | |||
OK (4 tests) |
@@ -0,0 +1,3 @@ | |||
#!/bin/sh | |||
"$JAVA_HOME/bin/java" -classpath "$ASPECTJ_HOME/lib/aspectjtools.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH" -Xmx64M org.aspectj.tools.ajbrowser.Main "$@" |
@@ -0,0 +1,9 @@ | |||
@echo off | |||
if exist "%JAVA_HOME%\bin\java.exe" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java.bat" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java" goto haveJava | |||
echo java does not exist as %JAVA_HOME%\bin\java | |||
echo please fix the JAVA_HOME environment variable | |||
:haveJava | |||
"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar;%JAVA_HOME%\lib\tools.jar;%CLASSPATH%" -Xmx64M org.aspectj.tools.ajbrowser.Main %1 %2 %3 %4 %5 %6 %7 %8 %9 |
@@ -0,0 +1,3 @@ | |||
#!/bin/sh | |||
"$JAVA_HOME/bin/java" -classpath "$ASPECTJ_HOME/lib/aspectjtools.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH" -Xmx64M org.aspectj.tools.ajc.Main "$@" |
@@ -0,0 +1,9 @@ | |||
@echo off | |||
if exist "%JAVA_HOME%\bin\java.exe" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java.bat" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java" goto haveJava | |||
echo java does not exist as %JAVA_HOME%\bin\java | |||
echo please fix the JAVA_HOME environment variable | |||
:haveJava | |||
"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar;%JAVA_HOME%\lib\tools.jar;%CLASSPATH%" -Xmx64M org.aspectj.tools.ajc.Main %1 %2 %3 %4 %5 %6 %7 %8 %9 |
@@ -0,0 +1,15 @@ | |||
@echo off | |||
rem Change this to be the full path for this directory | |||
set EXTRACTION=c:\aj-@aj.event@ | |||
if exist "%JAVA_HOME%\bin\java.exe" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java.bat" goto haveJava | |||
if exist "%JAVA_HOME%\bin\java" goto haveJava | |||
echo java does not exist as %JAVA_HOME%\bin\java | |||
echo please fix the JAVA_HOME environment variable | |||
:haveJava | |||
set ASPECTJ_HOME=%EXTRACTION%\aspectj | |||
set PATH=%ASPECTJ_HOME%\bin;%PATH% | |||
set CLASSPATH=.;%ASPECTJ_HOME%\lib\aspectjrt.jar;%EXTRACTION%\junit.jar |
@@ -0,0 +1,11 @@ | |||
# this file should be sourced, NOT executed | |||
# Change this to be the full path for this directory | |||
set EXTRACTION=$HOME/aj-@aj.event@ | |||
set ASPECTJ_HOME=$EXTRACTION/aspectj | |||
set PATH=$ASPECTJ_HOME/bin:$PATH | |||
set CLASSPATH=.:$ASPECTJ_HOME/lib/aspectjrt.jar:$EXTRACTION/junit.jar | |||
chmod a+x $ASPECTJ_HOME/bin/ajc | |||
chmod a+x $ASPECTJ_HOME/bin/ajbrowser |
@@ -0,0 +1,18 @@ | |||
# this file should be sourced, NOT executed | |||
# Change this to be the full path for this directory | |||
EXTRACTION=$HOME/aj-@aj.event@ | |||
if [ "$JAVA_HOME" = "" ] | |||
then | |||
echo Please remember to manually set $JAVA_HOME to | |||
echo the location of your java installation | |||
fi | |||
export ASPECTJ_HOME=$EXTRACTION/aspectj | |||
export PATH=$ASPECTJ_HOME/bin:$PATH | |||
export CLASSPATH=.:$ASPECTJ_HOME/lib/aspectjrt.jar:$EXTRACTION/junit.jar | |||
chmod a+x $ASPECTJ_HOME/bin/ajc | |||
chmod a+x $ASPECTJ_HOME/bin/ajbrowser | |||