public interface Sbb
Sbb
interface is implemented by every Service Building Block (SBB)
abstract class. Every SBB must include an SBB abstract class. The SLEE uses the
methods defined in this interface to notify SBB objects of lifecycle events.
Additional method declarations
An SBB developer may define or implement a number of additional methods in the SBB
abstract class that follow certain design patterns. These are:
public void on<event-name>(<event-class-name> event,
<activity-context-interface-name> aci) { ... }
public void on<event-name>(<event-class-name> event,
<activity-context-interface-name> aci, EventContext context) { ... }
where:
event-name
is the name of the event given in the SBB's deployment
descriptor.
event-class-name
is the class name of event objects of the
repective event type.
activity-context-interface-name
is the name of the Activity
Context Interface used by the SBB, as defined in the SBB's deployment descriptor.
Event-handler methods are invoked with a valid transaction context on an SBB in the Ready state.
public InitialEventSelector <method-name>(InitialEventSelector ies) { ... }
where:
method-name
is the name of the method as defined in the SBB's
deployment descriptor.
Initial event selector methods are invoked on an SBB in the Pooled state with an unspecified transaction context.
javax.slee.SLEEException
if the operation could not be successfully completed
due to a system-level failure.
public abstract void set<field-name>(<field-type> value);
public abstract <field-type> get<field-name>();
where:
field-type
is the Java type of the CMP field.
field-name
is the name of the CMP field as declared in the SBB's deployment
descriptor, with the first letter capitalized.
These methods are mandatory transactional methods. If they are invoked without a valid
transaction context a javax.slee.TransactionRequiredLocalException
will be
thrown. In addition, these methods may only be invoked on an SBB 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 object is not assigned to an SBB entity (with
the exclusion of the sbbCreate
method), a java.lang.IllegalStateException
is thrown.
public abstract void fire<event-name>(<event-class-name> event,
ActivityContextInterface aci, Address defautAddress);
public abstract void fire<event-name>(<event-class-name> event,
ActivityContextInterface aci, Address defautAddress, ServiceID service);
where:
event-name
is the name of the event given in the SBB's
deployment descriptor.
event-class-name
is the class name of event objects of the
repective event type.
These methods are mandatory transactional methods. If they are invoked without a valid
transaction context a javax.slee.TransactionRequiredLocalException
will be
thrown. In addition, these methods may only be invoked on an SBB 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 object is not assigned to an SBB entity (with
the exclusion of the sbbCreate
method), a java.lang.IllegalStateException
is thrown.
javax.slee.ActivityContextInterface
.
This method allows the SBB to obtain an object that implements the SBB's Activity
Context Inteface from an object that implements the generic
javax.slee.ActivityContextInterface
. If declared, the method's
signature must be:
public abstract <activity-context-interface-name>
asSbbActivityContextInterface(ActivityContextInterface aci);
where:
activity-context-interface-name
is the name of the Activity
Context Interface used by the SBB, as defined in the SBB's deployment descriptor.
This method is a mandatory transactional method. If it is invoked without a valid
transaction context a javax.slee.TransactionRequiredLocalException
will be
thrown. In addition, this method may only be invoked on an SBB 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 object is not assigned to an SBB entity (with
the exclusion of the sbbCreate
method), a java.lang.IllegalStateException
is thrown.
public abstract ChildRelation <method-name>();
where:
method-name
is the name of the child relation method as defined
in the SBB's deployment descriptor.
These methods are mandatory transactional methods. If they are invoked without a valid
transaction context a javax.slee.TransactionRequiredLocalException
will be
thrown. In addition, these methods may only be invoked on an SBB object that has been
assigned to an SBB entity. If the SBB object is not assigned to an SBB entity a
java.lang.IllegalStateException
is thrown.
Profile Local Interface
objects rather
than Profile CMP Interface objects. Profile Local Interface objects can be obtained by
using the methods on the profile table's Profile Table Interface
.
A profile table's Profile Table Interface object can be obtained from the
Profile Facility
.For each profile specification used by the SBB, the SBB abstract class may declare a method with the following signature:
public abstract <profile-CMP-interface-name>
<method-name>(ProfileID id) throws
javax.slee.profile.UnrecognizedProfileTableNameException,
javax.slee.profile.UnrecognizedProfileNameException;
where:
profile-CMP-interface-name
is the name of the profile's
CMP interface.
method-name
is the name of the profile CMP accessor method as defined
in the SBB's deployment descriptor.
These methods are mandatory transactional methods. If they are invoked without a valid
transaction context a javax.slee.TransactionRequiredLocalException
will be
thrown. In addition, these methods may only be invoked on an SBB 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 object is not assigned to an SBB entity (with
the exclusion of the sbbCreate
method), a java.lang.IllegalStateException
is thrown.
public abstract <usage-parameters-interface-name>
getDefaultSbbUsageParameterSet();
public abstract <usage-parameters-interface-name>
getSbbUsageParameterSet(String paramSetName) throws
javax.slee.usage.UnrecognizedUsageParameterSetNameException;
where:
usage-parameters-interface-name
is the name of the SBB's usage
parameters interface.
These methods run in an unspecified transaction context, therefore an active transaction is not necessary in order for these methods to be successfully invoked. Additionally these method may be invoked by an SBB object in any state.
Modifier and Type | Method and Description |
---|---|
void |
sbbActivate()
The SLEE invokes this method on an SBB object in the Pooled state when the SLEE
reassigns the SBB object to an existing SBB entity.
|
void |
sbbCreate()
The SLEE invokes this method on an SBB object in the Pooled state when it needs to
create a new SBB entity.
|
void |
sbbExceptionThrown(Exception exception,
Object event,
ActivityContextInterface aci)
This SLEE invokes this method on an SBB object when a mandatory transactional
method of the SBB object throws an unchecked exception.
|
void |
sbbLoad()
The SLEE invokes this method on an SBB entity when the state of the SBB entity needs
to be synchronized with the state in the underlying data source.
|
void |
sbbPassivate()
The SLEE invokes this method on an SBB object in the Ready state when the SLEE
needs to reclaim the SBB object assigned to an SBB entity.
|
void |
sbbPostCreate()
The SLEE invokes this method on an SBB object in the Pooled state when it needs to
create a new SBB entity.
|
void |
sbbRemove()
The SLEE invokes this method on an SBB entity when the SBB entity is going to be
removed.
|
void |
sbbRolledBack(RolledBackContext context)
The SLEE invokes this method on an SBB entity when a transaction started immediately
prior to invoking the SBB entity rolls back.
|
void |
sbbStore()
The SLEE invokes this method on an SBB entity when the state of the underlying data
source needs to be synchronized with the state of the SBB entity.
|
void |
setSbbContext(SbbContext context)
Set the
SbbContext object for the SBB object. |
void |
unsetSbbContext()
Unset the
SbbContext object for the SBB object. |
void setSbbContext(SbbContext context)
SbbContext
object for the SBB object. The SLEE invokes this
method immediately after a new SBB object has been created. If the SBB object
needs to use the SbbContext
object during its lifetime, it should
store the SbbContext
object reference in an instance variable.
This method is invoked with an unspecified transaction context. The SBB object cannot access its persistent CMP state or invoke mandatory transactional methods during this method invocation.
context
- the SbbContext
object given to the SBB object by the SLEE.void unsetSbbContext()
SbbContext
object for the SBB object. If the SBB stored a
reference to the SbbContext
object given to it in the setSbbContext(javax.slee.SbbContext)
method, the SBB should clear that reference during this method.
This is the last method invoked on an SBB object before it becomes a candidate for garbage collection.
This method is invoked with an unspecified transaction context. The SBB object cannot access its persistent CMP state or invoke mandatory transactional methods during this method invocation.
void sbbCreate() throws CreateException
The SBB entity typically initializes its CMP state during this method. The SLEE
guarantees that the initial values returned from CMP accessor methods will be the
default initial values as defined by the Java language (eg. 0 for int
,
This method is invoked with an active transaction context.
CreateException
- this exception may be thrown by the SBB code if the SBB
entity could not be created successfully.void sbbPostCreate() throws CreateException
This method is invoked with the same transaction context that the corresponding
sbbCreate()
method was invoked with.
CreateException
- this exception may be thrown by the SBB code if the SBB
entity could not be created successfully.void sbbActivate()
This method is invoked with an unspecified transaction context. The SBB object cannot access its persistent CMP state or invoke mandatory transactional methods during this method invocation.
void sbbPassivate()
sbbActivate()
method, that should not be held while the SBB
object is in the Pooled state.
This method is invoked with an unspecified transaction context. The SBB object cannot access its persistent CMP state or invoke mandatory transactional methods during this method invocation.
void sbbLoad()
This method is invoked with an active transaction context.
void sbbStore()
This method is invoked with an active transaction context.
void sbbRemove()
sbbCreate()
, sbbPostCreate()
, or
sbbActivate()
should be released by the SBB object. The SBB object
transitions to the Pooled state after this method returns.
This method is invoked with an active transaction context. If the remove operation was initiated by a parent SBB entity, the transaction context is the same as the transaction context in effect when the remove operation was initiated.
void sbbExceptionThrown(Exception exception, Object event, ActivityContextInterface aci)
sbbCreate()
or sbbPostCreate()
method threw the
exception, otherwise it will be in the Ready state and associated with an SBB entity.
This method is invoked with the same transaction context as that held by the method that threw the exception, however the transaction has been marked for rollback.
exception
- the exception that was thrown.event
- if the exception was thrown from an event-handler method, this argument
is equal to the event
argument passed to the event-handler method.aci
- if the exception was thrown from an event-handler method, this argument
is equal to the aci
argument passed to the event-handler method.void sbbRolledBack(RolledBackContext context)
This method is invoked with an active transaction context that is different to the transaction context that rolled back. If this new transaction context also rolls back, this method is not reinvoked for that rollback.
context
- the context of the rolled back transaction.