Package 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMBeanHelper.QueryExpFilter-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Field Summary
Fields Modifier and Type Field Description static Map<String,SimpleType>SCALAR_SIMPLETYPESA map of scalar SimpleTypes (classes) keyed by the corresponding JMX signatures.static Map<String,Class>SCALAR_TYPESA map of scalar types (classes) keyed by the corresponding JMX signatures.
-
Constructor Summary
Constructors Constructor Description MBeanHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckReadOnly(String sOperation)Checks whether "write" operations are allowed.static intcompareKeyList(ObjectName oname1, ObjectName oname2)Compare twoglobal MBean namesforcing numeric comparison of the node ID while using string comparison on all other key properties.static DynamicMBeancreateMapAdapterMbean(Map<String,String> mapDescr, Map<String,?> mapValue)Create a DynamicMBean driven by maps containing attribute descriptions and values.static StringensureDomain(String sCanonical)Ensure the Canonical name is prefixed with the domain name.static MBeanReferenceensureSingletonMBean(String sName)Ensure that there is an instance of a local MBean of the specified type registered with the default MBeansServer.static JMXServiceURLfindJMXServiceUrl(String sDefaultDomain, com.tangosol.internal.net.management.GatewayDependencies deps)Find the JMXServiceURL for the MBeanConnector used by the Coherence JMX framework.static MBeanServerfindMBeanServer()Find an MBeanServer that Coherence MBeans are registered with.static MBeanServerfindMBeanServer(String sDefaultDomain)Find an MBeanServer that has the specified default domain name.static MBeanServerfindMBeanServer(String sDefaultDomain, com.tangosol.internal.net.management.GatewayDependencies deps)Find an MBeanServer that has the specified default domain name.protected static MethodfindMethod(Class clz, String sName, String... asParamTypes)Find aMethodwith the specified name and parameter types in the specified class.protected static MethodfindMethod(Class clzMBean, MBeanOperationInfo op)Find aMethodfor the specifiedMBeanOperationInfoin the specified MBean class or interface.static StringgetDefaultDomain()Return the default domain name as configured in the Coherence operational configuration descriptor ("default-domain-name" element).static StringgetDescription(Class<?> clzMBeanIface, MBeanInfo info)Retrieve the description for the MBean from the MBean interface annotation.static StringgetDescription(Class clzMBeanIface, MBeanAttributeInfo info)Retrieve a description for a particular attribute by finding aDescriptionannotation on the getter method for the attribute.static StringgetDescription(Class clzMBeanIface, MBeanOperationInfo info)Retrieve a description for the particularMBeanOperationInfoby finding aDescriptionannotation on the corresponding method.static MBeanNotificationInfo[]getNotificationInfo(Class<?> clzMBeanIface)Return anMBeanNotificationInfoif aNotificationannotation is present on the provided MBean interface.protected static <A extends Annotation>
AgetParameterAnnotation(Method meth, int iParam, Class<A> clzAnno)Retrieve anAnnotationfor a parameter to a method.static StringgetParameterName(Class clzMBeanIface, MBeanOperationInfo infoOp, MBeanParameterInfo infoParam, int iParam)Retrieve the parameter name for the specified parameter by finding aDescriptionannotation on the corresponding method.static StringgetSubscriberGroupMBeanName(com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId id, String sTopicName, Service service)Return the MBean name for a subscriber group.static StringgetSubscriberMBeanName(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber subscriber)Return the MBean name for aPagedTopicSubscriber.static StringgetSubscriberMBeanPattern(NamedTopic<?> topic, boolean fLocalOnly)Return the MBean name pattern for all subscribers in a topic.static StringgetSubscriberMBeanPattern(NamedTopic<?> topic, com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId groupId, boolean fLocalOnly)Return the MBean name pattern for all subscribers in a subscriber group for topic.static StringgetTopicMBeanName(NamedTopic<?> topic)Return the MBean name for the topic.static StringgetTopicMBeanPattern()Return the MBean name pattern that will match all topic MBeans.static StringgetTopicMBeanPattern(TopicService service)Return the MBean name pattern that will match all topic MBeans for the service.static booleanhasDomain(String sCanonical)Return true if the Canonical name is prefixed with the domain name.static booleanisNonMemberMBean(String sName)Returnstrueif the specified MBean name is a non-member specific name.static booleanisQuoteRequired(String s)Determine if the string requires quotes.static booleanisQuoteRequired(String s, boolean fKey)Determine if the string requires quotes.static Stringquote(String s)Create an escape-sequence string that allows for special characters to be included in a JMX ObjectName.protected static Stringquote(String s, boolean fKey)Create an escape-sequence string that allows for special characters to be included in a JMX ObjectName.static StringquoteCanonical(String sCanonical)Return a quotedKeyPropertyStringor a quoted canonical name.static voidregisterCacheMBean(CacheService service, String sCacheName, String sContext, Map map)Register the specified map with the cluster registry.static voidregisterCacheMBean(NamedCache cache, String sContext)Register the specified NamedCache with the cluster registry.static voidregisterPagedTopicMBean(PagedTopicService service, String sTopicName)Register the specified PagedTopic with the cluster registry.static voidregisterQueryMBeans(String sMBeanServerDomain, String sQuery, String sPrefix, Registry registry)Find all MBeans matching to the specified query at a local MBeanServer and register them with the specified Registry.static voidregisterSubscriberGroupMBean(PagedTopicService service, com.tangosol.internal.net.topic.impl.paged.model.PagedTopicSubscription subscription)Register the specified PagedTopic subscriber group with the cluster registry.static voidregisterSubscriberMBean(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber<?> subscriber)Register the specified PagedTopic subscriber with the cluster registry.static voidregisterViewMBean(ContinuousQueryCache cache)Register the specified view cache with the cluster registry.static voidregisterViewMBean(CacheService service, ContinuousQueryCache cache)Register the specified view cache with the cluster registry.static StringsafeUnquote(String s)Unquote a string iff given string is quoted otherwise return original string.static ObjectstartHttpConnector(int nPort, MBeanServer mbs)Start a com.sun.jdmk.comm.HtmlAdaptorServer, which is a part of the Sun JMX reference implementation.static JMXConnectorServerstartRmiConnector(String sAddr, int nRegPort, int nConPort, MBeanServer mbs, Map mapEnv)Start aJMXConnectorServer.static StringstripDomain(String sCanonical)Remove the domain prefix from the canonical name if one exists.static Stringunquote(String s)Convert a string returned from thequote(java.lang.String)method to the original string.static voidunregisterCacheMBean(CacheService service, String sCacheName)Unregister all managed objects that are related to the specified cache from the registry.static voidunregisterCacheMBean(CacheService service, String sCacheName, String sContext)Unregister all managed objects that are related to the specified cache from the registry.static voidunregisterCacheMBean(Cluster cluster, String sServiceName, String sCacheName, String sContext)Unregister all managed objects that are related to the specified cache from the registry.static voidunregisterCacheMBean(NamedCache cache, String sContext)Unregister all managed objects related to the given cache name and context from the cluster registry.static voidunregisterCacheMBean(String sCacheName, String sContext)Unregister all managed objects related to the given cache name and context from the cluster registry.static voidunregisterCacheMBean(String sServiceName, String sCacheName, String sContext)Unregister all managed objects that are related to the specified cache from the registry.static voidunregisterPagedTopicMBean(Service service, NamedTopic<?> topic)Unregister all managed objects related to the given topic name from the cluster registry.static voidunregisterPagedTopicMBean(Service service, String sTopicName)Unregister all managed objects related to the given topic name from the cluster registry.static voidunregisterSubscriberGroupMBean(PagedTopicService service, com.tangosol.internal.net.topic.impl.paged.model.PagedTopicSubscription subscription)Unregister all managed objects related to the given topic subscriber group name from the cluster registry.static voidunregisterSubscriberMBean(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber<?> subscriber)Unregister all managed objects related to the given topic subscriber from the cluster registry.static voidunregisterViewMBean(Cluster cluster, String sServiceName, String sCacheName)Unregister all managed objects related to the given view cache and context from the cluster registry.static voidunregisterViewMBean(NamedCache cache)Unregister all managed objects related to the given view cache and context from the cluster registry.-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Field Detail
-
SCALAR_TYPES
public static final Map<String,Class> SCALAR_TYPES
A map of scalar types (classes) keyed by the corresponding JMX signatures.
-
SCALAR_SIMPLETYPES
public static final Map<String,SimpleType> SCALAR_SIMPLETYPES
A map of scalar SimpleTypes (classes) keyed by the corresponding JMX signatures.
-
-
Method Detail
-
getDefaultDomain
public static String getDefaultDomain()
Return the default domain name as configured in the Coherence operational configuration descriptor ("default-domain-name" element).- Returns:
- the default domain name
-
checkReadOnly
public static void checkReadOnly(String sOperation)
Checks whether "write" operations are allowed.- Throws:
SecurityException- if the model is "read-only"
-
findMBeanServer
public static 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 MBeanServer findMBeanServer(String sDefaultDomain)
Find an MBeanServer that has the specified default domain name. If the domain name is not specified, any existing MBeanServer is chosen.- Parameters:
sDefaultDomain- the default domain name- Returns:
- an existing or a new MBeanServer with the specified default domain name
-
findMBeanServer
public static MBeanServer findMBeanServer(String sDefaultDomain, com.tangosol.internal.net.management.GatewayDependencies deps)
Find an MBeanServer that has the specified default domain name. If the domain name is not specified, any existing MBeanServer is chosen.- Parameters:
sDefaultDomain- the default domain namedeps- theGatewayDependenciescontaining the management configuration to use- Returns:
- an existing or a new MBeanServer with the specified default domain name
-
findJMXServiceUrl
public static JMXServiceURL findJMXServiceUrl(String sDefaultDomain, com.tangosol.internal.net.management.GatewayDependencies deps)
Find the JMXServiceURL for the MBeanConnector used by the Coherence JMX framework.- Parameters:
sDefaultDomain- the default domain namedeps- theGatewayDependenciescontaining the management configuration to use- Returns:
- JMXServiceUrl for the MBeanConnector or null if no Connector is running.
-
registerQueryMBeans
public static void registerQueryMBeans(String sMBeanServerDomain, String sQuery, 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 necessarily 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 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 with
-
registerCacheMBean
public static void registerCacheMBean(NamedCache cache, String sContext)
Register the specified NamedCache with the cluster registry.- Parameters:
cache- the NamedCache object to registersContext- the cache context (tier)
-
registerCacheMBean
public static void registerCacheMBean(CacheService service, String sCacheName, String sContext, Map map)
Register the specified map with the cluster registry.- Parameters:
service- the CacheService that the cache belongs tosCacheName- the cache namesContext- the cache context (tier)map- the map object to register
-
registerViewMBean
public static void registerViewMBean(ContinuousQueryCache cache)
Register the specified view cache with the cluster registry.- Parameters:
cache- the ContinuousQueryCache to register
-
registerViewMBean
public static void registerViewMBean(CacheService service, ContinuousQueryCache cache)
Register the specified view cache with the cluster registry.- Parameters:
service- the CacheService that the cache belongs tocache- the cache object to register
-
unregisterViewMBean
public static void unregisterViewMBean(NamedCache cache)
Unregister all managed objects related to the given view cache and context from the cluster registry.- Parameters:
cache- the cache
-
unregisterViewMBean
public static void unregisterViewMBean(Cluster cluster, String sServiceName, String sCacheName)
Unregister all managed objects related to the given view cache and context from the cluster registry.- Parameters:
cluster- the Cluster objectsServiceName- the CacheService that the cache belongs tosCacheName- the cache name
-
unregisterCacheMBean
public static void unregisterCacheMBean(CacheService service, String sCacheName)
Unregister all managed objects that are related to the specified cache from the registry.- Parameters:
service- the CacheService that the cache belongs tosCacheName- the cache name
-
unregisterCacheMBean
public static void unregisterCacheMBean(String sServiceName, String sCacheName, String sContext)
Unregister all managed objects that are related to the specified cache from the registry.- Parameters:
sServiceName- the CacheService namesCacheName- the cache namesContext- the cache context (tier)
-
unregisterCacheMBean
public static void unregisterCacheMBean(CacheService service, String sCacheName, String sContext)
Unregister all managed objects that are related to the specified cache from the registry.- Parameters:
service- the CacheService that the cache belongs tosCacheName- the cache namesContext- the cache context (tier)
-
unregisterCacheMBean
public static void unregisterCacheMBean(Cluster cluster, String sServiceName, String sCacheName, String sContext)
Unregister all managed objects that are related to the specified cache from the registry.- Parameters:
cluster- the Cluster objectsServiceName- the CacheService that the cache belongs tosCacheName- the cache namesContext- the cache context (tier)
-
unregisterCacheMBean
public static void unregisterCacheMBean(String sCacheName, String sContext)
Unregister all managed objects related to the given cache name and context from the cluster registry.- Parameters:
sCacheName- the cache namesContext- the cache context (tier)
-
unregisterCacheMBean
public static void unregisterCacheMBean(NamedCache cache, String sContext)
Unregister all managed objects related to the given cache name and context from the cluster registry.- Parameters:
cache- the cachesContext- the cache context (tier)
-
registerPagedTopicMBean
public static void registerPagedTopicMBean(PagedTopicService service, String sTopicName)
Register the specified PagedTopic with the cluster registry.- Parameters:
service- the PagedTopic Service that the topic belongs tosTopicName- the name of the topic to register
-
unregisterPagedTopicMBean
public static void unregisterPagedTopicMBean(Service service, NamedTopic<?> topic)
Unregister all managed objects related to the given topic name from the cluster registry.- Parameters:
service- the topic servicetopic- the topic
-
unregisterPagedTopicMBean
public static void unregisterPagedTopicMBean(Service service, String sTopicName)
Unregister all managed objects related to the given topic name from the cluster registry.- Parameters:
service- the topic servicesTopicName- the topic name
-
getTopicMBeanName
public static String getTopicMBeanName(NamedTopic<?> topic)
Return the MBean name for the topic. The name returned will be the generic name without the member'snodeIdkey.- Parameters:
topic- the topic to obtain the MBean name for- Returns:
- the MBean name for the topic
-
getTopicMBeanPattern
public static String getTopicMBeanPattern(TopicService service)
Return the MBean name pattern that will match all topic MBeans for the service. The name returned will be the generic name without the member'snodeIdkey.- Parameters:
service- the topic to service- Returns:
- the MBean name for the topic
-
getTopicMBeanPattern
public static String getTopicMBeanPattern()
Return the MBean name pattern that will match all topic MBeans. The name returned will be the generic name without the member'snodeIdkey.- Returns:
- the MBean name for the topic
-
registerSubscriberGroupMBean
public static void registerSubscriberGroupMBean(PagedTopicService service, com.tangosol.internal.net.topic.impl.paged.model.PagedTopicSubscription subscription)
Register the specified PagedTopic subscriber group with the cluster registry.- Parameters:
service- the topic Service that the topic belongs tosubscription- thesubscription
-
unregisterSubscriberGroupMBean
public static void unregisterSubscriberGroupMBean(PagedTopicService service, com.tangosol.internal.net.topic.impl.paged.model.PagedTopicSubscription subscription)
Unregister all managed objects related to the given topic subscriber group name from the cluster registry.- Parameters:
service- the topic Service that the topic belongs tosubscription- thesubscription
-
getSubscriberGroupMBeanName
public static String getSubscriberGroupMBeanName(com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId id, String sTopicName, Service service)
Return the MBean name for a subscriber group. The name returned will be the generic name without the member'snodeIdkey.- Parameters:
id- theSubscriberGroupIdsTopicName- the name of the topicservice- the service owning the topic- Returns:
- the MBean name for a subscriber group
-
registerSubscriberMBean
public static void registerSubscriberMBean(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber<?> subscriber)
Register the specified PagedTopic subscriber with the cluster registry.- Parameters:
subscriber- the topic subscriber
-
unregisterSubscriberMBean
public static void unregisterSubscriberMBean(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber<?> subscriber)
Unregister all managed objects related to the given topic subscriber from the cluster registry.- Parameters:
subscriber- the topic subscriber
-
getSubscriberMBeanName
public static String getSubscriberMBeanName(com.tangosol.internal.net.topic.impl.paged.PagedTopicSubscriber subscriber)
Return the MBean name for aPagedTopicSubscriber.- Parameters:
subscriber- thePagedTopicSubscriber- Returns:
- the MBean name for a
PagedTopicSubscriber
-
getSubscriberMBeanPattern
public static String getSubscriberMBeanPattern(NamedTopic<?> topic, boolean fLocalOnly)
Return the MBean name pattern for all subscribers in a topic.- Parameters:
topic- theNamedTopic- Returns:
- the MBean name pattern for all subscribers in a topic
-
getSubscriberMBeanPattern
public static String getSubscriberMBeanPattern(NamedTopic<?> topic, com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId groupId, boolean fLocalOnly)
Return the MBean name pattern for all subscribers in a subscriber group for topic.- Parameters:
topic- theNamedTopic- Returns:
- the MBean name pattern for all subscribers in a subscriber group for a topic
-
ensureSingletonMBean
public static MBeanReference ensureSingletonMBean(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
-
createMapAdapterMbean
public static DynamicMBean createMapAdapterMbean(Map<String,String> mapDescr, Map<String,?> mapValue)
Create a DynamicMBean driven by maps containing attribute descriptions and values.- Parameters:
mapDescr- Map<String, String> keyed by the attribute names with values being attribute descriptionsmapValue- Map<String, Object> keyed by the attribute names with values being attribute values- Returns:
- a DynamicMBean
-
startRmiConnector
public static JMXConnectorServer startRmiConnector(String sAddr, int nRegPort, int nConPort, MBeanServer mbs, Map mapEnv)
Start aJMXConnectorServer. 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.
- Parameters:
sAddr- host to bind tonRegPort- port used for the JMX RMI registrynConPort- port used for the JMX RMI connectionmbs-MBeanServerthat contains Coherence MBeansmapEnv- 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 Object startHttpConnector(int nPort, 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 tombs- MBeanServer that this HTTP server will expose- Returns:
- an HtmlAdaptorServer that has been started
-
quote
public static String quote(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
-
quote
protected static String quote(String s, boolean fKey)
Create an escape-sequence string that allows for special characters to be included in a JMX ObjectName.- Parameters:
s- the string to be quotedfKey- true if a key in the ObjectName is being quoted- Returns:
- the quoted string
- Since:
- 12.2.1.4
-
safeUnquote
public static String safeUnquote(String s)
Unquote a string iff given string is quoted otherwise return original string.- Parameters:
s- the string- Returns:
- the unquoted string
- Since:
- 12.2.1.4
-
unquote
public static String unquote(String s)
Convert a string returned from thequote(java.lang.String)method to the original string.- Parameters:
s- the string to be unquoted- Returns:
- the unquoted string
- Throws:
IllegalArgumentException- if the passed string could not have been returned by thequote(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(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
-
isQuoteRequired
public static boolean isQuoteRequired(String s, boolean fKey)
Determine if the string requires quotes.- Parameters:
s- the string to be quotedfKey- true if a key in the ObjectName is being quoted- Returns:
- true iff the
quote(java.lang.String)method needs to be called - Since:
- Coherence 3.4
-
quoteCanonical
public static String quoteCanonical(String sCanonical) throws MalformedObjectNameException
Return a quotedKeyPropertyStringor a quoted canonical name. Wildcard and AnyCharacter (* and ? respectively) are not escaped when present on the value of a key value pair.- Parameters:
sCanonical- a string to be quoted- Returns:
- a quoted and escape-sequence string
- Throws:
MalformedObjectNameException- if the name is invalid- Since:
- Coherence 3.4
-
hasDomain
public static boolean hasDomain(String sCanonical)
Return true if the Canonical name is prefixed with the domain name.- Parameters:
sCanonical- a canonical MBean name or key property list- Returns:
- true iff the name contains the domain prefix
- Since:
- Coherence 3.6
-
ensureDomain
public static String ensureDomain(String sCanonical)
Ensure the Canonical name is prefixed with the domain name.- Parameters:
sCanonical- a canonical MBean name or key property list- Returns:
- a Canonical name that is prefixed with the domain name.
- Since:
- Coherence 12.2.1.4
-
stripDomain
public static String stripDomain(String sCanonical)
Remove the domain prefix from the canonical name if one exists.- Parameters:
sCanonical- a canonical MBean name or key property list- Returns:
- the canonical name stripped of the domain prefix
- Since:
- Coherence 3.6
-
compareKeyList
public static int compareKeyList(ObjectName oname1, ObjectName oname2)
Compare twoglobal MBean namesforcing 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=1
If the key sets are different the lexicographical comparison is used.- Parameters:
oname1- the first ObjectName to be comparedoname2- the second ObjectName to be compared- Returns:
- a negative integer, zero, or a positive integer as the first name is less than, equal to, or greater than the second one
- Since:
- Coherence 3.6
-
getDescription
public static String getDescription(Class<?> clzMBeanIface, MBeanInfo info)
Retrieve the description for the MBean from the MBean interface annotation.- Parameters:
clzMBeanIface- the MBean interfaceinfo- theMBeanInfofor the MBean- Returns:
- the MBean description
- Since:
- Coherence 12.1.2
-
getDescription
public static String getDescription(Class clzMBeanIface, MBeanAttributeInfo info)
Retrieve a description for a particular attribute by finding aDescriptionannotation on the getter method for the attribute. If a description is not found on the getter method, the setter will be checked.- Parameters:
clzMBeanIface- the MBean interfaceinfo- theMBeanAttributeInfofor the attribute- Returns:
- the description for an attribute
- Since:
- Coherence 12.1.2
-
getDescription
public static String getDescription(Class clzMBeanIface, MBeanOperationInfo info)
Retrieve a description for the particularMBeanOperationInfoby finding aDescriptionannotation on the corresponding method.- Parameters:
clzMBeanIface- the MBean interfaceinfo- theMBeanOperationInfo- Returns:
- the description for an operation
- Since:
- Coherence 12.1.2
-
getParameterName
public static String getParameterName(Class clzMBeanIface, MBeanOperationInfo infoOp, MBeanParameterInfo infoParam, int iParam)
Retrieve the parameter name for the specified parameter by finding aDescriptionannotation on the corresponding method.- Parameters:
clzMBeanIface- the MBean interfaceinfoOp- theMBeanOperationInfofor the opinfoParam- theMBeanParameterInfofor the parameteriParam- zero-based sequence number of the parameter- Returns:
- the name to use for the given parameter
- Since:
- Coherence 12.1.2
-
getNotificationInfo
public static MBeanNotificationInfo[] getNotificationInfo(Class<?> clzMBeanIface)
Return anMBeanNotificationInfoif aNotificationannotation is present on the provided MBean interface.- Parameters:
clzMBeanIface- the MBean interface- Returns:
- an array of MBeanNotificationInfo of size 0 or 1 based on the presence of a Notification annotation.
-
getParameterAnnotation
protected static <A extends Annotation> A getParameterAnnotation(Method meth, int iParam, Class<A> clzAnno)
Retrieve anAnnotationfor a parameter to a method.- Type Parameters:
A- the Annotation sub type- Parameters:
meth- theMethodiParam- zero-based index of the parameterclzAnno- the AnnotationClassto be retrieved- Returns:
- the annotation or null if no
Annotationis found
-
findMethod
protected static Method findMethod(Class clzMBean, MBeanOperationInfo op)
Find aMethodfor the specifiedMBeanOperationInfoin the specified MBean class or interface.- Parameters:
clzMBean- the MBean class (interface)op- theMBeanOperationInfo- Returns:
- the
Methodor null if no method is found
-
findMethod
protected static Method findMethod(Class clz, String sName, String... asParamTypes)
Find aMethodwith the specified name and parameter types in the specified class.
-
isNonMemberMBean
public static boolean isNonMemberMBean(String sName)
Returnstrueif the specified MBean name is a non-member specific name.- Parameters:
sName- the MBean name to test- Returns:
trueif the specified MBean name is a non-member specific name
-
-