What are plug-ins used for, and how do they work?

Plugins are Java Classes that are registered to the dialog application under a given namespace. Registered plugins can be accessed from Jexl-Expressions within SiAM models, e.g, dialogue specifications, semantic mapping rules, GUIs, or grammar rules. Plugins can be used for different things and computations that are easier to realize directly with Java code that in Jexl-Expressions or with Executables in a dialogue model. Furthermore the application developer has direct access to other Java APIs.

The creation of new plugins is quite easy. The only requirement to a Java class that is registered as plugin is that the class is available in the class loader of your Dialog Application OSGi bundle (the bundle where also all model resources are defined). Furthermore the class and all methods, you want to invoke, must be public.

A plugin is registered in the project specification resource of your application which normally has the file ending .project. Use the following steps:

1. Create a new Java Plugin child for the Project concept

2. Set the class name property of the new Java Plugin to the name of your Java Class (use the full  name including the package), e.g, de.dfki.iui.example_application.MyPlugin

3. Set the namespace property, which is used for accessing the plugin, e.g., to myPlugin

When the dialog application is started, an instance of the indicated class is created. The class can now be accessed in a Jexl-Expression with the given namespace. Method return value and call arguments are fully supported. If your Java class, e.g, defines the method String getStringForValue(int value) you can call the method inside a Jexl-expression by the following code: myPlugin.getStringForValue(5).

Category: Dialogue Design

← What are plug-ins used for, and how do they work?