Tutorial - Stardust SPI Programming

This small tutorial gives you a small overview on how a new custom application can be easily integrated in the Stardust Business Modeler.

Hello World Tutorial

We want to develop an "hello world" application. At modeling time we specify how many people we like to say hello.

Create a new Java Plug-in Project

We assume that you use Eclipse as your Java IDE. First of all create a new Java Plug-in Project - in our tutorial - named "tutorial.spi.helloworld". Please follow the screenshot.

Plugin1
Figure: Define the package structure

Plugin2
Figure: Define the plug-in content

Plugin3
Figure: Choose "Plug-in with property page"

Plugin4
Figure: Specify plug-in names

Plugin.xml

After this initial creation of your new plug-in the plugin.xml file opens. Create a plugin.properties file beside your plugin.xml and add the following variables:

pluginName = Hello World Application Type
providerName = SunGard CSA LLC

This variables will be dissolved in the plugin.xml file.

Create an additional directory named "icons", if you like to add a custom application icon. Otherwise you can use the standard Stardust application icon in /icons/full/obj16/application.gif. If you add a custom icon you have to export the image file in the build section of the plugin.xml for binary and source build.

The plugin.xml configuration has different layers which have to be configured. This is described in the next sections.

Overview

First of all we define the ID, Name and Version of the plug-in. For details see the image below.

Overview
Figure: Plugin.xml overview configuration

Dependencies

The next step is to specify all dependent plug-ins. Select the Dependencies link in the Plug-in content part. Click Add.. to open the Plug-in Selection dialog and choose the required plug-ins shown in the figure below.

Dependencies
Figure: Plugin.xml dependencies configuration

Runtime

After plug-in development you need to export your plugin. In the Runtime view Exported Packages part, click the Add button to open the Package Selection dialog and choose the following packages:

Package Selection
Figure: Package Selection

Now they are displayed in the Exported Packages part:

runtime
Figure: Plugin.xml runtime configuration

Extension Tab

Your custom application type needs two additional extensions:

In the All extensions part select Add... to add these plugins to the All Extensions configuration.

extentionPoints
Figure: Plugin.xml extension point selection

After the creation of these extensions the applications with its attributes can be added:

app
Figure: Add new application to Extension Point

allExtension
Figure: All added extensions

Development

Your new Plug-in project consists of a created package structure. The Activator class was generated with the creation of the plugin like the HelloWorldPropertyPage class.

As additional classes you need:

For best practice we recommend that you create also classes which provide constants or a small framework for messages.

Test

To test your newly created application, add a new Eclipse "runtime configuration":

In the new eclipse instance choose File > New > Process Manager Wizards > Stardust Process Model. A java project will be automatically generated. After browsing to your Stardust license you see the Stardust Process Workbench and your newly created application in the applications section. Please refer to the section Creating a new Model of the chapter Creating and Deleting Models for detailed information on how to create a Stardust process model.

Runtime

Every custom application type needs a runtime component. In our "Hello World" example you need the following classes at runtime:

You can duplicate them to avoid the need of the runtime classes and vice versa. Or you reference them in the plugin.xml and load them at modeling time.

The main runtime class is "HelloWorldApplicationInstance" which must be implemented.

Application Types

There a different types of applications you like to develop:

Application Type

Click the following link to download a ZIP file containing example attribute classes and access point provider classes for a plain Java application configuration:

Unzip this file to an example folder <spi-examples> of your choice. You find the access point provider classes in the folder <spi-examples>/org/eclipse/stardust/engine/core/pojo/app.

By using these classes your plugin.xml could look like the following:

<extension
         point="org.eclipse.stardust.modeling.core.applicationTypes">
    <application
            accessPointProvider="org.eclipse.stardust.engine.core.pojo.app.PlainJavaAccessPointProvider"
            id="tutorial.spi.helloworld.application3"
            name="Hello World Application"
            synchronous="true">
         <attribute name="carnot:defdesk:icon" value="/org/eclipse/stardust/engine/core/pojo/app/icon.gif"/>
         <attribute name="carnot:defdesk:panel" value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaApplicationPanel"/>
         <attribute name="carnot:engine:accessPointProvider" value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaAccessPointProvider"/>
         <attribute name="carnot:engine:applicationInstance" value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaApplicationInstance"/>
         <attribute name="carnot:engine:validator" value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaValidator"/>
         <attribute
               name="carnot:engine:runtimeValidator"
               value="org.eclipse.stardust.engine.core.pojo.app.PlainJavaValidator"/>
    </application>
<extension>

Data Type

The following code shows an example configuration for a primitive data type in the plugin.xml file:

<extension
      point="org.eclipse.stardust.modeling.core.dataTypes">
      <dataType
         accessPathEditorClass="org.eclipse.stardust.engine.extensions.xml.data.XPathEditor"
         id="primitive"
         name="Primitive Data">
         <attribute
            name="carnot:defdesk:accessPathEditor"
            value="org.eclipse.stardust.engine.core.pojo.data.POJOAccessPathEditor"/>
         <attribute
            name="carnot:defdesk:panel"
            value="org.eclipse.stardust.engine.core.pojo.data.PrimitivePropertiesEditor"/>
         <attribute
            name="carnot:engine:evaluator"
            value="org.eclipse.stardust.engine.core.pojo.data.PrimitiveAccessPathEvaluator"/>
         <attribute
            name="carnot:engine:validator"
            value="org.eclipse.stardust.engine.core.pojo.data.PrimitiveValidator"/>
      </dataType>
<extension>

Context Type

The following snippet shows a configuration example for a JSP application:

<extension point="org.eclipse.stardust.modeling.core.contextTypes">
	<context
     hasApplicationPath="false"
     hasMappingId="true"
     icon="icons/full/obj16/jsp_context_icon.gif"
     id="jsp"
     name="%ctxJSPApp"
     propertyPageClass="org.eclipse.stardust.modeling.core.spi.contextTypes.jsp.JspPropertyPage">
 	<attribute name="carnot:defdesk:icon" value="/org/eclipse/stardust/engine/extensions/web/jsp/contexts/icon.gif"/>
 	<attribute name="carnot:defdesk:panel" value="org.eclipse.stardust.engine.extensions.web.jsp.contexts.JSPContextTypePanel"/>
 	<attribute name="carnot:engine:validator" value="org.eclipse.stardust.engine.extensions.web.jsp.contexts..JSPValidator"/>
	<attribute name="carnot:engine:runtimeValidator" value="org.eclipse.stardust.engine.extensions.web.jsp.contexts..JSPValidator"/>       
 	</context>
</extension>