javax.management.modelmbean
public class: ModelMBeanNotificationInfo [javadoc |
source]
java.lang.Object
javax.management.MBeanFeatureInfo
javax.management.MBeanNotificationInfo
javax.management.modelmbean.ModelMBeanNotificationInfo
All Implemented Interfaces:
DescriptorAccess, Cloneable, DescriptorRead, Serializable
The ModelMBeanNotificationInfo object describes a notification emitted
by a ModelMBean.
It is a subclass of MBeanNotificationInfo with the addition of an
associated Descriptor and an implementation of the Descriptor interface.
The fields in the descriptor are defined, but not limited to, the following.
Note that when the Type in this table is Number, a String that is the decimal
representation of a Long can also be used.
Name | Type | Meaning |
name | String |
Notification name. |
descriptorType | String |
Must be "notification". |
severity | Number |
0-6 where 0: unknown; 1: non-recoverable;
2: critical, failure; 3: major, severe;
4: minor, marginal, error; 5: warning;
6: normal, cleared, informative |
messageID | String |
Unique key for message text (to allow translation, analysis). |
messageText | String |
Text of notification. |
log | String |
T - log message, F - do not log message. |
logfile | String |
fully qualified file name appropriate for operating system. |
visibility | Number |
1-4 where 1: always visible 4: rarely visible. |
presentationString | String |
XML formatted string to allow presentation of data. |
The default descriptor contains the name, descriptorType,
displayName and severity(=6) fields. The default value of the name
and displayName fields is the name of the Notification class (as
specified by the name
parameter of the
ModelMBeanNotificationInfo constructor).
The serialVersionUID of this class is -7445681389570207141L
.
Constructor: |
public ModelMBeanNotificationInfo(ModelMBeanNotificationInfo inInfo) {
this(inInfo.getNotifTypes(),
inInfo.getName(),
inInfo.getDescription(),inInfo.getDescriptor());
}
Constructs a new ModelMBeanNotificationInfo object from this
ModelMBeanNotfication Object. Parameters:
inInfo - the ModelMBeanNotificationInfo to be duplicated
|
public ModelMBeanNotificationInfo(String[] notifTypes,
String name,
String description) {
this(notifTypes,name,description,null);
}
Constructs a ModelMBeanNotificationInfo object with a default
descriptor. Parameters:
notifTypes - The array of strings (in dot notation) containing
the notification types that may be emitted.
name - The name of the Notification class.
description - A human readable description of the
Notification. Optional.
|
public ModelMBeanNotificationInfo(String[] notifTypes,
String name,
String description,
Descriptor descriptor) {
super(notifTypes, name, description);
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"ModelMBeanNotificationInfo", "Entry");
}
notificationDescriptor = validDescriptor(descriptor);
}
Constructs a ModelMBeanNotificationInfo object. Parameters:
notifTypes - The array of strings (in dot notation)
containing the notification types that may be emitted.
name - The name of the Notification class.
description - A human readable description of the Notification.
Optional.
descriptor - An instance of Descriptor containing the
appropriate metadata for this instance of the
MBeanNotificationInfo. If it is null a default descriptor
will be created. If the descriptor does not contain the
fields "displayName" or "severity",
the missing ones are added with their default values.
Throws:
RuntimeOperationsException - Wraps an
IllegalArgumentException . The descriptor is invalid, or
descriptor field "name" is not equal to parameter name, or
descriptor field "descriptorType" is not equal to "notification".
- exception:
RuntimeOperationsException - Wraps an
IllegalArgumentException . The descriptor is invalid, or
descriptor field "name" is not equal to parameter name, or
descriptor field "descriptorType" is not equal to "notification".
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.management.modelmbean.ModelMBeanNotificationInfo Detail: |
public Object clone() {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"clone()", "Entry");
}
return(new ModelMBeanNotificationInfo(this));
}
Creates and returns a new ModelMBeanNotificationInfo which is a
duplicate of this ModelMBeanNotificationInfo.
* |
public Descriptor getDescriptor() {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"getDescriptor()", "Entry");
}
if (notificationDescriptor == null) {
// Dead code. Should never happen.
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"getDescriptor()", "Descriptor value is null, " +
"setting descriptor to default values");
}
notificationDescriptor = validDescriptor(null);
}
return((Descriptor)notificationDescriptor.clone());
}
Returns a copy of the associated Descriptor for the
ModelMBeanNotificationInfo. |
public void setDescriptor(Descriptor inDescriptor) {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"setDescriptor(Descriptor)", "Entry");
}
notificationDescriptor = validDescriptor(inDescriptor);
}
Sets associated Descriptor (full replace) for the
ModelMBeanNotificationInfo If the new Descriptor is null,
then the associated Descriptor reverts to a default
descriptor. The Descriptor is validated before it is
assigned. If the new Descriptor is invalid, then a
RuntimeOperationsException wrapping an
IllegalArgumentException is thrown. |
public String toString() {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
MODELMBEAN_LOGGER.logp(Level.FINER,
ModelMBeanNotificationInfo.class.getName(),
"toString()", "Entry");
}
final StringBuilder retStr = new StringBuilder();
retStr.append("ModelMBeanNotificationInfo: ")
.append(this.getName());
retStr.append(" ; Description: ")
.append(this.getDescription());
retStr.append(" ; Descriptor: ")
.append(this.getDescriptor());
retStr.append(" ; Types: ");
String[] nTypes = this.getNotifTypes();
for (int i=0; i < nTypes.length; i++) {
if (i > 0) retStr.append(", ");
retStr.append(nTypes[i]);
}
return retStr.toString();
}
Returns a human readable string containing
ModelMBeanNotificationInfo. |