Interface SbbPartContext

  • All Superinterfaces:
    SbbContext

    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.

    Since:
    Rhino 2.4.0
    • Method Detail

      • getSbbPart

        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.

        Returns:
        the SBB part component identifier.
        Throws:
        SLEEException - if the SBB part component identifier could not be obtained due to a system-level failure.
        Since:
        Rhino 2.4.0
      • asSbbPartActivityContextInterface

        <T> 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.

        Type Parameters:
        T - a type extending the generic javax.slee.ActivityContextInterface type.
        Parameters:
        aci - an Activity Context Interface object.
        Returns:
        an object implementing the SBB part’s Activity Context Interface, or the aci method argument if the SBB part does not define an Activity Context Interface.
        Throws:
        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.
        Since:
        Rhino 2.4.0
      • getActivities

        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.

        Parameters:
        type - the type of activity object to return Activity Contexts for. If this parameter is null, this method behaves the same as getActivities().
        Returns:
        an array of generic Activity Context Interface objects that represent the Activity Contexts the associated SBB entity is attached to where the activity object is assignable to type.
        Throws:
        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
        Since:
        Rhino 2.4.0
      • getCMPFields

        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.

        Returns:
        a CMP fields accessor object for the SBB part.
        Throws:
        SLEEException - if the CMP fields could not be obtained due to a system-level failure.
        Since:
        Rhino 2.4.0
      • getJndiBindings

        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.

        Returns:
        a map of JNDI bindings. The returned map is immutable.
        Throws:
        SLEEException - if the JNDI bindings could not be obtained due to a system-level failure.
        Since:
        Rhino 2.4.0
      • enableEntityTreePersistence

        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.

        Throws:
        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.
        Since:
        Rhino 2.6.1
      • disableEntityTreePersistence

        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.

        Throws:
        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.
      • getConvergenceNameSessionOwnershipRecord

        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.

        Parameters:
        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.
        Returns:
        the convergence name session ownership record for the SBB entity tree.
        Throws:
        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.
        Since:
        Rhino 2.6.2
      • getPartitionKey

        int getPartitionKey()

        Get the partition key for the SBB entity tree.

        The partition key is a session-related hash that can be used by a key/value store, for example, to aggregate related state.

        The partition key of an SBB entity tree is determined from the activity handle of the activity whose event caused the creation of the SBB entity tree.

        Returns:
        the partition key.
        Since:
        Rhino 3.0.0