javax.slee.usage
Class UsageNotification

java.lang.Object
  extended by java.util.EventObject
      extended by javax.management.Notification
          extended by javax.slee.usage.UsageNotification
All Implemented Interfaces:
java.io.Serializable, VendorExtensions

public final class UsageNotification
extends javax.management.Notification
implements VendorExtensions

Notifications of this type are emitted by a UsageMBean to indicate a counter-type usage parameter has been updated or a sample-type usage parameter has accumulated a new sample. Usage notifications are only generated for usage parameters for which the generation of usage notifications has been enabled. Control of notification generation is managed via a UsageNotificationManagerMBean object.

Usage notifications contain a NotificationSource object that can be used to obtain more information about the object that caused the usage notification to be generated. The type of a usage notification can be used to infer the type of the notification source object in the notification:

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.management.Notification
source
 
Constructor Summary
UsageNotification(SbbUsageMBean sbbUsageMBean, ServiceID serviceID, SbbID sbbID, java.lang.String paramSet, java.lang.String paramName, boolean counter, long value, long sequenceNumber, long timestamp)
          Deprecated. Usage notifications have been expanded with new attributes to take advantage of the new features provided by the SLEE specification. The UsageNotification(String, UsageMBean, NotificationSource, String, String, boolean, long, long, long) constructor should be used instead of this constructor.
UsageNotification(java.lang.String type, UsageMBean usageMBean, NotificationSource notificationSource, java.lang.String paramSet, java.lang.String paramName, boolean counter, long value, long sequenceNumber, long timestamp)
          Create a UsageNotification to notify listeners of an update to a usage parameter's value.
 
Method Summary
static void disableVendorDataDeserialization()
          Disable the deserialization of vendor-specific data for objects of this class.
static void disableVendorDataSerialization()
          Disable the serialization of vendor-specific data for objects of this class.
static void enableVendorDataDeserialization()
          Enable the deserialization of vendor-specific data for objects of this class.
static void enableVendorDataSerialization()
          Enable the serialization of vendor-specific data for objects of this class.
 boolean equals(java.lang.Object obj)
          Compare this notification for equality with another object.
 NotificationSource getNotificationSource()
          Get the object that identifies the component or subsystem in the SLEE that caused this usage notification to be generated.
 SbbID getSbb()
          Deprecated. Replaced with getNotificationSource() in order to specify a broader range of usage sources.
 ServiceID getService()
          Deprecated. Replaced with getNotificationSource() in order to specify a broader range of usage sources.
 java.lang.String getUsageParameterName()
          Get the name of the usage parameter that was updated.
 java.lang.String getUsageParameterSetName()
          Get the name of the usage parameter set containing the usage parameter thas was updated.
 long getValue()
          Get the updated value or emitted sample of the usage parameter.
 java.lang.Object getVendorData()
          Get the vendor-specific data.
 int hashCode()
          Get a hash code value for this notification.
 boolean isCounter()
          Determine if the usage parameter updated is counter-type or sample-type.
 void setVendorData(java.lang.Object vendorData)
          Set the vendor-specific data.
 java.lang.String toString()
          Get a string representation for this notification.
 
Methods inherited from class javax.management.Notification
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UsageNotification

public UsageNotification(SbbUsageMBean sbbUsageMBean,
                         ServiceID serviceID,
                         SbbID sbbID,
                         java.lang.String paramSet,
                         java.lang.String paramName,
                         boolean counter,
                         long value,
                         long sequenceNumber,
                         long timestamp)
                  throws java.lang.NullPointerException
Deprecated. Usage notifications have been expanded with new attributes to take advantage of the new features provided by the SLEE specification. The UsageNotification(String, UsageMBean, NotificationSource, String, String, boolean, long, long, long) constructor should be used instead of this constructor.

Create a UsageNotification containing the updated value of an SBB's usage parameter. The notification's notificationSource attribute is set to an SbbNotification encapsulating the serviceID and sbbID arguments.

