Access Keys:
Skip to content (Access Key - 0)









New SLEE 1.1 Profile Features

Print this page

Introduction

This document is intended to provide an overview Profiles in Rhino 2.0, Rhino 2.0 implements JAIN SLEE 1.1 Profiles. It highlights the enhancements made to 1.0 Profiles, describes how to use the new features in 1.1 Profiles and advises on changes necessary to migrate from 1.0 to 1.1 Profiles.

SLEE 1.1 Profiles Overview

Profiles are objects that contain provisioned data required by a component (e.g. SBB) to perform its function, such as configuration data or per subscriber data. A Profile Specification describes the schema of the Profile Tables created from the Profile Specification by the Administrator. A profile specification defines the set of attributes for every Profile Table created from that Profile Specification and every Profile created in these Profile Tables has the same attributes.

There are two definitions of the Profile Specification, one for SLEE 1.0 and one for SLEE 1.1. This is due to the changes in the Profile contract between 1.0 and 1.1. Note that SLEE 1.1 implementations support both the 1.0 and 1.1 Profile Specifications, the version being identified by the XML document type of the deployment descriptor. However, only SLEE 1.1 components can reference and use 1.1 Profile Specifications.

SLEE components (e.g. SBBs and Resource Adaptors) and management clients can now have write access to 1.1 Profiles (SBBs had a read-only view of Profiles in the SLEE v1.0 specification). Profile updates by SLEE components enable applications to modify Profile data during service execution. SLEE 1.1 Profiles may in fact also reference and use other Profiles. The SBB Developer's SBB object view has been renamed to the Profile Specification Developer's SLEE Component object view as both SBBs and Resource Adaptors may now view Profiles. SBBs and Resource Adaptors both share the same view - the SLEE Component object view.

The SLEE 1.1 specification defines two types of queries - static and dynamic. Each static query that is needed is declared in the Profile Specification, whereas dynamic queries may be declared after a Profile Specification has been deployed.

The ProfileProvisioningMBean interface provides additional facilities for managing Profiles in SLEE 1.1.

SLEE 1.1 Profile Concepts

There are now three ways to view a SLEE 1.1 Profile Specification (the SLEE Component object view, the Profile Specification Developer's management view and the Administrator's view).

SLEE Component object view

In this view, the Profile Specification Developer is concerned with the interfaces presented to objects such as SBB objects and/or Resource Adaptor objects to access data in a Profile conforming to the Profile Specification.

The Profile CMP interface defines the collection of persistent attributes (or CMP fields) of the Profile Specification. All persistent attributes that are contained in a Profile must be included in the Profile CMP interface. This interface must always be present.

The Profile Local interface defines the methods that are made visible to SLEE Components. If the Profile Specification does not define a Profile Local interface, then SLEE Components access a Profile through methods defined by the Profile CMP interface .

The Profile Abstract Class provides the implementations of these methods.

Profile Specification Developer's management view

In this view, the Profile Specification Developer is concerned with the interfaces and classes provided to and used by the SLEE management system to provision a Profile conforming to the Profile Specification.

The Profile CMP interface defines the collection of persistent attributes (or CMP fields) of the Profile Specification. All persistent attributes that are contained in a Profile must be included in the Profile CMP interface. This interface must always be present.

The Profile Management interface is the interface that defines the methods made available to management clients. If the Profile Management interface is not the same as the Profile CMP interface, then the management clients access a Profile through methods defined by the Profile Management interface. Otherwise the management clients access a Profile through methods defined by the Profile CMP interface .

The Profile abstract class provides the implementations of these methods.

Administrator's view.

In this view, the Administrator is concerned with the MBean interface derived by the SLEE. It is the Profile Specification's JMX MBean interface, (the Profile MBean interface) which is the external management interface that is visible to external management clients. The Profile MBean interface is generated by the SLEE when the Profile Specification is deployed.

Changes to the Profile Interfaces for SLEE 1.1 Profiles

The following tables show the changes made to the Profile interfaces for SLEE 1.1.

Interface Description
Profile abstract class In order to provide SLEE components with a read-write view of Profiles and to allow arbitrary application logic to be associated with Profile data, a new Profile class was required. This class is the Profile abstract class. The Profile abstract class replaces the Profile Management abstract class from SLEE 1.0.
Profile Local interface This is a new interface defined in SLEE 1.1. The Profile Local interface is used by SLEE components to invoke business methods on a Profile. The interface can be used so that Profiles can store data and execute program logic associated with that data.
Profile Table This is a new interface defined in SLEE 1.1. The Profile Table interface is defined so that SLEE components may create, query, and remove Profiles within a Profile Table.
Profile Usage Parameters Interface The SLEE 1.1 specification allows a Profile Specification to define a Usage Parameters Interface to collect usage information about Profiles in a Profile Table.
Profile Query Operations In order to provide flexible query operations for Profiles the SLEE 1.1 specification defines two types of queries - static and dynamic. Static queries are declared prior to the deployment of a Profile Specification into the SLEE. Dynamic queries may be declared after a Profile Specification has been deployed.
Table 1.1 - New Interfaces for SLEE 1.1 Profiles


