--- /dev/null Mon Dec 17 10:38:35 2012 +++ new/src/share/classes/com/sun/management/DiagnosticCommandMBean.java Mon Dec 17 10:38:34 2012 @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +package com.sun.management; + +import java.lang.management.PlatformManagedObject; +import javax.management.DynamicMBean; + +/** + * Diagnostic Commands interface for the HotSpot Virtual Machine. + * + *
The diagnostic command MBean is registered to the platform MBeanServer + * as are other platform MBeans. + * + *
The ObjectName
for uniquely identifying the diagnostic
+ * MBean within an MBeanServer is:
+ *
+ * com.sun.management:type=DiagnosticCommand + *+ * + * It can be obtained by calling the + * {@link PlatformManagedObject#getObjectName} method. + * + *
This MBean is an instance of DynamicMBean. Its content is generated at + * runtime and is subject to modifications during the lifetime of the + * Java virtual machine. + * + *
This MBean implements the DynamicMBean interface and + * the NotificationEmitter interface. + * + *
The dynamically defined part of the DiagnosticCommandMBean + * is made of a set of operations, one per diagnostic command + * available through the JMX API. Diagnostic commands names often include + * characters forbidden in Java method names (like dots). The generation of + * an operation name for a given diagnostic command is implementation dependent. + * The recommended way to transform diagnostic command name into a MBean + * operation name is described below: + *
Whatever algorithm is used to generated the operation name, the original + * diagnostic command name is always provided with the meta-data on the + * operation in a field named dcmd.name (see below). + * + *
All the operations associated with a diagnostic command return + * a String. + * + *
All the operations associated with a diagnostic command which + * doesn't support any option or argument have the following + * signature: + *
+ * ()Ljava/lang/String; + *+ *
All the operations associated with a diagnostic command supporting + * at least one option or argument have the following signature: + *
+ * ([Ljava/lang/String;)Ljava/lang/String; + *+ *
For these operations, all the options and arguments are passed into an + * array of String. Each option or argument must be stored in a single String. + * Options or arguments split across several String instances are not supported. + * + *
The distinction between options and arguments:options are identified by + * the option name while arguments are identified by their position in the + * command line. Options and arguments are processed in the order of the array + * passed to the invocation method. + * + *
Like any operation of a dynamic MBean, each of these operations is + * described by MBeanOperationInfo instance. Here's the values returned + * by this object: + *
ACTION_INFO
The Descriptor is a collection of fields containing additional + * meta-data for a JMX element. A field is a name and an associated value. + * The additional meta-data provided for an operation associated with a + * diagnostic command are described in the table below: + *
+ * + *
Name | Type | Description | + *
---|---|---|
dcmd.name | String | + *The original diagnostic command name (not the operation name) | + *
dcmd.description | String | + *The diagnostic command description | + *
dcmd.help | String | + *The full help message for this diagnostic command (same output as + * the one produced by the 'help' command) | + *
dcmd.vmImpact | String | + *The impact of the diagnostic command, + * this value is the same as the one printed in the 'impact' + * section of the help message of the diagnostic command, and it + * is different from the getImpact() of the MBeanOperationInfo | + *
dcmd.enabled | boolean | + *True if the diagnostic command is enabled, false otherwise | + *
dcmd.permissionClass | String | + *Some diagnostic command might require a specific permission to be + * executed, in addition to the MBeanPermission to invoke their + * associated MBean operation. This field returns the class name + * of this permission or null if no permission is required | + *
dcmd.permissionName | String | + *The fist argument of the permission required to execute this + * diagnostic command or null if no permission is required | + *
dcmd.permissionAction | String | + *The second argument of the permission required to execute this + * diagnostic command or null if the permission constructor has only + * one argument (like the ManagementPermission) or if no permission + * is required | + *
dcmd.arguments | Descriptor | + *A Descriptor instance containing the descriptions of options and + * arguments supported by the diagnostic command (see below) | + *
+ * + *
The description of parameters (options or arguments) of a diagnostic + * command is provided within a Descriptor instance. In this Descriptor, + * each field name is a parameter name, and each field value is itself + * a Descriptor instance. The fields provided in this second Descriptor + * instance are described in the table below: + * + *
Name | Type | Description | + *
---|---|---|
dcmd.arg.name | String | + *The name of the parameter | + *
dcmd.arg.type | String | + *The type of the parameter. The returned String is the name of a type + * recognized by the diagnostic command parser. These types are not + * Java types and are implementation dependent. + * | + *
dcmd.arg.description | String | + *The parameter description | + *
dcmd.arg.isMandatory | boolean | + *True if the parameter is mandatory, false otherwise | + *
dcmd.arg.isOption | boolean | + *True if the parameter is an option, false if it is an argument | + *
dcmd.arg.isMultiple | boolean | + *True if the parameter can be specified several times, false + * otherwise | + *
When the set of diagnostic commands currently supported by the Java
+ * Virtual Machine is modified, the DiagnosticCommandMBean
emits
+ * a {@link Notification} with a {@linkplain Notification#getType() type} of
+ * {@code "jmx.mbean.info.changed"} and a {@linkplain
+ * Notification#getUserData() userData} that is the new {@code MBeanInfo}.
+ *
+ * @since 7u12
+ */
+public interface DiagnosticCommandMBean extends DynamicMBean,
+ PlatformManagedObject {
+
+}