javax.slee.management
Class Alarm

java.lang.Object
  extended by javax.slee.management.Alarm
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, VendorExtensions

public final class Alarm
extends java.lang.Object
implements VendorExtensions, java.io.Serializable, java.lang.Comparable

The Alarm class contains information about an alarm that has been raised in the SLEE.

Serialization of this class takes 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 Alarm object containing a cause includes the stack trace of that cause in the serialization stream. If the cause Throwable cannot be later deserialized with the Alarm object, a generic java.lang.Exception with a message containing the original stack trace is returned as the alarm's cause instead.

Since:
SLEE 1.1
See Also:
Serialized Form

Constructor Summary
Alarm(java.lang.String alarmID, NotificationSource notificationSource, java.lang.String alarmType, java.lang.String instanceID, AlarmLevel level, java.lang.String message, java.lang.Throwable cause, long timestamp)
          Create an Alarm object that contains information about an alarm that has been raised in the SLEE.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compare this alarm with the specified object for order.
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 alarm for equality with another object.
 java.lang.String getAlarmID()
          Get the unique alarm identifier for the alarm.
 AlarmLevel getAlarmLevel()
          Get the alarm level of the alarm.
 java.lang.String getAlarmType()
          Get the identifier specifying the type of the alarm, provided when the alarm was raised.
 java.lang.Throwable getCause()
          Get the cause provided when the alarm was raised (if any).
 java.lang.String getInstanceID()
          Get the identifier specifying the particular instance of the alarm type, provided when the alarm was raised.
 java.lang.String getMessage()
          Get the message provided when the alarm was raised.
 NotificationSource getNotificationSource()
          Get the object that identifies the component or subsystem in the SLEE that raised the alarm.
 long getTimestamp()
          Get the time (in ms since January 1, 1970 UTC) that the alarm was raised.
 java.lang.Object getVendorData()
          Get the vendor-specific data.
 int hashCode()
          Get a hash code value for this alarm.
 void setVendorData(java.lang.Object vendorData)
          Set the vendor-specific data.
 java.lang.String toString()
          Get a string representation for this alarm.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Alarm

public Alarm(java.lang.String alarmID,
             NotificationSource notificationSource,
             java.lang.String alarmType,
             java.lang.String instanceID,
             AlarmLevel level,
             java.lang.String message,
             java.lang.Throwable cause,
             long timestamp)
      throws java.lang.NullPointerException
Create an Alarm object that contains information about an alarm that has been raised in the SLEE.

Parameters:
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.
level - the alarm level of the alarm.
message - the reason for the alarm.
cause - an optional cause throwable for the alarm. May be null if no cause was provided when the alarm was raised.
timestamp - the time (in ms since January 1, 1970 UTC) that the alarm was raised.
Throws:
java.lang.NullPointerException - if alarmID, notificationSource, alarmType, instanceID, level, or message is null.
Method Detail

getAlarmID

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

Returns:
the alarm identifier.

getNotificationSource

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

Returns:
the notification source.

getAlarmType

public java.lang.String getAlarmType()
Get the identifier specifying the type of the alarm, provided when the alarm was raised.

Returns:
the type of the alarm.

getInstanceID

public java.lang.String getInstanceID()
Get the identifier specifying the particular instance of the alarm type, provided when the alarm was raised.

Returns:
the alarm instance ID.

getAlarmLevel

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

Returns:
the alarm level.

getMessage

public java.lang.String getMessage()
Get the message provided when the alarm was raised.

Returns:
the alarm message.

getCause

public java.lang.Throwable getCause()
Get the cause provided when the alarm was raised (if any).

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

getTimestamp

public long getTimestamp()
Get the time (in ms since January 1, 1970 UTC) that the alarm was raised.

Returns:
the time that the alarm was raised.

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.

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.


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.

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.


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.

getVendorData

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

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

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an alarm with the same notification source, alarm type, and alarm instance ID as this, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Get a hash code value for this alarm. The hash code is calculated from the exclusive-or of the notification source, alarm type, and alarm instance ID.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this alarm.
See Also:
Object.hashCode()

compareTo

public int compareTo(java.lang.Object obj)
Compare this alarm with the specified object for order. Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.

Alarm ordering is determined by comparing unique the alarm identifier.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the object to compare this with.
Returns:
a negative integer, zero, or a positive integer if this alarm object is considered less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if obj is not an instance of this class.
See Also:
Comparable.compareTo(Object)

toString

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

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2009. All Rights Reserved.