Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net.management
Class MBeanHelper

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.net.management.MBeanHelper

Direct Known Subclasses:
  MBeanConnector

    public abstract class MBeanHelper

extends Base

Helper class providing various functionality related to aggregation of attributes and methods exposed by Coherence JMX framework MBeans.

Since:
  Coherence 3.3
Author:
  gg 2007/01/02

Field Summary
`static java.lang.String` | `NETWORK_HEALTH` The Network Health MBean name.

Constructor Summary
`MBeanHelper()`

Method Summary
`static double` | `calculateAverage(javax.management.MBeanServer server, java.lang.String sPattern, java.lang.String sAttribute)` Calculate the average of the attribute values across all the MBeans with a given name pattern.
`static MBeanReference` | `ensureNetworkHealthMBean()` Ensure that there is an instance of NetworkHealth MBean registered with the default MBeansServer.
`static MBeanReference` | `ensureSingletonMBean(java.lang.String sName)` Ensure that there is an instance of a local MBean of the specified type registered with the default MBeansServer.
`static javax.management.MBeanServer` | `findMBeanServer()` Find an MBeanServer that Coherence MBeans are registered with.
`static javax.management.MBeanServer` | `findMBeanServer(java.lang.String sDefaultDomain)` Find an MBeanServer that has the specified default domain name.
`static java.lang.String` | `getDefaultDomain()` Return the the default domain name as configured in the Coherence operational configuration descriptor ("default-domain-name" element).
`static MBeanServerFinder` | `getServerFinder()` Return the the MBeanServerFinder as configured in the Coherence operational configuration descriptor ("server-factory" element).
`static boolean` | `isQuoteRequired(java.lang.String s)` Determine if the string requires quotes.
`static java.lang.String` | `quote(java.lang.String s)` Create an escape-sequence string that allows for special characters to be included in a JMX ObjectName.
`static java.lang.String` | `quoteCanonical(java.lang.String sCanonical)` Return a quoted `KeyPropertyString` or a quoted canonical name.
`static void` | `registerQueryMBeans(java.lang.String sMBeanServerDomain, java.lang.String sQuery, java.lang.String sPrefix, Registry registry)` Find all MBeans matching to the specified query at a local MBeanServer and register them with the specified Registry.
`static java.lang.Object` | `startHttpConnector(int nPort, javax.management.MBeanServer mbs)` Start a `com.sun.jdmk.comm.HtmlAdaptorServer`, which is a part of the Sun JMX reference implementation.
`static javax.management.remote.JMXConnectorServer` | `startRmiConnector(java.lang.String sHost, int nRegPort, int nConPort, javax.management.MBeanServer mbs, java.util.Map mapEnv)` Start a `JMXConnectorServer`.
`static java.lang.String` | `unquote(java.lang.String s)` Convert a string returned from the `quote(java.lang.String)` method to the original string.

Field Detail

### NETWORK_HEALTH

    public static final java.lang.String NETWORK_HEALTH

  The Network Health MBean name.

  See Also:
    Constant Field Values

Constructor Detail

### MBeanHelper

    public MBeanHelper()

Method Detail

### getDefaultDomain

    public static java.lang.String getDefaultDomain()

  Return the the default domain name as configured in the Coherence operational configuration descriptor ("default-domain-name" element).

  Returns:
    the default domain name

### getServerFinder

    public static MBeanServerFinder getServerFinder()

  Return the the MBeanServerFinder as configured in the Coherence operational configuration descriptor ("server-factory" element).

  Returns:
    the MBeanServerFinder (null if none was configured)

### findMBeanServer

    public static javax.management.MBeanServer findMBeanServer()

  Find an MBeanServer that Coherence MBeans are registered with.

  Returns:
    an existing or a new MBeanServer with the default domain name as configured in the Coherence operational configuration descriptor

### findMBeanServer

    public static javax.management.MBeanServer findMBeanServer(java.lang.String sDefaultDomain)

  Find an MBeanServer that has the specified default domain name. If the domain name is not specified, any existing MBeanServer is choosen.

  Parameters:
    `sDefaultDomain` - the default domain name
  Returns:
    an existing or a new MBeanServer with the specified default domain name

