Class SubscriptionLink
- java.lang.Object
-
- com.caplin.management.jmx.relations.links.SubscriptionLink
-
- All Implemented Interfaces:
ComplexObjectNameLink
,ObjectNameLink
,java.io.Serializable
public class SubscriptionLink extends java.lang.Object implements ComplexObjectNameLink, java.io.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, thegetObjectName()
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SubscriptionLink(boolean linkFromSession, javax.management.ObjectName cachedObjectObjectName, javax.management.ObjectName sessionObjectName, javax.management.ObjectName helperObjectName, java.lang.String cachedObject, java.lang.String sessionId, java.lang.String subscriptionId, java.lang.String subscriptionName)
Constructs the SubscriptionLink with the specified arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
Compares this SubscriptionLink to another one.java.lang.String
getCachedObject()
Gets the name of the cached object this subscription is for.javax.management.ObjectName
getCachedObjectObjectName()
Gets the ObjectName of the cached object MBean this object links to.javax.management.ObjectName
getHelperObjectName()
Gets theObjectName
of the MBean that can be used to get additonal information about the relationship represented by this object.java.lang.String
getLinkName()
Gets a human readable name for the MBean that this instance of ObjectNameLink represents a link to.javax.management.ObjectName
getObjectName()
Gets theObjectName
of the MBean that this instance of ObjectNameLink represents a link to.java.lang.String
getSessionId()
Gets the unique identifier for the session this subscription has been made from.javax.management.ObjectName
getSessionObjectName()
Gets the ObjectName of the user session MBean this object links to.java.lang.String
getSubscriptionId()
Gets the unique identifier for the session this subscription has been made from.java.lang.String
getSubscriptionName()
Gets the name of the object subscribed to by the client.int
hashCode()
Returns a hash code value for the object.java.lang.String
toString()
Returns the human readable name of the linked MBean, as returned bygetLinkName()
.
-
-
-
Constructor Detail
-
SubscriptionLink
public SubscriptionLink(boolean linkFromSession, javax.management.ObjectName cachedObjectObjectName, javax.management.ObjectName sessionObjectName, javax.management.ObjectName helperObjectName, java.lang.String cachedObject, java.lang.String sessionId, java.lang.String subscriptionId, java.lang.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, otherwisefalse
.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:
java.lang.IllegalArgumentException
- If any of the arguments arenull
.
-
-
Method Detail
-
getObjectName
public javax.management.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 interfaceObjectNameLink
- Returns:
- The
ObjectName
of the linked object.
-
getLinkName
public java.lang.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 interfaceObjectNameLink
- Returns:
- A human readable name for the linked object.
-
getCachedObjectObjectName
public javax.management.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 javax.management.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 javax.management.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 interfaceComplexObjectNameLink
- Returns:
- The ObjectName of the MBean that
-
getCachedObject
public java.lang.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 java.lang.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 java.lang.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 java.lang.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(java.lang.Object object)
Compares this SubscriptionLink to another one.
- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- The object to be compared against.- Returns:
true
if the specified object is a SubscriptionLink and itsgetObjectName()
,getCachedObjectObjectName()
,getSessionObjectName()
,getHelperObjectName()
,getCachedObject()
,getSessionId()
,getSubscriptionId()
andgetSubscriptionName()
values are equals to those of this SubscriptionLink.
-
hashCode
public int hashCode()
Returns a hash code value for the object.
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code value for this object.
-
toString
public java.lang.String toString()
Returns the human readable name of the linked MBean, as returned by
getLinkName()
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The human readable name of the linked MBean.
-
-