Class SubscriptionLink

java.lang.Object
com.caplin.management.jmx.relations.links.SubscriptionLink
All Implemented Interfaces:
ComplexObjectNameLink, ObjectNameLink, Serializable

public class SubscriptionLink extends Object implements ComplexObjectNameLink, Serializable

Represents a user subscription within the Liberator. A user subscription is a relationship between a particular user session and the cached object that the client has subscribed to.

If this object is obtained from a user session MBean, the getObjectName() method will return the ObjectName of the cached object this subscription represents. If this object is obtainined from a cached object MBean, the getObjectName() method will return the ObjectName of the user session.

In addition to information about the user session and the cached object, this object also provides the method, getSubscriptionId(), which returns the subscription identifier, which is unique within a particular user session, and a method, getSubscriptionName(), which returns the name of the object that the client actually subscribed to.

The user session identifier and subscription identifier together uniquely indentify a particular subscription. Neither the subscription name, nor cached object name, can be used to uniquely identify a subscription since it is possible for a client to register multiple subscriptions for the same object.

Subscription data examples:

Session Id Subscription Id Subscription Name Cached Object Name
1FEDCB 0001 /DEMO/MSFT /DEMO/MSFT
1FEDCB 0002 /DEMO/CSCO /DEMO/CSCO
098765 0001 /DEMO/MSFT /DELAYED/DEMO/MSFT
098765 0003 /DEMO/MSFT /DELAYED/DEMO/MSFT

Further information about a specific subscription, such as its current throttle level and update count, can be obtained by invoking operations on the helper MBean which can be obtained via the ObjectName returned by getHelperObjectName().

See Also:
  • Constructor Details

    • SubscriptionLink

      public SubscriptionLink(boolean linkFromSession, ObjectName cachedObjectObjectName, ObjectName sessionObjectName, ObjectName helperObjectName, String cachedObject, String sessionId, String subscriptionId, String subscriptionName)

      Constructs the SubscriptionLink with the specified arguments.

      Parameters:
      linkFromSession - true if this SubscriptionLink represents a link from a session to a cached object, otherwise false.
      cachedObjectObjectName - The ObjectName of the cached object MBean this object links to.
      sessionObjectName - The ObjectName of the user session MBean this object links to.
      helperObjectName - The ObjectName of the helper MBean that should be used to obtain more information about the relationship this object represents.
      cachedObject - The name of the cached object this subscription is for.
      sessionId - The unique identifier for the session this subscription has been made from.
      subscriptionId - The unique identifier for the session this subscription has been made from.
      subscriptionName - The name of the object subscribed to by the client.
      Throws:
      IllegalArgumentException - If any of the arguments are null.
  • Method Details

    • getObjectName

      public ObjectName getObjectName()
      Description copied from interface: ObjectNameLink

      Gets the ObjectName of the MBean that this instance of ObjectNameLink represents a link to.

      Specified by:
      getObjectName in interface ObjectNameLink
      Returns:
      The ObjectName of the linked object.
    • getLinkName

      public String getLinkName()
      Description copied from interface: ObjectNameLink

      Gets a human readable name for the MBean that this instance of ObjectNameLink represents a link to.

      Specified by:
      getLinkName in interface ObjectNameLink
      Returns:
      A human readable name for the linked object.
    • getCachedObjectObjectName

      public ObjectName getCachedObjectObjectName()

      Gets the ObjectName of the cached object MBean this object links to.

      Returns:
      The ObjectName of the cached object MBean this object links to.
    • getSessionObjectName

      public ObjectName getSessionObjectName()

      Gets the ObjectName of the user session MBean this object links to.

      Returns:
      The ObjectName of the user session MBean this object links to.
    • getHelperObjectName

      public ObjectName getHelperObjectName()
      Description copied from interface: ComplexObjectNameLink

      Gets the ObjectName of the MBean that can be used to get additonal information about the relationship represented by this object.

      Specified by:
      getHelperObjectName in interface ComplexObjectNameLink
      Returns:
      The ObjectName of the MBean that
    • getCachedObject

      public String getCachedObject()

      Gets the name of the cached object this subscription is for.

      Returns:
      The name of the cached object this subscription is for.
    • getSessionId

      public String getSessionId()

      Gets the unique identifier for the session this subscription has been made from.

      Returns:
      The unique identifier for the session this subscription has been made from.
    • getSubscriptionId

      public String getSubscriptionId()

      Gets the unique identifier for the session this subscription has been made from.

      Returns:
      The unique identifier for the session this subscription has been made from.
    • getSubscriptionName

      public String getSubscriptionName()

      Gets the name of the object subscribed to by the client. Typically, this would be identical to the cached object name, however an advanced feature within the Liberator allows the object requested by the client to be mapped onto a different object name (e.g. /DEMO/MSFT may be mapped onto /DELAYED/DEMO/MSFT).

      Returns:
      The name of the object subscribed to by the client.
    • equals

      public boolean equals(Object object)

      Compares this SubscriptionLink to another one.

      Overrides:
      equals in class Object
      Parameters:
      object - The object to be compared against.
      Returns:
      true if the specified object is a SubscriptionLink and its getObjectName(), getCachedObjectObjectName(), getSessionObjectName(), getHelperObjectName(), getCachedObject(), getSessionId(), getSubscriptionId() and getSubscriptionName() values are equals to those of this SubscriptionLink.
    • hashCode

      public int hashCode()

      Returns a hash code value for the object.

      Overrides:
      hashCode in class Object
      Returns:
      A hash code value for this object.
    • toString

      public String toString()

      Returns the human readable name of the linked MBean, as returned by getLinkName().

      Overrides:
      toString in class Object
      Returns:
      The human readable name of the linked MBean.