Generating a Dynamic Wrapper

Only an interface must be defined when creating a project for a dynamic wrapper. OpenL Tablets users can clearly define rules displayed in the application by using this interface. Using dynamic wrappers is a recommended practice.

This section illustrates the creation of a dynamic wrapper for a Simple project in Eclipse with the OpenL Tablets Eclipse Update Site installed. Only one rule hello1 is created in the Simple project by default.

Figure 37: The hello1 rule table

Proceed as follows:

  1. In the project src folder, create an interface as follows:

  2. public interface simple {

    void hello1(int i);

    }

  3. Create a class for a wrapper as follows:

  4. package template;

    import static java.lang.System.out;

    import org.openl.rules.runtime.RuleEngineFactory;

    public class Dynamic_wrapper {

    public static void main(String[] args) {

    //define the interface

    RuleEngineFactory<simple> rulesFactory = new RuleEngineFactory<simple>("rules/TemplateRules.xls", simple.class);

    simple rules = rulesFactory.newInstance();

    rules.hello1(12);

    }

    }

    When the class is run, it executes and displays Good Afternoon, World!