public final class Alarm extends Object implements VendorExtensions, Serializable, Comparable
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.
| Constructor and Description |
|---|
Alarm(String alarmID,
NotificationSource notificationSource,
String alarmType,
String instanceID,
AlarmLevel level,
String message,
Throwable cause,
long timestamp)
Create an
Alarm object that contains information about an
alarm that has been raised in the SLEE. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(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(Object obj)
Compare this alarm for equality with another object.
|
String |
getAlarmID()
Get the unique alarm identifier for the alarm.
|
AlarmLevel |
getAlarmLevel()
Get the alarm level of the alarm.
|
String |
getAlarmType()
Get the identifier specifying the type of the alarm, provided when the
alarm was raised.
|
Throwable |
getCause()
Get the cause provided when the alarm was raised (if any).
|
String |
getInstanceID()
Get the identifier specifying the particular instance of the alarm type,
provided when the alarm was raised.
|
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.
|
Object |
getVendorData()
Get the vendor-specific data.
|
int |
hashCode()
Get a hash code value for this alarm.
|
void |
setVendorData(Object vendorData)
Set the vendor-specific data.
|
String |
toString()
Get a string representation for this alarm.
|
public Alarm(String alarmID, NotificationSource notificationSource, String alarmType, String instanceID, AlarmLevel level, String message, Throwable cause, long timestamp) throws NullPointerException
Alarm object that contains information about an
alarm that has been raised in the SLEE.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.NullPointerException - if alarmID, notificationSource,
alarmType, instanceID, level,
or message is null.public String getAlarmID()
public NotificationSource getNotificationSource()
public String getAlarmType()
public String getInstanceID()
public AlarmLevel getAlarmLevel()
public String getMessage()
public Throwable getCause()
null if no cause was provided.public long getTimestamp()
public static void enableVendorDataSerialization()
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.
public static void disableVendorDataSerialization()
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.
public static void enableVendorDataDeserialization()
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.
public static void disableVendorDataDeserialization()
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.
public void setVendorData(Object vendorData)
setVendorData in interface VendorExtensionsvendorData - the vendor-specific data.public Object getVendorData()
getVendorData in interface VendorExtensionspublic boolean equals(Object obj)
equals in class Objectobj - the object to compare this with.true if obj is an alarm with the same
notification source, alarm type, and alarm instance ID as this,
false otherwise.Object.equals(Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public int compareTo(Object obj)
Alarm ordering is determined by comparing unique the alarm identifier.
compareTo in interface Comparableobj - the object to compare this with.ClassCastException - if obj is not an instance of this
class.Comparable.compareTo(Object)public String toString()
toString in class ObjectObject.toString()