### registerQueryMBeans

    public static void registerQueryMBeans(java.lang.String sMBeanServerDomain,
                                           java.lang.String sQuery,
                                           java.lang.String sPrefix,
                                           Registry registry)

  Find all MBeans matching to the specified query at a local MBeanServer and register them with the specified Registry.

  Note: the MBeanServer that the query runs against is not necesserily the one used by the Registry.

  Parameters:
    `sMBeanServerDomain` - the default domain of the MBeanServer where the query should be executed. If this value is empty or null the Coherence default domain is used
    `sQuery` - a JMX query string that will be used to find the MBeans
    `sPrefix` - a target location to prepend to converted MBean names
    `registry` - a Registry to register the JMX query results with

### calculateAverage

    public static double calculateAverage(javax.management.MBeanServer server,
                                          java.lang.String sPattern,
                                          java.lang.String sAttribute)

  Calculate the average of the attribute values across all the MBeans with a given name pattern. The attribute type should be a Number and will be treated as Java `double` values.

  Parameters:
    `server` - the MBeanServer
    `sPattern` - the name pattern
    `sAttribute` - the attribute name
  Returns:
    an average value

### ensureNetworkHealthMBean

    public static MBeanReference ensureNetworkHealthMBean()

  Ensure that there is an instance of NetworkHealth MBean registered with the default MBeansServer.

  Returns:
    the MBeanReference for the registered NetworkHealth MBean

### ensureSingletonMBean

    public static MBeanReference ensureSingletonMBean(java.lang.String sName)

  Ensure that there is an instance of a local MBean of the specified type registered with the default MBeansServer.

  Parameters:
    `sName` - an MBean name
  Returns:
    the MBeanReference for the registered MBean

### startRmiConnector

    public static javax.management.remote.JMXConnectorServer startRmiConnector(java.lang.String sHost,
                                                                               int nRegPort,
                                                                               int nConPort,
                                                                               javax.management.MBeanServer mbs,
                                                                               java.util.Map mapEnv)

  Start a `JMXConnectorServer`. This method is used to expose the specified MBeanServer to external agents (such as JConsole) using RMI.

  This method also allows for the RMI functionality to emulate the JConsole remote connection security.

  For the list of relevant system properties please see:

  Java 1.5 Agent Documentation, Java 1.6 Agent Documentation

  Parameters:
    `sHost` - host to bind to
    `nRegPort` - port used for the JMX RMI registry
    `nConPort` - port used for the JMX RMI connection
    `mbs` - `MBeanServer` that contains Coherence MBeans
    `mapEnv` - a set of attributes to control the new connector server's behavior
  Returns:
    a JMXConnectorServer that has been started
  See Also:
    `JMXConnectorServerFactory`

### startHttpConnector

    public static java.lang.Object startHttpConnector(int nPort,
                                                      javax.management.MBeanServer mbs)

  Start a `com.sun.jdmk.comm.HtmlAdaptorServer`, which is a part of the Sun JMX reference implementation. It is being created via reflection to avoid a runtime dependency to this library.

  Parameters:
    `nPort` - port to bind the HTTP server to
    `mbs` - MBeanServer that this HTTP server will expose
  Returns:
    an HtmlAdaptorServer that has been started

### quote

    public static java.lang.String quote(java.lang.String s)

  Create an escape-sequence string that allows for special characters to be included in a JMX ObjectName.

  Parameters:
    `s` - the string to be quoted
  Returns:
    the quoted string
  Since:
    Coherence 3.4

### unquote

    public static java.lang.String unquote(java.lang.String s)

  Convert a string returned from the `quote(java.lang.String)` method to the original string.

  Parameters:
    `s` - the string to be unquoted
  Returns:
    the unquoted string
  Throws:
    `java.lang.IllegalArgumentException` - if the passed string could not have been returned by the `quote(java.lang.String)` method; for instance if it does not begin and end with a quote (")
  Since:
    Coherence 3.4

### isQuoteRequired

    public static boolean isQuoteRequired(java.lang.String s)

  Determine if the string requires quotes.

  Parameters:
    `s` - the string to be quoted
  Returns:
    true iff the `quote(java.lang.String)` method needs to be called
  Since:
    Coherence 3.4

### quoteCanonical

    public static java.lang.String quoteCanonical(java.lang.String sCanonical)
                                           throws javax.management.MalformedObjectNameException

  Return a quoted `KeyPropertyString` or a quoted canonical name.

  Parameters:
    `sCanonical` - a string to be quoted
  Returns:
    a quoted and escape-sequence string
  Throws:
    `javax.management.MalformedObjectNameException` - if the name is invalid
  Since:
    Coherence 3.4

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.