/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @author IBM Corp.
*
* Copyright IBM Corp. 1999-2000. All rights reserved.
*/
/**
* <p>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.</p>
*
* <P id="descriptor">
* 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.</P>
*
* <table border="1" cellpadding="5">
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
* <tr><td>name</td><td>String</td>
* <td>Notification name.</td></tr>
* <tr><td>descriptorType</td><td>String</td>
* <td>Must be "notification".</td></tr>
* <tr><td>severity</td><td>Number</td>
* <td>0-6 where 0: unknown; 1: non-recoverable;
* 2: critical, failure; 3: major, severe;
* 4: minor, marginal, error; 5: warning;
* 6: normal, cleared, informative</td></tr>
* <tr><td>messageID</td><td>String</td>
* <td>Unique key for message text (to allow translation, analysis).</td></tr>
* <tr><td>messageText</td><td>String</td>
* <td>Text of notification.</td></tr>
* <tr><td>log</td><td>String</td>
* <td>T - log message, F - do not log message.</td></tr>
* <tr><td>logfile</td><td>String</td>
* <td>fully qualified file name appropriate for operating system.</td></tr>
* <tr><td>visibility</td><td>Number</td>
* <td>1-4 where 1: always visible 4: rarely visible.</td></tr>
* <tr><td>presentationString</td><td>String</td>
* <td>XML formatted string to allow presentation of data.</td></tr>
* </table>
*
* <p>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 <code>name</code> parameter of the
* ModelMBeanNotificationInfo constructor).</p>
*
* <p>The <b>serialVersionUID</b> of this class is <code>-7445681389570207141L</code>.
*
* @since 1.5
*/
public class ModelMBeanNotificationInfo
extends MBeanNotificationInfo
implements DescriptorAccess {
// Serialization compatibility stuff:
// Two serial forms are supported in this class. The selected form
// depends on system property "jmx.serial.form":
// - "1.0" for JMX 1.0
// - any other value for JMX 1.1 and higher
//
// Serial version for old serial form
//
// Serial version for new serial form
//
// Serializable fields in old serial form
{
};
//
// Serializable fields in new serial form
{
};
//
// Actual serial version and serial form
private static final long serialVersionUID;
/**
* @serialField notificationDescriptor Descriptor The descriptor
* containing the appropriate metadata for this instance
*/
private static boolean compat = false;
static {
try {
} catch (Exception e) {
// OK: No compat with 1.0
}
if (compat) {
} else {
}
}
//
// END Serialization compatibility stuff
/**
* @serial The descriptor containing the appropriate metadata for
* this instance
*/
/**
* Constructs a ModelMBeanNotificationInfo object with a default
* descriptor.
*
* @param notifTypes The array of strings (in dot notation) containing
* the notification types that may be emitted.
* @param name The name of the Notification class.
* @param description A human readable description of the
* Notification. Optional.
**/
}
/**
* Constructs a ModelMBeanNotificationInfo object.
*
* @param notifTypes The array of strings (in dot notation)
* containing the notification types that may be emitted.
* @param name The name of the Notification class.
* @param description A human readable description of the Notification.
* Optional.
* @param 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.
*
* @exception RuntimeOperationsException Wraps an
* {@link IllegalArgumentException}. The descriptor is invalid, or
* descriptor field "name" is not equal to parameter name, or
* descriptor field "descriptorType" is not equal to "notification".
*
**/
ModelMBeanNotificationInfo.class.getName(),
"ModelMBeanNotificationInfo", "Entry");
}
}
/**
* Constructs a new ModelMBeanNotificationInfo object from this
* ModelMBeanNotfication Object.
*
* @param inInfo the ModelMBeanNotificationInfo to be duplicated
*
**/
this(inInfo.getNotifTypes(),
}
/**
* Creates and returns a new ModelMBeanNotificationInfo which is a
* duplicate of this ModelMBeanNotificationInfo.
**/
ModelMBeanNotificationInfo.class.getName(),
"clone()", "Entry");
}
return(new ModelMBeanNotificationInfo(this));
}
/**
* Returns a copy of the associated Descriptor for the
* ModelMBeanNotificationInfo.
*
* @return Descriptor associated with the
* ModelMBeanNotificationInfo object.
*
* @see #setDescriptor
**/
ModelMBeanNotificationInfo.class.getName(),
"getDescriptor()", "Entry");
}
if (notificationDescriptor == null) {
// Dead code. Should never happen.
ModelMBeanNotificationInfo.class.getName(),
"getDescriptor()", "Descriptor value is null, " +
"setting descriptor to default values");
}
}
}
/**
* 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.
*
* @param inDescriptor replaces the Descriptor associated with the
* ModelMBeanNotification interface
*
* @exception RuntimeOperationsException Wraps an
* {@link IllegalArgumentException} for invalid Descriptor.
*
* @see #getDescriptor
**/
ModelMBeanNotificationInfo.class.getName(),
"setDescriptor(Descriptor)", "Entry");
}
}
/**
* Returns a human readable string containing
* ModelMBeanNotificationInfo.
*
* @return a string describing this object.
**/
ModelMBeanNotificationInfo.class.getName(),
"toString()", "Entry");
}
.append(this.getDescription());
.append(this.getDescriptor());
}
}
/**
* Clones the passed in Descriptor, sets default values, and checks for validity.
* If the Descriptor is invalid (for instance by having the wrong "name"),
* this indicates programming error and a RuntimeOperationsException will be thrown.
*
* The following fields will be defaulted if they are not already set:
* descriptorType="notification",displayName=this.getName(),
* name=this.getName(),severity="6"
*
*
* @param in Descriptor to be checked, or null which is equivalent to an
* empty Descriptor.
* @exception RuntimeOperationsException if Descriptor is invalid
*/
if (defaulted) {
clone = new DescriptorSupport();
} else {
}
//Setting defaults.
}
}
}
}
//Checking validity
"The isValid() method of the Descriptor object itself returned false,"+
}
"The Descriptor \"name\" field does not match the object described. " +
}
"The Descriptor \"descriptorType\" field does not match the object described. " +
}
return clone;
}
/**
* Deserializes a {@link ModelMBeanNotificationInfo} from an
* {@link ObjectInputStream}.
**/
throws IOException, ClassNotFoundException {
// New serial form ignores extra field "currClass"
}
/**
* Serializes a {@link ModelMBeanNotificationInfo} to an
* {@link ObjectOutputStream}.
**/
throws IOException {
if (compat) {
// Serializes this instance in the old serial form
//
out.writeFields();
} else {
// Serializes this instance in the new serial form
//
}
}
}