Interface Description
Profile Specification There are two definitions of the Profile Specification, one for SLEE 1.0 and one for SLEE 1.1. This is due to the changes in the Profile contract between 1.0 and 1.1. SLEE 1.1 implementations support both the 1.0 and 1.1 Profile Specifications.
Profile Specification Developer's SLEE Component object view The SBB Developer's SBB object view has been renamed to the Profile Specification Developer's SLEE Component object view as both SBBs and Resource Adaptors may view Profiles. SBBs and Resource Adaptors both share the same view - the SLEE Component object view.
Permitted Combinations and associated views of a Profile Specification Due to the support for SLEE component read-write access to Profiles, the different component views of Profiles and their associated interfaces have been updated.
Table 1.2 - Changed Interfaces for SLEE 1.1 Profiles


Interface Description
Resource Info Profile Specification This has been deprecated in SLEE 1.1. It is no longer necessary as Resource Adaptors have access to Profiles. This Profile Specification may be removed in a future version of the SLEE specification.
Table 1.3 - Deprecated Interfaces for SLEE 1.1 Profiles


Method Description
getProfileTables public java.util.Collection getProfileTables(ProfileSpecificationID id)
This method returns a Collection of java.lang.String objects that identify the names of the Profile Tables that have been created from the Profile Specification specified by the id parameter.
getProfilesByStaticQuery public java.util.Collection getProfilesByStaticQuery(java.lang.String profileTableName, java.lang.String queryName, java.lang.Object[] parameters)
This method returns a Collection of ProfileID objects that identify all the Profiles in the Profile Table identified by the profileTableName argument that satisfy the search criteria of the static query identified by the queryName argument.
getProfilesByDynamicQuery public java.util.Collection getProfilesByDynamicQuery(java.lang.String profileTableName, QueryExpression expr)
This method returns a Collection of ProfileID objects that identify the Profiles in the Profile Table identified by the profileTableName argument that satisfy the search criteria specified by the expr argument.
getProfileTableUsageMBean public javax.management.ObjectName getProfileTableUsageMBean(java.lang.String profileTableName)
This method returns the Object Name of a ProfileTableUsageMBean object that can be invoked to obtain the usage information of the Profile Table specified by the profileTableName argument.
Table 1.4 - Additional Profile Provisioning Mbean Interfaces

Defining SLEE 1.1 Profiles

SLEE 1.1 Profile Specification

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE profile-spec-jar 
          PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE Profile Specification 1.1//EN" 
          "http://java.sun.com/dtd/slee-profile-spec-jar_1_1.dtd">
<profile-spec-jar>
  <profile-spec profile-read-only="False">
    <profile-spec-name>Test1114003Profile</profile-spec-name>
    <profile-spec-vendor>jain.slee.tck</profile-spec-vendor>
    <profile-spec-version>1.1</profile-spec-version>
    <profile-classes>
      <profile-cmp-interface>
        <profile-cmp-interface-name>
          com.opencloud.sleetck.lib.testsuite.management.ProfileProvisioningMBean.Test1114003ProfileCMP
        </profile-cmp-interface-name>
      </profile-cmp-interface>

      <profile-abstract-class>
        <profile-abstract-class-name>
          com.opencloud.sleetck.lib.testsuite.management.ProfileProvisioningMBean.Test1114003Profile
        </profile-abstract-class-name>
      </profile-abstract-class>

      <profile-table-interface>
        <profile-table-interface-name>
          com.opencloud.sleetck.lib.testsuite.management.ProfileProvisioningMBean.Test1114003ProfileTable
        </profile-table-interface-name>
      </profile-table-interface>

      <profile-usage-parameters-interface>
        <description>foo</description>
        <profile-usage-parameters-interface-name>
          com.opencloud.sleetck.lib.testsuite.management.ProfileProvisioningMBean.Test1114003ProfileUsage
        </profile-usage-parameters-interface-name>
        <usage-parameter name="foo" notifications-enabled="True"/>
      </profile-usage-parameters-interface>
    </profile-classes>

    <query name="compareStringParam">
      <query-parameter name="param" type="java.lang.String"/>
      <compare attribute-name="stringValue" op="equals" parameter="param"/>
    </query>
  </profile-spec>
</profile-spec-jar>

