public interface SbbPartContext extends SbbContext
The SbbPartContext
interface provides an SBB part object with access to SLEE-managed state that is dependent on the SBB part’s currently executing context.
An SBB part object may obtain a reference to an SbbPartContext
object by either a class constructor argument or dependency injection.
The SbbPartContext
object remains associated with the SBB part object for the lifetime of that SBB part object.
Note that the information that the SBB part object obtains from the SbbPartContext
object may change as the SLEE assigns the SBB part object to different SBB entities during the SBB part object’s lifecycle.
Modifier and Type | Method and Description |
---|---|
<T extends ActivityContextInterface> |
asSbbPartActivityContextInterface(ActivityContextInterface aci)
Narrow a generic Activity Context Interface object to an object that implements the SBB part’s Activity Context Interface.
|
void |
disableEntityTreePersistence()
Disable key/value store persistence for the SBB entity tree and related transactional state.
|
void |
enableEntityTreePersistence()
Enable key/value store persistence for the SBB entity tree and related transactional state.
|
RhinoActivityContextInterface[] |
getActivities()
Get the set of Activity Contexts that the SBB entity currently associated with the SBB part is currently attached to.
|
RhinoActivityContextInterface[] |
getActivities(Class<?> type)
Get the set of Activity Contexts that the SBB entity currently associated with the SBB part is currently attached to, where the type of the underlying activity object is assignable to the specified type.
|
CMPFields |
getCMPFields()
Get the CMP fields accessor object for this SBB part.
|
ConvergenceName |
getConvergenceName()
Get the convergence name that the SBB entity the SBB part is associated with was created for.
|
ConvergenceNameSessionOwnershipRecord |
getConvergenceNameSessionOwnershipRecord()
Obtain a Rhino-managed session ownership record for the SBB entity tree by either retrieving a pre-existing record or creating a new record if one does not already exist.
|
ConvergenceNameSessionOwnershipRecord |
getConvergenceNameSessionOwnershipRecord(long ttl)
Obtain a Rhino-managed session ownership record for the SBB entity tree by either retrieving a pre-existing record or creating a new record if one does not already exist.
|
Map<String,JndiBinding> |
getJndiBindings()
Get a map describing the JNDI bindings available to the SBB part.
|
com.opencloud.slee.SbbPartID |
getSbbPart()
Get the SBB part component identifier that identifies the SBB part component of the SBB part object.
|
Tracer |
getTracer(String tracerName) |
getEventMask, getRollbackOnly, getSbb, getSbbLocalObject, getService, maskEvent, setRollbackOnly
com.opencloud.slee.SbbPartID getSbbPart() throws SLEEException
Get the SBB part component identifier that identifies the SBB part component of the SBB part object.
This method is a non-transactional method.
SLEEException
- if the SBB part component identifier could not be obtained due to a system-level failure.<T extends ActivityContextInterface> T asSbbPartActivityContextInterface(ActivityContextInterface aci)
Narrow a generic Activity Context Interface object to an object that implements the SBB part’s Activity Context Interface.
This method returns the same object if the SBB part does not define an Activity Context Interface.
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 part object that has been assigned to an SBB entity.
If the SBB part object is not assigned to an SBB entity, a java.lang.IllegalStateException
is thrown.
T
- a type extending the generic javax.slee.ActivityContextInterface
type.aci
- an Activity Context Interface object.aci
method argument if the SBB part does not define an Activity Context Interface.TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not associated with an SBB entity.SLEEException
- if the Activity Context Interface object could not be obtained due to a system-level failure.ConvergenceName getConvergenceName() throws TransactionRolledbackLocalException, IllegalStateException, SLEEException
Get the convergence name that the SBB entity the SBB part is associated with was created for. This method only returns a non-null value if the SBB entity is the root SBB of an SBB entity tree.
This method is a mandatory transactional method. The SBB part object must have an associated SBB entity when it invokes this method.
null
if this SBB part is no associated with a root SBB entity.TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not associated with an SBB entity.SLEEException
- if the convergence name could not be obtained due to a system-level failure.TransactionRolledbackLocalException
RhinoActivityContextInterface[] getActivities() throws TransactionRequiredLocalException, IllegalStateException, SLEEException
Get the set of Activity Contexts that the SBB entity currently associated with the SBB part is currently attached to.
The returned array contains generic Activity Context Interface objects that can be converted to the SBB part’s own activity context interface type using the asSbbPartActivityContextInterface(ActivityContextInterface)
method.
This method is a mandatory transactional method. The SBB part object must have an associated SBB entity when it invokes this method.
getActivities
in interface SbbContext
TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not associated with an SBB entity.SLEEException
- if the set of attached Activity Contexts could not be obtained due to a system-level failure.Tracer getTracer(String tracerName) throws NullPointerException, IllegalArgumentException, SLEEException
getTracer
in interface SbbContext
NullPointerException
IllegalArgumentException
SLEEException
RhinoActivityContextInterface[] getActivities(Class<?> type) throws NullPointerException, TransactionRequiredLocalException, IllegalStateException, SLEEException
Get the set of Activity Contexts that the SBB entity currently associated with the SBB part is currently attached to, where the type of the underlying activity object is assignable to the specified type.
The returned array contains generic Activity Context Interface objects that can be converted to the SBB part’s own activity context interface type using the asSbbPartActivityContextInterface(ActivityContextInterface)
method.
This method is a mandatory transactional method. The SBB part object must have an associated SBB entity when it invokes this method.
type
- the type of activity object to return Activity Contexts for.
If this parameter is null
, this method behaves the same as getActivities()
.type
.TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not associated with an SBB entity.SLEEException
- if the set of attached Activity Contexts could not be obtained due to a system-level failure.NullPointerException
CMPFields getCMPFields() throws SLEEException
Get the CMP fields accessor object for this SBB part.
The object returned from this method implements all CMP interfaces defined by the SBB part, so may be typecast to any of these interfaces as required regardless of whether or not such interface extends from CMPFields.
This method runs in an unspecified transaction context, however the CMP state contained within the object can only be accessed or manipulated in contexts where CMP state is normally accessible.
SLEEException
- if the CMP fields could not be obtained due to a system-level failure.Map<String,JndiBinding> getJndiBindings() throws SLEEException
Get a map describing the JNDI bindings available to the SBB part. The map is keyed on the fully-qualified name of each binding.
This method is a non-transactional method.
SLEEException
- if the JNDI bindings could not be obtained due to a system-level failure.void enableEntityTreePersistence() throws TransactionRequiredLocalException, IllegalStateException, SLEEException
Enable key/value store persistence for the SBB entity tree and related transactional state.
This method is only useful if initial persistence of state has been disabled in the extension service deployment descriptor
or via the com.opencloud.rhino.management.service.ServiceManagementMBean#setInitialPersistence
management operation.
This method has no effect if entity tree persistence is or has already been enabled.
It is not valid to invoke this method if persistence has been permanently disabled
.
This method is a mandatory transactional method. The SBB part object must have an associated SBB entity when it invokes this method.
TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not assigned to an SBB entity, or persistence has previously been permanently disabled.SLEEException
- if entity tree persistence could not be enabled due to a system-level failure.void disableEntityTreePersistence() throws TransactionRequiredLocalException, IllegalStateException, SLEEException
Disable key/value store persistence for the SBB entity tree and related transactional state.
This method invokes a permanent, irrevocable request that any state maintained for the SBB entity tree and any state related to it, for example state for activities that the SBB entity interacts with, should never be persisted to the key/value store.
This is a different state of being to that of an SBB entity tree whose initial persistence has been disabled, as state for such an SBB entity may be persisted at some point in the future if persistence is subsequently enabled
or a state-buffering timeout is exceeded in the key/value store.
State for an SBB entity tree whose persistence is permanently disabled using this method will never be persisted.
Typically, this method would be invoked by an SBB entity whose initial persistence has been disabled and early on in the SBB entity’s session processing lifecycle in order to avoid the possibility that some state may end up persisted. However, it’s possible to invoke this method at any point in an SBB entity’s lifecycle to suppress persistence of any state not yet persisted. Already persisted state may remain in the key/value store, but not further updated, until the local state is removed.
TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if the SBB part object invoking this method is not assigned to an SBB entity.SLEEException
- if entity tree persistence could not be disabled due to a system-level failure.ConvergenceNameSessionOwnershipRecord getConvergenceNameSessionOwnershipRecord() throws TransactionRequiredLocalException, IllegalStateException, SLEEException
Obtain a Rhino-managed session ownership record for the SBB entity tree by either retrieving a pre-existing record or creating a new record if one does not already exist.
This method is equivalent to, and has the same behaviour and contract as, getConvergenceNameSessionOwnershipRecord(0)
.
TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if session ownership functionality isn’t available in the namespace the SBB part is deployed in.SLEEException
- if the session ownership record could not be retrieved due to a system-level failure.ConvergenceNameSessionOwnershipRecord getConvergenceNameSessionOwnershipRecord(long ttl) throws TransactionRequiredLocalException, IllegalStateException, SLEEException
Obtain a Rhino-managed session ownership record for the SBB entity tree by either retrieving a pre-existing record or creating a new record if one does not already exist.
The primary key of this session ownership record is allocated by Rhino and is based on the convergence name of the SBB entity tree. The record will be automatically removed by Rhino when the SBB entity tree is removed.
The ttl
parameter is used in two ways:
if the session ownership record does not already exist, it is created with the specified ttl
if it is a positive number, else the default TTL of the session ownership store is used instead
if the session ownership record does exist and ttl
is a positive number and different to the current TTL of the record, the record is updated with the new TTL.
This method is a mandatory transactional method.
ttl
- the record’s time-to-live, measured in milliseconds.
Any non-positive value means that the default TTL of the session ownership store should be used instead.TransactionRequiredLocalException
- if this method is invoked without a valid transaction context.IllegalStateException
- if session ownership functionality isn’t available in the namespace the SBB part is deployed in.SLEEException
- if the session ownership record could not be retrieved due to a system-level failure.