wt.jmx.core
Class MBeanRegistry

java.lang.Object
  extended by wt.jmx.core.MBeanRegistry

public final class MBeanRegistry
extends Object

Provides constants and utilities related to registration of MBeans with an MBeanServer.

Supported API: true

Extendable: false


Field Summary
static String DOMAIN_NAME
          Name of domain (see ObjectName in which our MBeans are placed

Supported API: true
static ObjectName MBEAN_SERVER_DELEGATE_OBJECTNAME
          ObjectName of MBeanServerDelegate

Supported API: true
static String MONITOR_TYPE_PROP_KEY
          ObjectName property key (see ObjectName for Windchill monitoring MBean type

Supported API: true
static String MONITORS_SUB_SYSTEM_PROP
          ObjectName property value (see ObjectName for SUB_SYSTEM_PROP_KEY for Windchill monitors

Supported API: true
static String SERVLET_ENGINE_SUBSYSTEM_PROP_KEY
          ObjectName property key (see ObjectName for servlet sub-system name

Supported API: true
static String SERVLET_ENGINE_SYSTEM_PROP_KEY
          ObjectName property key (see ObjectName for top-level servlet system name

Supported API: true
static String SUB_SYSTEM_PROP_KEY
          ObjectName property key (see ObjectName for top-level (non-servlet) Windchill system name

Supported API: true
static String TYPE_PROP_KEY
          ObjectName property key (see ObjectName for logical Windchill type name.
static String WEB_APP_CONTEXT_PROP_KEY
          ObjectName property key (see ObjectName for web app context name

Supported API: true
 
Method Summary
static MBeanServer getMBeanServer()
          Get the MBeanServer instance to be targeted.
static String getPostfixedObjectNameString(ObjectName objectName, String[][] postfixNameValuePairs)
          Create an ObjectName within the branch of the JMX "tree" noted by origObjectNameString.
static String getPrefixedObjectNameString(String domain, String[][] prefixNameValuePairs, ObjectName objectName)
          Namespace an object name by a specified prefix.
static String getPropString(String[][] nameValuePairs)
          Produce an ObjectName property string from specified key/value pairs

Supported API: true
static boolean isObjectNameInstanceOf(ObjectName objectName, String classname)
          Determines whether the MBean with the given object name is an instance of the given class.
static boolean isObjectNameRegistered(ObjectName objectName)
          Determines whether the given object name is registered with the target MBeanServer.
static String quoteIfNecessary(String string)
          Apply ObjectName.quote() to string only where necessary; otherwise the original string is returned.
static ObjectName registerMBean(Object mbean, ObjectName objectName)
          Registers 'mbean' under specified ObjectName.
static ObjectName registerMBean(Object mbean, String name)
          Registers 'mbean' under ObjectName specified as a String.
static ObjectName registerMBean(Object mbean, String domain, String[][] nameValuePairs)
          Registers 'mbean' under an ObjectName formed from 'domain' and property key/value pairs specified by 'nameValuePairs' and returns the ObjectName under which the MBean is registred unless registration fails, in which case null is returned.
static void unregisterMBean(ObjectName objectName)
          Unregister the MBean registered under the specified ObjectName if an MBean is registered under the given name, otherwise does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOMAIN_NAME

public static final String DOMAIN_NAME
Name of domain (see ObjectName in which our MBeans are placed

Supported API: true

See Also:
Constant Field Values

SERVLET_ENGINE_SYSTEM_PROP_KEY

public static final String SERVLET_ENGINE_SYSTEM_PROP_KEY
ObjectName property key (see ObjectName for top-level servlet system name

Supported API: true

See Also:
Constant Field Values

SERVLET_ENGINE_SUBSYSTEM_PROP_KEY

public static final String SERVLET_ENGINE_SUBSYSTEM_PROP_KEY
ObjectName property key (see ObjectName for servlet sub-system name

Supported API: true

See Also:
Constant Field Values

MONITOR_TYPE_PROP_KEY

public static final String MONITOR_TYPE_PROP_KEY
ObjectName property key (see ObjectName for Windchill monitoring MBean type

Supported API: true

See Also:
Constant Field Values

WEB_APP_CONTEXT_PROP_KEY

public static final String WEB_APP_CONTEXT_PROP_KEY
ObjectName property key (see ObjectName for web app context name

Supported API: true

See Also:
Constant Field Values

SUB_SYSTEM_PROP_KEY

public static final String SUB_SYSTEM_PROP_KEY
ObjectName property key (see ObjectName for top-level (non-servlet) Windchill system name

Supported API: true

See Also:
Constant Field Values

TYPE_PROP_KEY

public static final String TYPE_PROP_KEY
ObjectName property key (see ObjectName for logical Windchill type name. Use this in place of "type" in Windchill MBean naming as some JMX consoles (Java 6's jconsole, for instance) place special meaning and undesirable behavior on usages of "type" (and "j2eeType") as property keys.

Supported API: true

See Also:
Constant Field Values

MONITORS_SUB_SYSTEM_PROP

public static final String MONITORS_SUB_SYSTEM_PROP
ObjectName property value (see ObjectName for SUB_SYSTEM_PROP_KEY for Windchill monitors

Supported API: true

See Also:
Constant Field Values

MBEAN_SERVER_DELEGATE_OBJECTNAME

public static final ObjectName MBEAN_SERVER_DELEGATE_OBJECTNAME
ObjectName of MBeanServerDelegate

Supported API: true

Method Detail

getMBeanServer

public static MBeanServer getMBeanServer()
Get the MBeanServer instance to be targeted. This method should generally be used to obtain the MBeanServer unless the platform MBeanServer (see getPlatformMBeanServer() in ManagementFactory) is specifically required.

Supported API: true


isObjectNameRegistered

public static boolean isObjectNameRegistered(ObjectName objectName)
Determines whether the given object name is registered with the target MBeanServer.

Supported API: true


isObjectNameInstanceOf

public static boolean isObjectNameInstanceOf(ObjectName objectName,
                                             String classname)
Determines whether the MBean with the given object name is an instance of the given class.

Supported API: true


registerMBean

public static ObjectName registerMBean(Object mbean,
                                       String domain,
                                       String[][] nameValuePairs)
Registers 'mbean' under an ObjectName formed from 'domain' and property key/value pairs specified by 'nameValuePairs' and returns the ObjectName under which the MBean is registred unless registration fails, in which case null is returned.

Supported API: true


registerMBean

public static ObjectName registerMBean(Object mbean,
                                       ObjectName objectName)
Registers 'mbean' under specified ObjectName. Returns the ObjectName under which the MBean is registered unless registration fails, in which case null is returned.

Supported API: true


registerMBean

public static ObjectName registerMBean(Object mbean,
                                       String name)
Registers 'mbean' under ObjectName specified as a String. Returns the ObjectName under which the MBean is registered unless registration fails, in which case null is returned.

Supported API: true


unregisterMBean

public static void unregisterMBean(ObjectName objectName)
Unregister the MBean registered under the specified ObjectName if an MBean is registered under the given name, otherwise does nothing.

Supported API: true


getPostfixedObjectNameString

public static String getPostfixedObjectNameString(ObjectName objectName,
                                                  String[][] postfixNameValuePairs)
Create an ObjectName within the branch of the JMX "tree" noted by origObjectNameString. Names in 'postfixNameValuePairs' are adjusted as necessary to ensure unique property names within the resulting ObjectName string.

Supported API: true

Parameters:
objectName - prefix to use in resulting ObjectName string
postfixNameValuePairs - ObjectName property key/value pairs to append to 'objectname' to obtain resulting ObjectName string

quoteIfNecessary

public static String quoteIfNecessary(String string)
Apply ObjectName.quote() to string only where necessary; otherwise the original string is returned.

Supported API: true

Parameters:
string - string to quote as needed for inclusion in an ObjectName

getPrefixedObjectNameString

public static String getPrefixedObjectNameString(String domain,
                                                 String[][] prefixNameValuePairs,
                                                 ObjectName objectName)
Namespace an object name by a specified prefix. The domain and property keys in 'objectName' are adjusted as necessary to ensure unique property keys in the resulting ObjectName string (e.g. the domain is treated as a "domain" property for starters).

Given that jconsole keys off the ObjectName's order (even though it is not significant for search we take care never to use the Hashtable accessors but always the strings, which is much more painful, but gives the desired hierarchy in jconsole.

Supported API: true

Parameters:
domain - ObjectName domain to use in resulting ObjectName
prefixNameValuePairs - property key/value pairs to use as start of resulting ObjectName
objectName - ObjectName to namespace by other parameters, i.e. to use as tail of resulting ObjectName

getPropString

public static String getPropString(String[][] nameValuePairs)
Produce an ObjectName property string from specified key/value pairs

Supported API: true