Home

News (12/11/08)new

Start Here
Getting Started
Downloads


Documentation

Tutorials (12/07/08)new
Tablets Structure
Deployment
Web Studio
OpenL Basics
Constrainernew

Change Log

References
LGPL License


Motivational Reading

OpenL Apologia



SourceForge.net Logo

Getting Started with OpenL Tablets

Pre-requisites

1. Eclipse version 3.1.0 or higher (http://www.eclipse.org/downloads/)
Starting with version 5.0.5 we require Eclipse 3.3 or higher
It is recommended (even though not required) that both folders plugins/ and workspace/ are located in the same eclipse/ folder. All tutorials and examples are pre-configured for this situation and this will save you some time, effort and once in a while - sanity :)

2. JDK 1.5 or higher

OpenL Eclipse Plugin Installation

If you have OpenL Tablets previously installed in your Eclipse, uninstall it by going to Help | Software Updates | Manage Configuration. Locate OpenL Tablets for Eclipse … and first Disable it, then Uninstall it(Since Eclipse 3.3 you can do it in one step - right click + Uninstall ).

From Sourceforge.net Remote Site(only the latest published version)

1. Select Eclipse menu Help | Software Updates | Find and Install
2. Select Search for new features to install radio button and press Next
3. Press New Remote Site button
4. Fill dialog fields

Name: SF OpenL Tablets
URL: http://openl-tablets.sourceforge.net/site/
and press OK

5. Press Finish button
6. Follow installation dialog windows to download and install OpenL Tablets Plugin
7. Restart Eclipse

From Zip File

1. Download OpenL Tablets Plugin zip file from OpenL Sourceforge Project
2. Unpack zip file
3. Follow the instructions for Remote Site, except create New Local Site instead of New Remote Site and point it to the location of unzipped files

Installing and Running OpenL Examples

1. OpenL Plugin contains a small set of examples that could be installed using File | New | Project menu. Select one of OpenL Tablets/Examples/ projects and create it in workspace.
2. Usually example project contains some Main.java file that could be used to run it. OpenL Tablets files are in the rules/ folder. If they contain main() method they also can be run using context menu (right-click) Run As|OpenL Application
3. Successful example running will give you some assurance that installation have been done correctly

Creating Your own OpenL Tablets projects

1. Create project using File | New | Project menu. Select OpenL Tablets/Simple OpenL Tablets Project.
2. New Project is created from OpenL Template project. You may either completely replace project source files, or build your project on top of existing files. Remember to modify build/GenerateJavaWrapper.build.xml accordingly if you change the name of main .xls file or want to change the name of the generated Java file.

Working With OpenL Project

1. After updating Excel file don't forget to Save it in Excel and Refresh in Eclipse. To get a description of OpenL Tablets structure and semantics go here
2. To make changes in Java classes visible to OpenL Plugin use Project | Clean menu and "clean" selected project. It will reload project classloader inside OpenL Plugin. Otherwise compilation results might be inconsistent
3. To generate OpenL Java Wrapper run Generate ${my.project} Wrapper from Run menu and then Refresh the project. If Generate ${my.project} Wrapper line does not appear in Run menu, locate file Generate ${my.project} Wrapper.launch in project's root folder and using right-button menu Run As | 1 Generate ${my.project} Wrapper run it.
4. To Start Web Studio only for an OpenL project, select the project, use right-click menu Run As | Edit OpenL Project in Web Studio (since 5.0.5)

Integrating OpenL Tablets with Java Application

The recommended way of integrating OpenL with your Java code is through the use of so called Java Wrapper Class. Java Wrapper class is generated automatically by Ant script in the build/ folder of your project. You have to refresh Eclipse project each time you run Generate script. It is recommended to run Generate script every time when you:

  • Add or remove tables in OpenL Tablets document
  • Change signature of existing tables
  • You don't have to run Generate script if you change data or code in OpenL Tablets or change Java classes in your project.

    The java wrapper class mimics the structure of OpenL Tablets file using the following conventions:

  • Decision Tables become public methods
  • Data Tables become Java data fields accessible through standard Java Beans getter and setter methods
  • To access OpenL Tablets methods Java application simply creates new instance of Java Wrapper class and may call its methods. It is recommended (but not necessary) to cache Java Wrapper instance.

    For example:

    InsuranceRulesWrapper irw = new InsuranceRulesWrapper();
    int points = irw.calculateDriverPoints(driver);

    Runtime Operations

    OpenL Java Wrapper parses and compiles .xls file(s) only once. All instances of the Wrapper share the same parsed copy. To force re-parsing use wrapper method reload() or class-level method reset().

    Tutorials

    Each one of the OpenL Tablets tutorials is always a working OpenL project, that demonstrates different techniques using some of OpenL Tablets features. It is the best place to learn OpenL Tablets. The first few tutorials are included in plugin distribution. You can find them among pre-installed OpenL Tablets projects. Other tutorials should be available either from project CVS or distributed as separate bundles. See OpenL Tablets Tutorial for more details