<%@page contentType="text/html" import="java.net.*,java.util.*,javax.management.*,javax.management.modelmbean.*, org.jboss.jmx.adaptor.control.Server, org.jboss.jmx.adaptor.control.AttrResultInfo, org.jboss.jmx.adaptor.model.*, java.lang.reflect.Array" %> <%! public String fixDescription(String desc) { if (desc == null || desc.equals("")) { return "(no description)"; } return desc; } %> MBean Inspector <% ObjectName objectName = mbeanData.getObjectName(); String objectNameString = mbeanData.getName(); MBeanInfo mbeanInfo = mbeanData.getMetaData(); MBeanAttributeInfo[] attributeInfo = mbeanInfo.getAttributes(); MBeanOperationInfo[] operationInfo = mbeanInfo.getOperations(); %>
JBoss

JMX MBean View

Back to Agent View Refresh MBean View

MBean description:

<%= fixDescription(mbeanInfo.getDescription())%>

List of MBean attributes:

<% boolean hasWriteable = false; for(int a = 0; a < attributeInfo.length; a ++) { MBeanAttributeInfo attrInfo = attributeInfo[a]; String attrName = attrInfo.getName(); String attrType = attrInfo.getType(); AttrResultInfo attrResult = Server.getMBeanAttributeResultInfo(objectNameString, attrInfo); String attrValue = attrResult.getAsText(); String access = ""; if( attrInfo.isReadable() ) access += "R"; if( attrInfo.isWritable() ) { access += "W"; hasWriteable = true; } String attrDescription = fixDescription(attrInfo.getDescription()); %> <% } %>
Name Type Access Value Description
<%= attrName %> <%= attrType %> <%= access %> <% if( attrInfo.isWritable() ) { String readonly = attrResult.editor == null ? "readonly" : ""; if( attrType.equals("boolean") || attrType.equals("java.lang.Boolean") ) { // Boolean true/false radio boxes Boolean value = Boolean.valueOf(attrValue); String trueChecked = (value == Boolean.TRUE ? "checked" : ""); String falseChecked = (value == Boolean.FALSE ? "checked" : ""); %> >True >False <% } else if( attrInfo.isReadable() ) { // Text fields for read-write string values %> " <%= readonly %>> <% } else { // Empty text fields for write-only %> > <% } } else { if( attrType.equals("[Ljavax.management.ObjectName;") ) { // Array of Object Names ObjectName[] names = (ObjectName[]) Server.getMBeanAttributeObject(objectNameString, attrName); if( names != null ) { %> <% for( int i = 0; i < names.length; i++ ) { %> <% } %>
"><%= ( names[ i ] + "" ) %>
<% } } // Array of some objects else if( attrType.endsWith("[]")) { Object arrayObject = Server.getMBeanAttributeObject(objectNameString, attrName); if (arrayObject != null) { %> <% for (int i = 0; i < Array.getLength(arrayObject); ++i) { %> <% } %>
<%=Array.get(arrayObject,i)%>
<% } } else { // Just the value string %> <%= attrValue %> <% } } if( attrType.equals("javax.management.ObjectName") ) { // Add a link to the mbean if( attrValue != null ) { %> View MBean <% } } %>
<%= attrDescription%>
<% if( hasWriteable ) { %> <% } %>

List of MBean operations:

<% for(int a = 0; a < operationInfo.length; a ++) { MBeanOperationInfo opInfo = operationInfo[a]; boolean accept = true; if (opInfo instanceof ModelMBeanOperationInfo) { Descriptor desc = ((ModelMBeanOperationInfo)opInfo).getDescriptor(); String role = (String)desc.getFieldValue("role"); if ("getter".equals(role) || "setter".equals(role)) { accept = false; } } if (accept) { MBeanParameterInfo[] sig = opInfo.getSignature(); %>

<%= opInfo.getReturnType() + " " + opInfo.getName() + "()" %>

<%= fixDescription(opInfo.getDescription())%>

<% if( sig.length > 0 ) { %> <% for(int p = 0; p < sig.length; p ++) { MBeanParameterInfo paramInfo = sig[p]; String pname = paramInfo.getName(); String ptype = paramInfo.getType(); if( pname == null || pname.length() == 0 || pname.equals(ptype) ) { pname = "arg"+p; } %> <% } %>
Param ParamType ParamValue ParamDescription
<%= pname %> <%= ptype %> <% if( ptype.equals("boolean") || ptype.equals("java.lang.Boolean") ) { // Boolean true/false radio boxes %> True False <% } else { %> <% } %> <%= fixDescription(paramInfo.getDescription())%>
<% } %>
<% } } %>