Parameters:
sbbUsageMBean - the SbbUsageMBean object that is emitting this notification.
serviceID - the component identifier of the Service whose SBB's usage parameter was updated.
sbbID - the component identifier of the SBB whose usage parameter was updated.
paramSet - the name of the SBB usage parameter set containing the usage parameter that was updated. If the unamed usage parameter set was updated, this value is null.
paramName - the name of the usage parameter that was updated.
value - this is either the new value of the usage parameter (for counter-type usage parameters), or a sample value (for sample-type usage parameters).
sequenceNumber - the notification sequence number within the source SbbUsageMBean.
timestamp - the time (in ms since January 1, 1970 UTC) that the notification was generated.
Throws:
java.lang.NullPointerException - if notificationSource, serviceID, sbbID or paramName is null.

UsageNotification

public UsageNotification(java.lang.String type,
                         UsageMBean usageMBean,
                         NotificationSource notificationSource,
                         java.lang.String paramSet,
                         java.lang.String paramName,
                         boolean counter,
                         long value,
                         long sequenceNumber,
                         long timestamp)
                  throws java.lang.NullPointerException
Create a UsageNotification to notify listeners of an update to a usage parameter's value.

Parameters:
type - the JMX type of the notification. The type of the notification is typically obtained from the NotificationSource parameter when this notification object is created, and can be used by notification listeners to infer the type of the NotificationSource, and hence obtain further information about the source of the notification.
usageMBean - the UsageMBean object that is emitting this notification.
notificationSource - the component or subsystem in the SLEE that caused this notification to be generated.
paramSet - the name of the usage parameter set containing the usage parameter that was updated. If the unamed usage parameter set was updated, this value is null.
paramName - the name of the usage parameter that was updated.
value - this is either the new value of the usage parameter (for counter-type usage parameters), or a sample value (for sample-type usage parameters).
sequenceNumber - the notification sequence number within the source UsageMBean.
timestamp - the time (in ms since January 1, 1970 UTC) that the notification was generated.
Throws:
java.lang.NullPointerException - if type, usageMBean, notificationSource, or paramName is null.
Since:
SLEE 1.1
Method Detail

getNotificationSource

public NotificationSource getNotificationSource()
Get the object that identifies the component or subsystem in the SLEE that caused this usage notification to be generated.

Returns:
the notification source. For SLEE 1.0 usage notifications the type of the notification source will always be SbbNotification.
Since:
SLEE 1.1

getService

public ServiceID getService()
Deprecated. Replaced with getNotificationSource() in order to specify a broader range of usage sources.

Get the component identifier of the Service whose SBB's usage parameter was updated.

Returns:
the component identifier of the Service whose SBB's usage parameter was updated. Returns null for SLEE 1.1-compliant notifications unless the notification source is of type SbbNotification, in which case the value of SbbNotification.getService() is returned.

getSbb

public SbbID getSbb()
Deprecated. Replaced with getNotificationSource() in order to specify a broader range of usage sources.

Get the component identifier of the SBB whose usage parameter was updated.

Returns:
the component identifier of the SBB whose usage parameter was updated. Returns null for SLEE 1.1-compliant notifications unless the notification source is of type SbbNotification, in which case the value of SbbNotification.getSbb() is returned.

getUsageParameterSetName

public java.lang.String getUsageParameterSetName()
Get the name of the usage parameter set containing the usage parameter thas was updated.

Returns:
the name of the usage parameter set, or null if the usage parameter was a member of the unnamed usage parameter set.

getUsageParameterName

public java.lang.String getUsageParameterName()
Get the name of the usage parameter that was updated.

Returns:
the name of the usage parameter that was updated.

isCounter

public boolean isCounter()
Determine if the usage parameter updated is counter-type or sample-type.

Returns:
true if the usage parameter updated is counter-type, false if the usage parameter updated is sample-type.

getValue

public long getValue()
Get the updated value or emitted sample of the usage parameter. If isCounter() returns true this value is the updated value of the counter-type usage parameter. If isCounter() returns false this value is a sample value for the usage parameter.

Returns:
the updated value or emitted sample of the usage parameter.

enableVendorDataSerialization

public static void enableVendorDataSerialization()
Enable the serialization of vendor-specific data for objects of this class. This method is typically used by a SLEE implementation that wants to export vendor-specific data with objects of this class to management clients.

By default, any vendor-specific data included in an object of this class will not be included in the serialization stream when the object is serialized. Invoking this method changes this behavior so that vendor-specific data is included in the serialization stream when an object of this class is serialized.

This method should only be invoked if the vendor-specific data is serializable via standard Java serialization means.

Since:
SLEE 1.1
See Also:
disableVendorDataSerialization(), setVendorData(java.lang.Object)

disableVendorDataSerialization

public static void disableVendorDataSerialization()
Disable the serialization of vendor-specific data for objects of this class.

If the serialization of vendor-specific data for objects of this class has been enabled via the enableVendorDataSerialization() method, this method disables that behavior again.

Since:
SLEE 1.1

enableVendorDataDeserialization

public static void enableVendorDataDeserialization()
Enable the deserialization of vendor-specific data for objects of this class. This method is typically used by a management client that wants to obtain any vendor-specific data included in the serialization stream of objects of this class.

By default, any vendor-specific data included in the serialization stream of objects of this class is discarded upon deserialization. Invoking this method changes that behavior so that the vendor-specific data is also deserialized when an object of this class is deserialized. A management client that enables the deserialization of vendor-specific data must ensure that any necessary classes required to deserialize that data is available in the relevant classloader.

Since:
SLEE 1.1
See Also:
disableVendorDataDeserialization(), getVendorData()

disableVendorDataDeserialization

public static void disableVendorDataDeserialization()
Disable the deserialization of vendor-specific data for objects of this class.

If the deserialization of vendor-specific data for objects of this class has been enabled via the enableVendorDataDeserialization() method, this method disables that behavior again.

Since:
SLEE 1.1

setVendorData

public void setVendorData(java.lang.Object vendorData)
Set the vendor-specific data.

Specified by:
setVendorData in interface VendorExtensions
Parameters:
vendorData - the vendor-specific data.
Since:
SLEE 1.1

getVendorData

public java.lang.Object getVendorData()
Get the vendor-specific data.

Specified by:
getVendorData in interface VendorExtensions
Returns:
the vendor-specific data.
Since:
SLEE 1.1

equals

public boolean equals(java.lang.Object obj)
Compare this notification for equality with another object.

For backwards compatibility, this method performs either a SLEE 1.0-based comparison or a SLEE 1.1-based comparison based on the state of this notification object. If this notification contains a non-null service component identifier reference, a SLEE 1.0-based comparison is performed. Otherwise, a SLEE 1.1-based comparison is performed.

The SLEE 1.0-based comparison considers two notifications to be equal if obj is an instance of this class and the service and SBB component identifiers, parameter set name, parameter name, and parameter type (counter or sample) are the same as the corresponding attributes of this.

The SLEE 1.1-based comparison considers two notifications to be equal if obj if an instance of this class and the notification source, parameter set name, parameter name, and parameter type (counter or sample) are the same as the corresponding attributes of this.

Note that a SLEE 1.0-compliant usage notification can never be equal to a SLEE 1.1-compliant usage notification.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is equal to this according to the rules specified above, false otherwise.

hashCode

public int hashCode()
Get a hash code value for this notification. The hash code is the logical XOR of the hash codes of the usage parameter set name (if any) and the usage parameter name.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this notification.

toString

public java.lang.String toString()
Get a string representation for this notification.

Overrides:
toString in class javax.management.Notification
Returns:
a string representation for this notification.


Copyright © 2009. All Rights Reserved.