JBoss.orgCommunity Documentation

Chapter 6. Creating a JAIN SLEE Service Building Block (SBB)

To create a component it may be easier (but not mandatory) to first create a package to contain it. This package should be created as a child of the <sbb-module>/src/main/java folder. To do this right-click on the src folder and select NewPackage. Give the new package a name using the popup dialog (shown below).

Figure 6.1. Creating a new Package in Eclipse


In case a new package is not created at this point, it can still be created in the Component wizard, but no validation is performed at that time, regarding the package naming conventions.

To create a new JAIN SLEE SBB, right-click on the created package (or the module entry if the package is not yet created) and choose NewOther ... as shown below.

Figure 6.2. Creating a new JAIN SLEE Component in EclipSLEE


A dialog should appear. Expand the JAIN SLEE item and choose JAIN SLEE Service Building Block (SBB). The dialog should now look like the following:

Figure 6.3. Creating a new JAIN SLEE SBB in EclipSLEE


Click Next to get the following dialog:

Figure 6.4. Selecting the package and name for a new JAIN SLEE SBB in EclipSLEE


The source folder and package dialogs will be completed if NewOther ... has been selected from right-clicking on a package. Otherwise it may need to be chosen by selecting Browse... and selecting the desired locations or typing it's name in the appropriate field and it will be created in the end.

Name the SBB; the name must end with "Sbb.java". Then click Next to go to the component identity dialog, pictured below:

Figure 6.5. JAIN SLEE Component Identity dialog in EclipSLEE


The Name, Vendor and Version fields are mandatory and are used by the SLEE to identify the SBB. The description field is optional, but strongly recommended to be completed to allow easy identification of the SBB in future.

After completing these fields click Next to specify the SBB's class files.

Figure 6.6. JAIN SLEE SBB companion interfaces selection in EclipSLEE


This dialog allows you to specify that a custom SBB Local Object and/or Activity Context Interface is required for this SBB. Select the required interfaces, then click Next to edit the SBB's CMP fields.

Figure 6.7. JAIN SLEE SBB CMP Fields definition in EclipSLEE


Here, the SBB's CMP fields can be set. Add a CMP field by clicking on Add. A field can be removed by selecting it in the table and clicking Remove. To modify a CMP field, click on the Modify button next to it in the table.

Figure 6.8. JAIN SLEE SBB CMP Field configuration in EclipSLEE


Name the CMP field in the Name text field. A CMP field can either be a standard Java object, primitive or an SbbLocalObject. Select the statement that represents the data type to be stored in the field.

A standard Java object or primitive type requires the fully qualified type name to be entered into the Type text field. For example, java.lang.String.

A CMP field that stores an SbbLocalObject may only store SBBs of a specific identity. The drop down SBB box will contain all the SBBs that the EclipSLEE plugin was able to find. Choose the one that should be stored in the CMP field, and give it a Scoped Name. This is a variable name and should be a valid Java variable name, and should begin with a lowercase letter.

If an SBB needs to store an SBB of its own type in a CMP field, then the SBB must be created without that CMP field, and the CMP field added later.

Once the CMP field is correct click OK and the wizard CMP page will be updated with the new data.

Repeat until all CMP fields are created, then click Next to edit the SBB's usage parameters:

Figure 6.9. JAIN SLEE SBB Usage Parameters definition in EclipSLEE


Check Create SBB usage interface if you require the SBB usage interface. Then add usage parameters by clicking Add and modifying the values in the table. Two types of parameter are available: increment and sample.

Click Next to move to the event selection dialog, shown below:

Figure 6.10. JAIN SLEE SBB Events selection in EclipSLEE


The event selection dialog contains a list of all the events the plugin could find in your project. This includes any events that were installed as external components.

For each event that you would like your SBB to fire or receive:

  1. Select the event in the available events table.

  2. Click Select Event; the event will move to the selected events table.

  3. Click Modify... for that event in the selected events table. This will create the following dialog.

    Figure 6.11. JAIN SLEE SBB Event configuration in EclipSLEE


  4. Review the Scoped Name and change it if desired.

  5. Set the event direction.

  6. If the event direction is Receive or FireAndReceive check This is an initial event if it should be an initial event for a service.

  7. If this is an initial event, choose one or more initial event selectors.

  8. Click OK

When all events have been configured the dialog may look something like this:

Figure 6.12. JAIN SLEE SBB Events configured in EclipSLEE


Click Next to define the SBB's profile specifications.

Figure 6.13. JAIN SLEE SBB Profile Specifications selection in EclipSLEE


The profile selection dialog contains a list of all the profiles the plugin could find in your project. This includes any profiles that were installed as external components. If your custom profiles are not listed, verify that they have been compiled and the "jars" folder refreshed.

For each profile specification the SBB should reference:

  1. Highlight the profile specification in the available profiles table.

  2. Click Select Profile

  3. Review the Scoped Name and change if required.

  4. If your SBB should contain an Address Profile Specification select it from the drop down list.

Click Next to proceed to the child SBB's dialog.

Figure 6.14. JAIN SLEE SBB Child SBBs selection in EclipSLEE


The child selection dialog contains a list of all the SBBs the plugin could find in your project. This includes any SBBs that were installed as external components. If your custom SBBs are not listed, verify that they have been compiled and the "jars" folder refreshed.

For each child SBB the SBB should reference:

  1. Highlight the child SBB in the available SBBs table.

  2. Click Select SBB

  3. Review the Scoped Name and change if required.

  4. Set the default priority of the child SBB.

Click Next to proceed to the resource adaptor types dialog.

Resource Adaptor Type Creation and Binding not supported in current version!

Since Resource Adaptor Type Creation and Binding is not supported in the current EclipSLEE version, you should skip these steps and move to next dialog, "Environment Entries"

Click Next to edit the SBB's environment entries.

Figure 6.15. JAIN SLEE SBB Environment Entries definition in EclipSLEE


Add an environment entry with the "Add" button. Set its name, type, value, and optionally, description in the table. Do this for each environment entry.

Then click Finish to create the SBB.

Skipping optional steps

Finish can be clicked at any point after setting the SBB's identity if a skeleton SBB is required. It is not necessary to complete each wizard page first.

The SBB Java file, MobicentsDemoSbb.java (plus the remaining interfaces and classes which were selected at the wizard) is created in the specified package and opened for editing in the workspace. The sbb-jar.xml deployment descriptor is updated to reflect the new sbb or created if not already present. The resulting workspace can be seen below.

Figure 6.16. JAIN SLEE SBB created in workspace using EclipSLEE