This interface provides an alternative access mechanism for all SBB CMP fields.
This includes CMP fields declared in the SBB abstract class itself, as well as any CMP extension interfaces.
For SBB parts, this interface provides the sole access mechanism for SBB part CMP fields.
An SBB may obtain an instance of this interface from the its SbbContext
object.
An SBB part may obtain an instance of this interface from its SbbPartContext
object.
All methods defined in this interface that return CMP field names return each name with the first letter lowercase.
For example "foo
" rather than "Foo
". However all methods that take a CMP field name as an argument accept names with the first letter either uppercase or lowercase.
For example, the CMP field "foo
" may be retrieved, set, reset, etc using either the name "foo
" or "Foo
".
CMP Extension Interfaces
CMP extension interfaces allow an SBB to store additional state that may not be directly known when the SBB abstract class is developed.
For example, the SBB build process may allow additional components to be "plugged in" to the base SBB, each which may require their own CMP state.
The components can define the CMP state they need using a CMP extension interface then these interfaces can be declared in the SBB deployment descriptor when the SBB is packaged.
An SBB’s CMP extension interfaces are declared in the oc-sbb-jar.xml
SBB extension deployment descriptor.
CMP extension interfaces are also the mechanism by which an SBB part declares CMP fields.
SBB parts declare their CMP extension interfaces in the oc-sbb-part-jar.xml
SBB part deployment descriptor.
Defining and Using CMP Extension Interfaces
A CMP extension interface contains methods relating to CMP fields according to the following rules:
-
For a given CMP field "foo
", the interface must define getFoo
and setFoo
CMP field accessor methods according to standard JAIN SLEE rules.
-
For a given CMP field "foo
", the interface may also optionally define either or both of the following methods:
public boolean hasFoo();
public void resetFoo();
-
Methods defined in a CMP extension interface must have empty throws clauses.
-
The CMP extension interface may optionally extend this CMPFields
interface, either directly or indirectly.
Extending this interface is only strictly necessary if arbitrary CMP fields, access to the CMP fields via the parameterised get
, set
, etc methods, or use of any of the other utility methods defined in this interface, are needed and multiple typecasts are undesired.
-
All CMP field storage optimisations supported by Rhino for standard CMP fields are also supported for CMP fields declared in a CMP extension interface, eg. FastSerializable
, Encodable
, etc.
-
The PassByReference
, DatatypeCodec
, and InitialValueField
annotations are fully supported as normal on getter and setter CMP field methods declared in a CMP extension interface.
A CMP extension interface may also be annotated with PassByReference
.
Arbitrary CMP Fields
An SBB or SBB part may optionally permit use of arbitrary CMP fields.
Arbitrary CMP fields are simply CMP fields that have not been explicitly declared in the SBB abstract class or any CMP extension interface, and can only be accessed using the parameterised get
, set
, etc, methods, or a CMPField
object.
The following rules apply to arbitrary CMP fields:
-
Arbitrary CMP fields are only permitted if indicated in the oc-sbb-jar.xml
SBB extension deployment descriptor or oc-sbb-part-jar.xml
SBB part deployment descriptor.
If arbitrary CMP fields are not permitted, then attempting to access or manipulate a CMP field that has not been declared in the SBB abstract class or any CMP extension interface will result in an UnrecognisedFieldNameException
being thrown.
-
Arbitrary CMP fields must have a non-null name.
If a null name is passed as an argument then a NullPointerException
will be thrown.
-
The values assigned to arbitrary CMP fields must be serialisable using standard Java serialisation. FastSerializable
objects are also supported. Encodable
types and those annotated with DatatypeCodec
are not currently supported; FastSerializable
should be used instead if possible.
-
The values assigned to arbitrary CMP fields always exhibit pass-by-value semantics as per standard SLEE-defined CMP field behaviour.
Pass by reference is not supported for these CMP fields.
General Usability
All methods defined in a CMP extension interface are mandatory transactional methods.
Unless otherwise stated, all methods defined in the CMPFields
interface are also mandatory transactional methods.
If they are invoked without a valid transaction context a TransactionRequiredLocalException
will be thrown.
In addition, these methods may only be invoked on an SBB or SBB part object that has been assigned to an SBB entity, or is in the process of being assigned to an SBB entity via the sbbCreate
method.
If the SBB or SBB part object is not assigned to an SBB entity (with the exclusion of the sbbCreate
method), a IllegalStateException
is thrown.