|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.Base
com.tangosol.net.management.MBeanHelper
public abstract class MBeanHelper
Helper class providing various functionality related to aggregation of attributes and methods exposed by Coherence JMX framework MBeans.
Field Summary | |
---|---|
static java.util.Map |
SCALAR_TYPES A map of scalar types (classes) keyed by the corresponding JMX signatures. |
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 int |
compareKeyList(javax.management.ObjectName oname1, javax.management.ObjectName oname2) Compare two global MBean names forcing numeric comparison of the node ID while using string comparison on all other key properties. |
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. |
protected static java.lang.reflect.Method |
findMethod(java.lang.Class clzMBean, javax.management.MBeanOperationInfo op) Find a Method for the specified MBeanOperationInfo in the specified MBean class or interface. |
protected static java.lang.reflect.Method |
findMethod(java.lang.Class clz, java.lang.String sName, java.lang.String[] asParamTypes) Find a Method with the specified name and parameter types in the specified class. |
static java.lang.String |
getDefaultDomain() Return the the default domain name as configured in the Coherence operational configuration descriptor ("default-domain-name" element). |
static java.lang.String |
getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanAttributeInfo info) Retrieve a description for a particular attribute by finding a Description annotation on the getter method for the attribute. |
static java.lang.String |
getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanInfo info) Retrieve the description for the MBean from the MBean interface annotation. |
static java.lang.String |
getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanOperationInfo info) Retrieve a description for the particular MBeanOperationInfo by finding a Description annotation on the corresponding method. |
protected static java.lang.annotation.Annotation |
getParameterAnnotation(java.lang.reflect.Method meth, int iParam, java.lang.Class clzAnno) Retrieve an Annotation for a parameter to a method. |
static java.lang.String |
getParameterName(java.lang.Class clzMBeanIface, javax.management.MBeanOperationInfo infoOp, javax.management.MBeanParameterInfo infoParam, int iParam) Retrieve the parameter name for the specified parameter by finding a Description annotation on the corresponding method. |
static boolean |
hasDomain(java.lang.String sCanonical) Return true if the Canonical name is prefixed with the domain name. |
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 |
registerCacheMBean(CacheService service, java.lang.String sCacheName, java.lang.String sContext, java.util.Map map) Register the specified map with the cluster registry. |
static void |
registerCacheMBean(NamedCache cache, java.lang.String sContext) Register the specified NamedCache with the cluster registry. |
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 |
stripDomain(java.lang.String sCanonical) Remove the domain prefix from the canonical name if one exists. |
static java.lang.String |
unquote(java.lang.String s) Convert a string returned from the quote(java.lang.String) method to the original string. |
static void |
unregisterCacheMBean(CacheService service, java.lang.String sCacheName) Unregister all managed objects that are related to the specified cache from the registry. |
static void |
unregisterCacheMBean(java.lang.String sCacheName, java.lang.String sContext) Unregister all managed objects related to the given cache name and context from the cluster registry. |
Field Detail |
---|
public static final java.util.Map SCALAR_TYPES
Constructor Detail |
---|
public MBeanHelper()
Method Detail |
---|
public static java.lang.String getDefaultDomain()
public static javax.management.MBeanServer findMBeanServer()
public static javax.management.MBeanServer findMBeanServer(java.lang.String sDefaultDomain)
sDefaultDomain
- the default domain namepublic static void registerQueryMBeans(java.lang.String sMBeanServerDomain, java.lang.String sQuery, java.lang.String sPrefix, Registry registry)
Note: the MBeanServer that the query runs against is not necessarily the one used by the Registry.
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 usedsQuery
- a JMX query string that will be used to find the MBeanssPrefix
- a target location to prepend to converted MBean namesregistry
- a Registry to register the JMX query results withpublic static void registerCacheMBean(NamedCache cache, java.lang.String sContext)
cache
- the NamedCache object to registersContext
- the cache context (tier)public static void registerCacheMBean(CacheService service, java.lang.String sCacheName, java.lang.String sContext, java.util.Map map)
service
- the CacheService that the cache belongs tosCacheName
- the cache namesContext
- the cache context (tier)map
- the map object to registerpublic static void unregisterCacheMBean(CacheService service, java.lang.String sCacheName)
service
- the CacheService that the cache belongs tosCacheName
- the cache namepublic static void unregisterCacheMBean(java.lang.String sCacheName, java.lang.String sContext)
sCacheName
- the cache namesContext
- the cache context (tier)public static double calculateAverage(javax.management.MBeanServer server, java.lang.String sPattern, java.lang.String sAttribute)
server
- the MBeanServersPattern
- the name patternsAttribute
- the attribute namepublic static MBeanReference ensureSingletonMBean(java.lang.String sName)
sName
- an MBean namepublic static javax.management.remote.JMXConnectorServer startRmiConnector(java.lang.String sHost, int nRegPort, int nConPort, javax.management.MBeanServer mbs, java.util.Map mapEnv)
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.6 Agent Documentation.
sHost
- host to bind tonRegPort
- port used for the JMX RMI registrynConPort
- port used for the JMX RMI connectionmbs
- MBeanServer
that contains Coherence MBeansmapEnv
- a set of attributes to control the new connector server's behaviorJMXConnectorServerFactory
public static java.lang.Object startHttpConnector(int nPort, javax.management.MBeanServer mbs)
nPort
- port to bind the HTTP server tombs
- MBeanServer that this HTTP server will exposepublic static java.lang.String quote(java.lang.String s)
s
- the string to be quotedpublic static java.lang.String unquote(java.lang.String s)
quote(java.lang.String)
method to the original string.s
- the string to be unquotedjava.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 (")public static boolean isQuoteRequired(java.lang.String s)
s
- the string to be quotedquote(java.lang.String)
method needs to be calledpublic static java.lang.String quoteCanonical(java.lang.String sCanonical) throws javax.management.MalformedObjectNameException
KeyPropertyString
or a quoted canonical name.sCanonical
- a string to be quotedjavax.management.MalformedObjectNameException
- if the name is invalidpublic static boolean hasDomain(java.lang.String sCanonical)
sCanonical
- a canonical MBean name or key property listpublic static java.lang.String stripDomain(java.lang.String sCanonical)
sCanonical
- a canonical MBean name or key property listpublic static int compareKeyList(javax.management.ObjectName oname1, javax.management.ObjectName oname2)
global MBean names
forcing numeric comparison of the node ID while using string comparison on all other key properties. For example, the following order is enforced:
Coherence:type=Node,nodeId=2 < Coherence:type=Node,nodeId=10 Coherence:type=Cache,nodeId=20 < Coherence:type=Node,nodeId=1If the key sets are different the lexicographical comparison is used.
oname1
- the first ObjectName to be comparedoname2
- the second ObjectName to be comparedpublic static java.lang.String getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanInfo info)
clzMBeanIface
- the MBean interfaceinfo
- the MBeanInfo
for the MBeanpublic static java.lang.String getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanAttributeInfo info)
Description
annotation on the getter method for the attribute. If a description is not found on the getter method, the setter will be checked.clzMBeanIface
- the MBean interfaceinfo
- the MBeanAttributeInfo
for the attributepublic static java.lang.String getDescription(java.lang.Class clzMBeanIface, javax.management.MBeanOperationInfo info)
MBeanOperationInfo
by finding a Description
annotation on the corresponding method.clzMBeanIface
- the MBean interfaceinfo
- the MBeanOperationInfo
public static java.lang.String getParameterName(java.lang.Class clzMBeanIface, javax.management.MBeanOperationInfo infoOp, javax.management.MBeanParameterInfo infoParam, int iParam)
Description
annotation on the corresponding method.clzMBeanIface
- the MBean interfaceinfoOp
- the MBeanOperationInfo
for the opinfoParam
- the MBeanParameterInfo
for the parameteriParam
- zero-based sequence number of the parameterprotected static java.lang.annotation.Annotation getParameterAnnotation(java.lang.reflect.Method meth, int iParam, java.lang.Class clzAnno)
Annotation
for a parameter to a method.meth
- the Method
iParam
- zero-based index of the parameterclzAnno
- the Annotation Class
to be retrievedAnnotation
is foundprotected static java.lang.reflect.Method findMethod(java.lang.Class clzMBean, javax.management.MBeanOperationInfo op)
Method
for the specified MBeanOperationInfo
in the specified MBean class or interface.clzMBean
- the MBean class (interface)op
- the MBeanOperationInfo
Method
or null if no method is foundprotected static java.lang.reflect.Method findMethod(java.lang.Class clz, java.lang.String sName, java.lang.String[] asParamTypes)
Method
with the specified name and parameter types in the specified class.clz
- the class (interface)sName
- the Method
nameasParamTypes
- the array of Strings representing parameter typesMethod
or null if no method is found
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |