javax.slee.management
Class AlarmNotification

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

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

Notifications of this type are emitted by an AlarmMBean to indicate that some component or subsystem in the SLEE is experiencing a problem. Typically, a SLEE component uses the AlarmFacility to manage alarms.

Alarm notifications contain a NotificationSource object that can be used to obtain more information about the object that raised the alarm. The type of an alarm notification can be used to infer the type of the notification source object contained in the notification:

As of SLEE 1.1, serialization of this class has been modified to take into account cause Throwable objects that may not be deserializable client-side due to classloader issues. For example, if the cause of an alarm is an object of a custom exception class included in the deployable unit of a component, a generic client may not have that class available in its classpath or be able to load it via Java's remote class loading mechanisms (eg. the codebase URL could be a file:// URL on a different host that cannot be resolved on the client host). Serialization of an AlarmNotification object containing a cause now includes the stack trace of that cause in the serialization stream. If the cause Throwable cannot be later deserialized with the AlarmNotification object, a generic java.lang.Exception with a message containing the original stack trace is returned as the alarm's cause instead.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.management.Notification
source
 
Constructor Summary
AlarmNotification(AlarmMBean alarmMBean, java.lang.String alarmType, java.lang.Object alarmSource, Level alarmLevel, java.lang.String message, java.lang.Throwable cause, long sequenceNumber, long timestamp)
          Deprecated. Alarm notifications have been expanded with new attributes to take advantage of the new features provided by the SLEE specification. The AlarmNotification(String,AlarmMBean,String,NotificationSource,String,String,AlarmLevel,String,Throwable,long,long) constructor should be used instead of this constructor.
AlarmNotification(java.lang.String type, AlarmMBean alarmMBean, java.lang.String alarmID, NotificationSource notificationSource, java.lang.String alarmType, java.lang.String instanceID, AlarmLevel alarmLevel, java.lang.String message, java.lang.Throwable cause, long sequenceNumber, long timestamp)
          Create an AlarmNotification to notify listeners of an alarm.
 
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.
 java.lang.String getAlarmID()
          Get the unique alarm identifier of the alarm.
 AlarmLevel getAlarmLevel()
          Get the alarm level of the alarm notification.
 java.lang.Object getAlarmSource()
          Deprecated. Replaced with getNotificationSource().
 java.lang.String getAlarmType()
          Get the type of the alarm.
 java.lang.Throwable getCause()
          Get the cause for the alarm.
 java.lang.String getInstanceID()
          Get the instance identifier of the alarm type.
 Level getLevel()
          Deprecated. Trace and alarm levels have been split into different classes. Replaced with getAlarmLevel().
 NotificationSource getNotificationSource()
          Get the object that identifies the component or subsystem in the SLEE that raised the alarm.
 java.lang.Object getVendorData()
          Get the vendor-specific data.
 int hashCode()
          Get a hash code value for this notification.
 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

AlarmNotification

public AlarmNotification(AlarmMBean alarmMBean,
                         java.lang.String alarmType,
                         java.lang.Object alarmSource,
                         Level alarmLevel,
                         java.lang.String message,
                         java.lang.Throwable cause,
                         long sequenceNumber,
                         long timestamp)
                  throws java.lang.NullPointerException,
                         java.lang.IllegalArgumentException
Deprecated. Alarm notifications have been expanded with new attributes to take advantage of the new features provided by the SLEE specification. The AlarmNotification(String,AlarmMBean,String,NotificationSource,String,String,AlarmLevel,String,Throwable,long,long) constructor should be used instead of this constructor.

Create an AlarmNotification to notify listeners of a alarm.

Parameters:
alarmMBean - the AlarmMBean object that is emitting this notification.
alarmType - the type of the alarm being generated. Typically a management client should be able to infer the type of the alarmSource object by inspecting this type.
alarmSource - an object that identifies the object that generated the alarm, for example an SbbID.
alarmLevel - the alarm level.
message - the alarm message.
cause - an optional cause for the alarm.
sequenceNumber - the notification sequence number within the source AlarmMBean object.
timestamp - the time (in ms since January 1, 1970 UTC) that the alarm was generated.
Throws:
java.lang.NullPointerException - if notificationSource, alarmType, alarmLevel, or message is null.
java.lang.IllegalArgumentException - if alarmLevel == Level.OFF.

AlarmNotification

public AlarmNotification(java.lang.String type,
                         AlarmMBean alarmMBean,
                         java.lang.String alarmID,
                         NotificationSource notificationSource,
                         java.lang.String alarmType,
                         java.lang.String instanceID,
                         AlarmLevel alarmLevel,
                         java.lang.String message,
                         java.lang.Throwable cause,
                         long sequenceNumber,
                         long timestamp)
                  throws java.lang.NullPointerException
Create an AlarmNotification to notify listeners of an alarm.

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.
alarmMBean - the AlarmMBean object that is emitting this notification.
alarmID - the unique alarm identifier for the alarm.
notificationSource - the component or subsystem in the SLEE that raised the alarm.
alarmType - an identifier specifying the type of the alarm.
instanceID - an identifier specifying the particular instance of the alarm type that is occurring.
alarmLevel - the alarm level of the notification. This could be AlarmLevel.CLEAR if the alarm has been cleared.
message - the alarm message.
cause - an optional cause for the alarm notification.
sequenceNumber - the notification sequence number within the source AlarmMBean object.
timestamp - the time (in ms since January 1, 1970 UTC) that the alarm was raised, updated, or cleared.
Throws:
java.lang.NullPointerException - if type, alarmMBean, alarmID, notificationSource, alarmType, instanceID, alarmLevel, or message is null.
Since:
SLEE 1.1
Method Detail

getAlarmID

public java.lang.String getAlarmID()
Get the unique alarm identifier of the alarm.

Returns:
the alarm identifier of the alarm. Returns null for SLEE 1.0-compliant notifications.
Since:
SLEE 1.1

getNotificationSource

public NotificationSource getNotificationSource()
Get the object that identifies the component or subsystem in the SLEE that raised the alarm.

Returns:
the notification source. Returns null for SLEE 1.0-compliant notifications.
Since:
SLEE 1.1

getAlarmType

public java.lang.String getAlarmType()
Get the type of the alarm.

Returns:
the alarm type.

getAlarmSource

public java.lang.Object getAlarmSource()
Deprecated. Replaced with getNotificationSource().

Get the object that identifies the source of the alarm.

Returns:
the alarm source. Returns the value of getNotificationSource() for SLEE 1.1-compliant notifications.

getInstanceID

public java.lang.String getInstanceID()
Get the instance identifier of the alarm type.

Returns:
the instance identifier. Returns null for SLEE 1.0-compliant notifications.
Since:
SLEE 1.1

getLevel

public Level getLevel()
Deprecated. Trace and alarm levels have been split into different classes. Replaced with getAlarmLevel().

Get the alarm level of the alarm.

Returns:
the alarm level. Returns Level.INFO for SLEE 1.1-compliant notifications.

getAlarmLevel

public AlarmLevel getAlarmLevel()
Get the alarm level of the alarm notification.

Returns:
the alarm level. Returns null for SLEE 1.0-compliant notifications.
Since:
SLEE 1.1

getCause

public java.lang.Throwable getCause()
Get the cause for the alarm.

For SLEE 1.1-compliant notifications, this method returns the cause provided when the alarm was raised. For SLEE 1.0-compliant notifications, this method returns the cause provided when the alarm notification was generated.

Returns:
the cause of this alarm, or null if no cause was provided.

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 alarm source reference, a SLEE 1.0-based comparison is performed, using the SLEE 1.0 alarm levels. Otherwise, a SLEE 1.1-based comparison is performed using the SLEE 1.1 alarm levels.

The SLEE 1.0-based comparison considers two notifications to be equal if obj is an instance of this class and the alarm type, alarm source, SLEE 1.0 alarm level, and message attributes of obj 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 alarm identifier, notification source, alarm type, alarm instance ID, SLEE 1.1 alarm level, and message attributes of obj are the same as the corresponding attributes of this.

Note that a SLEE 1.0-compliant alarm notification can never be equal to a SLEE 1.1-compliant alarm 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. For SLEE 1.1-compliant alarm notifications this is the hash code of the unique alarm identifier. For SLEE 1.0-compliant notifications this is the hash code of the notification's message.

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 © 2008. All Rights Reserved.