public interface RhinoSbbContext extends SbbContext
All SbbContext
objects that Rhino provides to an SBB will implement this
extension interface, therefore a typecast to this interface will always succeed.
Modifier and Type | Method and Description |
---|---|
RhinoActivityContextInterface[] |
getActivities() |
RhinoActivityContextInterface[] |
getActivities(Class<?> type)
Get the set of Activity Contexts that the SBB entity currently associated with the
instance is currently attached to, where the type of the underlying activity object
is assignable to the specified type.
|
ChildRelationFacility |
getChildRelationFacility()
Get the Child Relation Facility for this SBB.
|
CMPFields |
getCMPFields()
Get the CMP fields accessor object for this SBB.
|
ConvergenceName |
getConvergenceName()
Get the convergence name that this SBB was created for.
|
Map<String,JndiBinding> |
getJndiBindings()
Get a map describing the JNDI bindings available to the SBB.
|
<T> T |
getServiceContext()
Get the service context object.
|
Tracer |
getTracer(String tracerName) |
<T> void |
setEncodableContext(T context)
Set the encodable context object.
|
<T> void |
setServiceContext(T context)
Set the service context object.
|
getEventMask, getRollbackOnly, getSbb, getSbbLocalObject, getService, maskEvent, setRollbackOnly
ConvergenceName getConvergenceName() throws TransactionRolledbackLocalException, IllegalStateException, SLEEException
This method is a mandatory transactional method. The SBB object must have an assigned
SBB entity when it invokes this method. The only transactional method where an SBB object
is not assigned to an SBB entity is sbbCreate()
.
null
if this SBB entity is not a root SBB entity.TransactionRequiredLocalException
- if this method is invoked without a valid
transaction context.IllegalStateException
- if the SBB object invoking this method is not assigned
to an SBB entity.SLEEException
- if the convergence name could not be obtained due to a system-level
failure.TransactionRolledbackLocalException
Tracer getTracer(String tracerName) throws NullPointerException, IllegalArgumentException, SLEEException
getTracer
in interface SbbContext
NullPointerException
IllegalArgumentException
SLEEException
RhinoActivityContextInterface[] getActivities() throws TransactionRequiredLocalException, IllegalStateException, SLEEException
getActivities
in interface SbbContext
TransactionRequiredLocalException
IllegalStateException
SLEEException
RhinoActivityContextInterface[] getActivities(Class<?> type) throws NullPointerException, TransactionRequiredLocalException, IllegalStateException, SLEEException
asSbbActivityContextInterface
method.
This method is a mandatory transactional method. The SBB object must have an assigned
SBB entity when it invokes this method. The only transactional method where an SBB
object is not assigned to an SBB entity is sbbCreate()
.
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 object invoking this method is not assigned
to an SBB entity.SLEEException
- if the set of attached Activity Contexts could not be obtained
due to a system-level failure.NullPointerException
ChildRelationFacility getChildRelationFacility() throws SLEEException
This method is a non-transactional method.
SLEEException
- if the Child Relation Facility could not be obtained due to a system-level
failure.CMPFields getCMPFields() throws SLEEException
The object returned from this method provides access to all SBB CMP fields whether defined in the SBB abstract class or a CMP extension interface. The returned object implements all CMP extension interfaces declared by the SBB, 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
This method is a non-transactional method.
SLEEException
- if the JNDI bindings could not be obtained due to a system-level failure.<T> void setServiceContext(T context) throws SLEEException
The service context provides an alternative storage facility to using static class fields for arbitrary, typically constant, data that the SBB wants to share between SBB objects in the same service. The use of static class fields to store shared data becomes problematic when the encapsulating class resides in a library component jar rather than an SBB jar - the static fields end up being shared between all uses of that library, rather than being scoped to a single service. The service context provides similar functionality to that of a static class field, but it is guaranteed to have visibility only within the service.
A typical use of the service context is to store data calculated by the SBB during the
serviceActivating
lifecycle callback method.
The service context object is stored by reference, and is never serialised. As the service context
object may be accessed concurrently by different SBB objects, care must be taken that the service
context object provides thread-safe access. A service context object will persist across service
deactivation and reactivation cycles unless the SBB explicitly resets the service context to
null
at the appropriate time.
The service context is scoped to a single SBB type within the service, ie. different SBB types within the same service may each store their own service context object without conflict.
This method is a non-transactional method.
T
- the type of the context object.context
- the context object.SLEEException
- if the service context could not be set due to a system-level failure.<T> T getServiceContext() throws SLEEException
Refer setServiceContext
for a description of the service context.
This method is a non-transactional method.
T
- the type of the context object.null
if the context has not been set to a non-null value.SLEEException
- if the service context could not be retrieved due to a system-level failure.<T> void setEncodableContext(T context) throws SLEEException
Encodable
or providing a DatatypeCodec
via EncoderUtils
and
DecoderUtils
when serialised to or deserialised from CMP or extension CMP fields of
this SBB.
The encodable context is scoped to an SBB object. Typically the encodable context would be
initialised during Sbb.setSbbContext
like other similarly
scoped values.
This method is a non-transactional method.
T
- the type of the context object.context
- the context object.SLEEException
- if the encodable context could not be set due to a system-level failure.