A flexible framework for Distributed & Dynamic Aspect-Oriented Programming in Java

Tutorial index

Requirements

Before actually using the IDE, make sure that the JAC distribution is correctly installed and configured as depicted in the tutorial.

The IDE aspects should be correctly configured for your environment, practically, you should edit the $JAC_ROOT/src/jac/ide/persistence.acc file to define a target directory for the storage:

configureStorage jac.aspects.persistence.FSStorage {
	"your_path"};

Warnings

This IDE is still in a beta version. The core model is quite stable and you should be able to read your projects with upcomming JAC releases, however, class diagrams could be lost.

The supported modeling language is a subset of UML (it only supports class diagram), plus a set of new concepts to model aspects (aspect classes, pointcut relations, and groups).

We claim that when using aspect-oriented technology, the whole UML language is not actually needed since the program is expressed with its simpliest core-business form. All the complexity related to implementation and design is handled in the provided aspects. As a consequence, you might be disapointed if you try to use this IDE whithin a regular development process on regular OO or CB technologies (however, this IDE could be easily extended to support these if needed).

Getting started

Ensure the JAC is correctly installed and launch the application descriptor located in jac/src/jac/ide:

jac $JAC_ROOT/src/jac/ide/ide.jac

When launched for the first time, the IDE appears as a window separated in 4 sub-panels. In the upper-left pannel, one can see a treeview that contains one single node called "projects". This sub-panel is the most important since it allows you to navigate in your projects and all the projects entities such as packages, diagrams, classes, or applications. The following list shows the hierachy of all the different entities manipulated by the IDE:

Using the treeview is simple. You can double-click on a given node to open it. You can use the right-click to show the available treatements on the entity. For instance, to create a new project, just right-click on the "projects" node and choose the "Add project" item.

The upper-right panel is used to edit diagrams. Once you have created a package in your project (using right-click on the treeview), create a diagram in this package. The upper-right panel will show a diagram editor that allows you to create and edit the entities of the owning package.

The two lower panels are used to provide a Widget-based representation of the currently selected entity in a diagram. The left one shows classes, aspects, instances, or groups. The right one shows relation and pointcut links, attributes, or methods. These two panels can be used to edit the model elements without using a graphical diagram editor (which is sometimes useful to avoid using the mouse to much).

Creating an application

Modeling the core business

First create a new project using the right click on the "projects" node of the treeview. Call it "myProject" and choose the generation path (the directory where the Java code will be generated).

You then need to create a new package in your project to define the business classes. Right-click on "myProject" node and add a package that you can call "invoices".

Since it is nicer to model graphically, right-click on "invoices" and add a new diagram. Call it "business" since it will represent the core-busines model of the application. A diagram editor component should then open in the upper-right sub-panel.

The JAC IDE

Click on the "New class" button (New class icon) of the diagram editor toolbar and then click on the desktop where you want to locate the new class. A new class should appear with a default name (NewClass). You can modify its name by using the "Text tool" (Text tool icon) button and click on the title or by using the lower-left sub-panel. Just call it "Invoices". This class represents a container for a set of invoices.

Now create in the same way an "Invoice" class. You can add an attribute by using the "Add attribute" button (Add attribute icon) of the toolbar. Using the text tool, you can edit this attribute. You MUST follow the conventions in the attribute definition, i.e. attribute_name:attribute_type. The available types are the classes that are already created and all the builtin types (see in the main menu: Tools --> Type repository). Just set the attribute to "amount:double". With the same process, create an attribute "date:Date".

You can now create another class "Client" with an attribute "name:String".

Classes are created

We can now relate the three classes together. Use the "New relation" button (New
      relation icon). Press the left button down on the "Invoices" class and, without releasing, move to the "Invoice" class and let the button up. A new relation link should be created with its default roles, names, and cardinalities. You can edit them on the diagram using the text tool, or in the lower-right sup-panel. Set the end cardinality to "0-*". Do the same to create a relation between "Invoice" and "Client" set the start cardinality to "0-*".

Please, also set the role names as shown in the following screenshot.

The invoices.busined
    class diagram

Creating the application

Global configuration

Once the core business is modeled, you should create a new application to make a running JAC program.

Right-click on the "myProject" node and choose "Add application". Call it "myFirstApplication" for instance. You can also program the launching code of the program (this code corresponds to the static void main(String[] args) method that is used as an entry point for the Java program).

In JAC, the idea of a lauching code is to create the root objects of the application that can be used to reach or create other objects via collections (relation links with "0-*" end cardinality) or references (relation links with "0-1" end cardinality).

In this case, we only need to create an "Invoices" instance since all the other objects are reachable from it (regarding the model). Thus, in the launching code editor, type the line:

new invoices.Invoices();
My first application
	global configuration

Note that the full name of the class is as expected the parent package path concated with the class name (this follows the Java conventions).

At this step, the application is ready to run. Validate and use the "Generate code" and the "Compile" commands by right-clicking on the "myProject" node. If something goes wrong, some error message(s) should appear in an errors dialog. If you do not figure out how to solve the problem, do not hesitate to contact us.

Since the application does not perform any treatment, it is not very interesting to launch it as is. Thus, we should add at least a GUI aspect so that the user of the application can create and manipulate the business objets.

Configuring the RTTI/GUI aspect

The GUI aspect is one of the most useful aspect provided by JAC since it allows the programmer to configure how the business objects should be rendered and how the final user can interact with the application.

As any aspect in JAC, the GUI aspect provides a configuration interface GUIConf that defines all the configuration methods that can be used during the configuration process. The programmer can refer these interfaces to know the available commands that can be used.

To add an aspect configuration to an application, right-click on the application node of the treeview and add a new aspect configuration.

First create an RTTI aspect (choose rtti for the aspect name and leave the aspect blank --- this is used when a personnal aspect is created in the IDE). As shown on the screenshot, the configuration should simply include the default system rtti that is useful for the GUI.

The RTTI aspect configuration

Then, create and configure the GUI aspect as shown in the following screenshoot.

The GUI aspect configuration

Starting the application

Before starting, ensure that the code generation is ok by right-click on the project's node and "Generate code"+"Compile".

The application code and classes is then available in the generation directory (GEN_DIR) that you have choosen when you have created the project (you can change it by asking a view on the project).

Ensure that GEN_DIR/classes is in your classpath.

Launch JAC with the application's desciptor that was automatically generated.

jac GEN_DIR/myFirstApplication/myFirstApplication.jac

Important notes

The JAC's IDE helps the programmer to design JAC applications and allows him to easily configure existing aspects (the ones that are provided by the JAC distribution). However, for the moment, the knowlege of the aspect configuration interfaces is still needed. In a short future, the IDE will provide some graphical customization means that will make the programmer task easier.

With the IDE, the programmer can also create entirely new aspects despite it is not documented yet.