DeltaJ | Installation | Using the example project | Creating new DeltaJ project
We created an example Software Product Line (SPL) SimpleTextEditor (STE) using DeltaJ 1.5. This website presents a short hands-on with DeltaJ 1.5 and the STE. After you have read this page - and tried it on your machine - you should be able to use DeltaJ, maybe you ahould have a look at the Creating a new DeltaJ project site to learn how to start from scratch. This site is devided into the following sections:
Download and Import
In this section you learn how to download and import the STE into you Eclipse workspace with installed DeltaJ 1.5 plug-in.
3. Select Existing Project into Workspace which you find in the General folder and hit [Next >].
4. Now choose Select root directory and hit [Browse] to navigate to the STE project folder. Now you can choose the SimpleTextEditor and hit [Finish]
5. After you have successfully imported the project, Eclipse will build it. This process may take a while. During this process you will see some output in the console. When you see this, a dialog window appears on your main screen and asks you to select the products to be generated. Please select at least one of the products.
Now, You can start to examine the project and get in touch with DeltaJ 1.5.
This picture shows the Package Explorer of Eclipse with the STE example. IT contains - like every DeltaJ project - three important source code folders:
src: This is the default source folder. It normally contains the delta modules, which are saved as .deltaj files.
spl-info: This folder contains the Software Product Line Declaration (SPLD) file. There you define Features, Delta modules, Constraints which structure the features and declare dependencies, the n-m-mapping of Features and Delta Modules and the Product definitions.
src-gen: This folder contains the generated source code for the products. In the beginning it is empty. The generation process will generate Java source files which are then saved in this folder. Each product has its own root package, that allows to generate different products side-by-side. Depending on your Eclipse setting you might see a pretended chaotic list of a lot of packages there. But don't worry!
Every DeltaJ project is based on default Java projects. That gives you the ability to also add Java source files to the src folder or to link external APIs which are used within the SPLs source code.
There is a domain-specific language (DSL) to define the SPL declaration. The syntax is intuitive. It contains a set to define features and a set to define delta modules. Then it contains a block to define constraints which are used to express the Feature Model with a set of boolean expressions over feature names. Next is a block to map delta modules to feature configurations. This is an n-to-m mapping! The partitions block provide a partial application order of the delta modules. Delta modules referenced in an early partition are applied earlier then delta modules referenced in later partitions. Delta modules which are referenced within the same partition can be applied in any order.
A partition contain so called when clauses, which are separeted by a comma. Partitions themselve are separated by a semicolon. A when clause begins with a set of delta modules followed by the keyword when followed by an expression over features.
The Last block of the SPLD file contains product definitions. These sets look like the features set.
The DeltaJ editor is the main editor for DeltaJ projects. It shows the source code. For a better user experiance it supports syntax highlighting. DeltaJ-specific keywords are green and Java keywords are magenta, like in the Java editor. There is also some of the Java syntax coloring, but it is not implemented completely. But the editor supports pretty printing to automatically format the source code. If your Eclipse shows the Outline view you can find Compilation Units, type definitions, fields and methods easily by clicking on them in the outline view. In the current version there is only the static validation which was generated from the grammar. For complete validation you have to open the generted Java files. We are planning to implement a better validation in the future. The well known proposal feature of Eclipse does not support semantic porposals in the current version. It will be implemented in the future.
You can use the hole Java 1.5 syntax to implement classes.
In the current version there is no button or menu item for generating the products. But the product generation is implemented! You have to use the SPLD file to generate a product. The workflow to generate any product is the following:
2. Save the file. This action triggers the product generation process. The plug-in tells you about the progress in the console view of Eclipse.
If you see Waiting for the user to select the products that should be generated ... in the console, the process has opened a dialog window which asks for the products to be generated. Please select the products you want to generate and hit [Continue],
3. The product generation will take a while. The process will tell you what it is currently doing in the console. The process is determined if you see the message Selected products of >SPLName< are successfully generated.
4. Now, go to the src-gen folder, it contains the generated source of the selected products. Each product is contained in the product's root package. Navigate to the class which contains the main(String[]) method, open it and then you can run the generated product.
If the generated source code contains any errors, you have to correct these in the corresponding delta module. An easy way to figure out which delta module contains the error, are the generated Javadoc comments above each element. Here you see three screenshots of the same method which was modified by different deltas.
And here are the corresponding operations in the delta modules: