We've created a project archive to use the book examples with AJDT 1.3 (containing AspectJ 5) and Eclipse 3.1.1). When using this version of AJDT, please note that cross-references (advises / advised by relationships etc.) will be shown in the Cross References View and not in the Outline View. To install, simply download the project archive and save it to you hard drive. Start up Eclipse, and from the file menu choose "Import", and then "Existing Projects Into Workspace". Click next and then "Select archive file". Browse to the downloaded file (eclipseAspectJBooxExamples.jar" and select it, then just click "Finish" to install all of the projects. In each project you can run the test suite by selection "run as...junit" from the context menu of the test-src folder. The Shared Library project contains all the libraries you need (JDBC driver, Hibernate 2.1.8, spring 1.2.6) so there is nothing for you to download. You will need MySQL installed, and you will probably need to edit the database password in the hibernate.properties files contained in those projects that use Hibernate.
The examples for the book are packaged as a feature plug-in compatible with Eclipse 3.0 or later and AJDT 1.1.12. The screenshots from the book were taken using AJDT 1.1.11 but that version has been superceded by 1.1.12 which offers numerous improvements to the UI (see the AJDT 1.1.12 New & Noteworthy).
Please create an update site using the URL
http://www.awprofessional.com/title/0321245873/update
and the instructions
in Chapter 1 to download and install the plug-in. The update site is also mirrored on
aspectprogrammer.org at
http://www.aspectprogrammer.org/eclipseaspectj/examples/update
.
Alternatively the ZIP file can be downloaded
directly. .
Each example is packaged in its own project which may be created using File > New > Other ... > Eclipse AspectJ Book Examples. An example is identified by the chapter in which it is used e.g. "Simple Insurance Example 7 (Chapter 9)". There is a readme in each project describing its contents.
The version of the Simple Insurance example application used from Chapter 3 onwards
requires Hibernate. This should be downloaded from http://www.hibernate.org/ and installed before
creating an example that needs it. When creating such an example you will be prompted
for the directory where you installed Hibernate (e.g. "c:\hibernate-2.1
" on
Windows). This is used to define the classpath to build and run the example. Make sure
to install all of the included dependencies e.g. "c:\hibernate-2.1\lib\commons-logging-1.0.3.jar
".
Hibernate needs an SQL database e.g. MySQL (http://www.mysql.com/) and a suitable JDBC driver (http://dev.mysql.com/downloads/connector/j/3.0.html).
Both should be downloaded and installed before creating an example that needs Hibernate.
When creating such an example you will be prompted for the directory where you installed
the JDBC driver (e.g. "c:\mysql-connector-java-3.0.9-stable
" on Windows).
This is used to define the classpath to build and run the example. Before running an
example the database must be configured and started. See the readme.hibernate in project
"Simple Insurance Example 4 (Chapter 3)" for details.
The version of the Simple Insurance example application used from Chapter 11 onwards
requires Spring. This should be downloaded from http://www.springframework.org/ and installed
before creating an example that needs it. When creating such an example you will be
prompted for the directory where you installed Spring (e.g.
"c:\spring-framework-1.1
" on Windows). This is used to define the classpath
to build and run the example. Each of the examples that uses Spring inlcudes the
necessary configuration files.
The Simple Insurance application needs SWT and JFace for its GUI. The necessary native
libraries will be copied to the project directory when an example is installed as well
as the required JARs added to the classpath. However certain JVMs, particularly Linux,
do not automatically add the working directory to the Java library path. Therefore
please define the following System Property in the "VM arguments" field of the run
configuration when either launching the application or running the JUnit test suite: "-Djava.library.path=.
"