Notes:

  • DOCTYPE identifies the Profile Spec as a SLEE 1.1 Profile Spec.
  • profile-read-only attribute set to "False" means that any profiles generated from this Profile Spec will be read-writeable from the SLEE Component object view.
  • Interfaces: CMP, Abstract, Table, interfaces constitute the SLEE Component object view (in this case).
  • Usage: Usage Parameter "foo" is defined.
  • Query: Static Query "compareStringParam" is defined.

Define a Profile CMP Interface

public interface Test1114003ProfileCMP {
    public String getStringValue();
    public void setStringValue(String value);
}

The above declares a CMP field of name "stringValue" of type java.lang.String, together with its accessor methods. Note that if a SLEE Component has a read-only view of a Profile, then a SLEE Component cannot successfully invoke a set accessor method on the Profile CMP interface.

Define a Profile Abstract Class

Although the Profile abstract class is optional in the Profile Specification, a Profile abstract class must be defined if any of the following cases are true:

  • Management methods are defined in the Profile Management interface
  • Business methods are defined in the Profile Local interface.

The Profile abstract class must implement the javax.slee.profile.Profile interface and must provide an implementation of all methods defined in the Profile interface. In particular, the lifecycle callback methods allow initial values for Profile attributes to be set when the default Profile is created, or actions to be performed during the lifecycle state transitions.

public abstract class Test1114003Profile implements Test1114003ProfileCMP, Profile  {
   public Test1114003Profile() {
        super();
    }

    public abstract Test1114003ProfileUsage getDefaultUsageParameterSet();
    public abstract Test1114003ProfileUsage getUsageParameterSet(String name)
        throws UnrecognizedUsageParameterSetNameException;

    public void setProfileContext(ProfileContext context) {
        this.context = context;
    }

    public void unsetProfileContext() { }
    public void profileInitialize() { }
    public void profilePostCreate() throws CreateException { }
    public void profileActivate() { }
    public void profilePassivate() { }
    public void profileLoad() { }
    public void profileStore() { }
    public void profileRemove() { }
    public void profileVerify() throws ProfileVerificationException { }

    private ProfileContext context;
}

Define a Profile Table Interface

The Profile Table interface defines methods to create, find, remove, and execute static queries on Profiles within a Profile Table. These operations are defined by the JAIN SLEE 1.1 specification in the javax.slee.profile.ProfileTable interface

public interface Test1114003ProfileTable extends ProfileTable {
    public Collection queryCompareStringParam(String param);
}

(Optionally) define a Profile Local Interface if you wish to access the Profile via an SBB or RA

Each method invoked on the Profile Local interface causes a method with the same signature on the Profile abstract class to be invoked. The profile local interface must extend the SLEE-defined javax.slee.profile.ProfileLocalObject interface.

The methods declared in a Profile Local interface are divided into the two following categories:

  • CMP field get and/or set accessor methods.
    These methods are the same as those declared in the Profile CMP interface i.e. they have the same method signature. The SLEE provides the implementation of these methods in the Profile concrete class
  • Business methods.
    These are methods declared in the Profile Local interface but not declared in the Profile CMP interface. The Profile abstract class must implement these business methods. The Profile Specification must include a Profile abstract class if business methods are included in the Profile Local interface. These business methods may invoke the CMP accessor methods.
public interface Test1114003ProfileLocal extends ProfileLocalObject {
    public int getStringValue();
    public void setStringValue(String value);
}

How might a Profile Local Interface work? In a typical scenario, an SBB object may consult provisioned data to perform a simple lookup, such as a number translation. In this scenario the "key" of the Profile is a non-translated number, and the SBB requests a Profile Table to return a matching result using a static query method defined on a Profile Table interface. The query method returns a Profile local object that represents a Profile matching the query. The calling SBB object then invokes a method on the query result to retrieve the translated number.

(Optionally) define a Profile Management Interface if you wish to access the Profile through a management client

The methods declared in a Profile Management interface are divided into the two following categories:

  • CMP field get and set accessor methods.
    These methods are the same as those declared in the Profile CMP interface i.e. they have the same method signature. The SLEE provides the implementation of these methods in the Profile concrete class
  • Management methods.
    These methods are declared in the Profile Management interface and not declared in the Profile CMP interface. The Profile abstract class must implement these business methods. The Profile Specification must include a Profile abstract class if business methods are included in the Profile Management interface.
public interface Test1114003ProfileManagement {
    public String getStringValue();
    public void setStringValue(String value);
    public void manage();
}

Change any SLEE 1.0 ProfileManagement interfaces

Any existing ProfileManagement interface from the SLEE 1.0 Specification needs to be replaced by the SLEE generated Profile interface (javax.slee.profile.Profile).

