Class SessionOwnershipRecord

  • All Implemented Interfaces:
    com.opencloud.util.FastSerializable

    public final class SessionOwnershipRecord
    extends Object
    implements com.opencloud.util.FastSerializable

    A Session Owner Record represents data for a single session stored by the session ownership facility.

    A Session Ownership Record is immutable. A SessionOwnershipRecord.Builder is used to create a new Session Ownership Record. Calling the static method newBuilder() will create a builder with fields initialised with empty data and a sequence number of 0. Calling toBuilder() on an existing SessionOwnershipRecord instance will create a builder with fields initialised to match the original record but with the sequence number incremented by one.

    Session Ownership Records may contain attributes. Application and Resource Adaptor logic may use their own attribute names and values. Organisations should use the "reverse domain name notation" approach for naming their own attributes, to avoid clashing with other components that also use Session Ownership

    In order to avoid clashing with established attribute name and values used by both Rhino and various Resource Adaptors it is recommended to avoid using attribute names that begin with "com.metaswitch.rhino".

    Since:
    Rhino 2.6.1
    • Field Detail

      • ASSOCIATED_RECORD_ATTRIBUTE_NAME

        public static final String ASSOCIATED_RECORD_ATTRIBUTE_NAME

        This attribute is used to allow a one way linking of one session ownership record to another.

        Since:
        Rhino 2.6.2
        See Also:
        Constant Field Values
      • CLUSTER_VIEW_ID_ATTRIBUTE_NAME

        public static final String CLUSTER_VIEW_ID_ATTRIBUTE_NAME

        This attribute is used to store Rhino’s cluster view ID.

        Since:
        Rhino 2.6.2
        See Also:
        Constant Field Values
      • PARTITION_KEY_ATTRIBUTE_NAME

        public static final String PARTITION_KEY_ATTRIBUTE_NAME

        This attribute is used to store the partition key of the activity the session ownership record relates to (if any).

        Since:
        Rhino 3.0.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionOwnershipRecord

        public SessionOwnershipRecord​(DataInput stream)
                               throws IOException

        Constructor used for deserialising a Session Ownership Record from a stream.

        This method is provided only to fulfill the requirements FastSerializable contract and should not be used for general purpose. A SessionOwnershipRecord.Builder should be used to create new Session Ownership Records.

        Throws:
        IOException
    • Method Detail

      • newBuilder

        public static SessionOwnershipRecord.Builder newBuilder()

        Create a new Session Ownership Record builder with fields initialised with empty data and a sequence number of 0.

        Returns:
        a new builder.
        Since:
        Rhino 2.6.1
      • toStream

        public void toStream​(DataOutput stream)
                      throws IOException

        Serialise this Session Ownership Record to the specified data output stream.

        Specified by:
        toStream in interface com.opencloud.util.FastSerializable
        Throws:
        IOException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getPrimaryKey

        public String getPrimaryKey()

        Get the primary key of this Session Ownership Record.

        Returns:
        the primary key.
        Since:
        Rhino 2.6.1
      • getAdditionalKeys

        public Set<String> getAdditionalKeys()

        Get the additional keys of this Session Ownership Record.

        Returns:
        a set of the additional keys for this record. The returned set is immutable.
        Since:
        Rhino 2.6.1
      • getSequenceNumber

        public int getSequenceNumber()

        Get the sequence number of this Session Ownership Record.

        Returns:
        the sequence number.
        Since:
        Rhino 2.6.1
      • getOwnerUris

        @Deprecated
        public Set<String> getOwnerUris()
        Deprecated.
        use getOwnerURIs() instead.

        Get the URIs for the owner of this Session Ownership Record.

        Returns:
        the set of URIs for the owner of the session represented by this record. The returned set is immutable.
        Since:
        Rhino 2.6.1
      • getOwnerURIs

        public Set<String> getOwnerURIs()

        Get the URIs for the owner of this Session Ownership Record.

        Returns:
        the set of URIs for the owner of the session represented by this record. The returned set is immutable.
        Since:
        Rhino 2.6.2
      • getAttribute

        public String getAttribute​(String name)

        Get the value of the Session Ownership Record attribute with the specified name.

        Parameters:
        name - the attribute name.
        Returns:
        the attribute value, or null if there is no such attribute.
        Since:
        Rhino 2.6.1
      • getAttributesNames

        public Set<String> getAttributesNames()

        Get the set of names of the attributes stored with this Session Ownership Record.

        Returns:
        the set of attribute names. The returned set is immutable.
        Since:
        Rhino 2.6.1
      • getAttributes

        public Map<String,​String> getAttributes()

        Get a map of attribute name to attribute value for all attributes stored with this Session Ownership Record.

        Returns:
        a map of attribute name to value. The returned map is immutable.
        Since:
        Rhino 2.6.1
      • toBuilder

        public SessionOwnershipRecord.Builder toBuilder()

        Create a new builder with values initialised to match this record, however with the sequence number incremented by one.

        Returns:
        the new builder.
        Since:
        Rhino 2.6.1