public interface Profile {
       public void setProfileContext(ProfileContext context);
       public void unsetProfileContext();
       public void profileInitialize();
       public void profilePostCreate()
               throws CreateException;
       public void profileRemove();
       public void profileActivate();
       public void profilePassivate();
       public void profileLoad();
       public void profileStore();
       public void profileVerify()
               throws ProfileVerificationException;
}

Profile Usage Parameters

A usage parameter is a parameter that can be updated by an object in the SLEE to provide usage information and is accessible by the Administrator through the management interface of the SLEE. A SLEE 1.1 Profile Specification may now optionally declare a Usage Parameters interface.
For the example Profile Specification Test1114003Profile a Usage Parameters interface is declared as Test1114003ProfileUsage and uses the Counter-type usage parameter increment method:

public interface Test1114003ProfileUsage {
    public abstract void incrementFoo(long value);
}

Profiles get access to a usage parameter set using get Usage Parameter methods declared in the Profile abstract class. There are two forms of the get Usage Parameter methods. The first form returns the default usage parameter set and the second form returns a named usage parameter set.

public abstract Test1114003ProfileUsage getDefaultUsageParameterSet();
public abstract Test1114003ProfileUsage getUsageParameterSet(String name)
              throws UnrecognizedUsageParameterSetNameException;

Use of Static Queries

The Profile Specification Developer declares a static query method (for every static query that is wanted in the SLEE Component object view) in the Profile Specification. For each static query defined in the Profile Specification there is a corresponding query method defined in the Profile Table interface. Methods defined on the Profile Table interface allow SLEE components to execute static queries and methods defined on the ProfileProvisioningMBean interface allow management clients to execute static queries.

A SLEE component can then obtain the Collection of ProfileID objects that satisfy the search criteria using the method:

public java.util.Collection getProfilesByStaticQuery(java.lang.String profileTableName,
                                            java.lang.String queryName,
                                            java.lang.Object[] parameters)

The queryName argument identifies the search criteria by naming a static query that has been predefined in the Profile Specification from which the Profile Table was created. This Profile Table is identified by the argument profileTableName. The parameters argument is a list of parameter values to apply to the parameters of the static query (if the static query takes no arguments then this value is null).

Enclosed is an code example for using a static query, based on the Profile Specification that has been defined (Test1114003Profile) using the defined static query compareStringParam

public static final String QUERY_NAME = "compareStringParam";
public static final String QUERY_PARAM = "Test1114003Query";
public static final String PROFILE_NAME  = "Test1114003Profile_1";
Collection profileCollections;
Object[] queryParameters = {new String(QUERY_PARAM)};

//run query
try {
    profileCollections = profileProvisioning.getProfilesByStaticQuery(
                               PROFILE_TABLE_NAME, QUERY_NAME, queryParameters);
} catch (Exception e) {
    throw new TCKTestFailureException(
                    assertionID, "Exception occurred when executing query ", e);
}

The query returns a list of objects of type Collection that can then be inspected using the Java Collections interface. The SLEE throws a ManagementException if this method is invoked against a Profile Table created from a SLEE 1.0 Profile Specification.

Use of Dynamic Queries

The getProfilesByDynamicQuery method returns a Collection of ProfileID objects that satisfy the search criteria specified by the expr argument, for the Profiles in the Profile Table idenfifed by the profileTableName argument. Dynamic queries are accessible by management clients only through the ProfileProvisioningMBean interface.

A SLEE component can then obtain the Collection of ProfileID objects that satisfy the search criteria using the method:

public java.util.Collection getProfilesByDynamicQuery(java.lang.String profileTableName,
                                              QueryExpression expr)

The expr argument contains the attributeName of the indexed attribute searched, the attributeValue to search for in the specified attribute and the operator or combinations of operators to apply to the search criteria. Query expressions are in javax.slee.profile.query.

Enclosed is an code example for using a dynamic query, based on the Profile Specification that has been defined (Test1114003Profile)

public static final String PROFILE_TABLE_NAME = "Test1114003ProfileTable";
public static final QueryExpression equalsString = new Equals("stringValue", "42");
//run query
try {
    Collection col = profileProvisioning.getProfilesByDynamicQuery(PROFILE_TABLE_NAME, equalsString);
} catch (Exception e) {
    throw new TCKTestFailureException(assertionID, "Exception occurred when executing query ", e);
}

The query returns a list of objects of type Collection that can then be inspected using the Java Collections interface. The SLEE throws a ManagementException if this method is invoked against a Profile Table created from a SLEE 1.0 Profile Specification.

The getProfilesByIndexedAttribute Method

Note that the getProfilesByIndexedAttribute method has been deprecated in SLEE 1.1. If this method is used against a Profile Table created from a SLEE 1.1 Profile Specification the SLEE will reject  the invocation by throwing a ManagementException.

Adaptavist Theme Builder Powered by Atlassian Confluence