Class MBeanAccessor

java.lang.Object
com.tangosol.net.management.MBeanAccessor

public class MBeanAccessor extends Object
MBeanAccessor provides a means to access JMX MBeans via the Coherence Management Server (a single MBeanServer with an aggregated view of MBeans for the entire cluster).

This API provides a means to query MBeans, get and update MBean attributes, and invoke MBean operations. Ultimately this allows a client to use Coherence's transport to communicate with the MBeanServer to interrogate MBeans.

Since:
12.2.1.4.0
Author:
sr/hr
See Also:
  • Field Details

    • f_mbeanServerProxy

      protected final MBeanServerProxy f_mbeanServerProxy
      The MBeanServerProxy to be used for MBean operations.
    • NAME

      public static final String NAME
      The "name" key in the ObjectName.
      See Also:
    • TYPE

      public static final String TYPE
      The "type" key in the ObjectName.
      See Also:
    • SERVICE

      public static final String SERVICE
      The "service" key in the ObjectName.
    • TIER

      public static final String TIER
      The "tier" key in the ObjectName.
      See Also:
    • NODE_ID

      public static final String NODE_ID
      The "nodeId" key in the ObjectName.
    • MEMBER

      public static final String MEMBER
      The "member" key in the ObjectName.
    • CLUSTER

      public static final String CLUSTER
      The "cluster" key in the ObjectName.
    • STORAGE_MANAGER_QUERY

      public static final String STORAGE_MANAGER_QUERY
      MBean query to filter out StorageManager MBean of a specific cache and service, running on a specific node.
      See Also:
  • Constructor Details

    • MBeanAccessor

      public MBeanAccessor()
      Default Constructor.
    • MBeanAccessor

      public MBeanAccessor(MBeanServerProxy mBeanServerProxy)
      Create an instance of MBeanAccessor.
      Parameters:
      mBeanServerProxy - the MBeanServerProxy to be used
  • Method Details

    • getAttributes

      Return all the attributes that match the query expressed by the provided MBeanAccessor.QueryBuilder.

      Note: the return type is keyed by the full ObjectName registered with the MBeanServer and a Map of attribute name to value

      Parameters:
      query - the MBeanAccessor.QueryBuilder.ParsedQuery to be used to determine applicable MBeans
      Returns:
      a Map keyed by the full ObjectName registered with the MBeanServer and a Map of attribute name to value
    • getAttributes

      public Map<String,Map<String,Object>> getAttributes(MBeanAccessor.QueryBuilder.ParsedQuery query, Filter<MBeanAttributeInfo> filter, boolean fAddStorageMBeanAttributes)
      Return all the attributes that match the query expressed by the provided MBeanAccessor.QueryBuilder.

      Note: the return type is keyed by the full ObjectName registered with the MBeanServer and a Map of attribute name to value

      Parameters:
      query - the MBeanAccessor.QueryBuilder.ParsedQuery to be used to determine applicable MBeans
      filter - server side filter for what attributes to return
      fAddStorageMBeanAttributes - add storage MBean attributes to CacheMBean tier="back" attributes.
      Returns:
      a Map keyed by the full ObjectName registered with the MBeanServer and a Map of attribute name to value
    • invoke

      public Map<String,Object> invoke(MBeanAccessor.QueryBuilder.ParsedQuery query, String sOperationName, Object[] aoArguments, String[] asSignature)
      Invoke a JMX MBean operation on one or many MBeans determined by the provided MBeanAccessor.QueryBuilder.
      Parameters:
      query - the MBeanAccessor.QueryBuilder.ParsedQuery to be used to determine applicable MBeans
      sOperationName - the name of the operation
      aoArguments - the arguments of the operation
      asSignature - the signature of the operation
      Returns:
      a Map keyed by the full ObjectName registered with the MBeanServer and the value returned by invoking the operation
    • update

      Update all JMX MBeans determined by evaluating the provided MBeanAccessor.QueryBuilder. All attributes in the provided map will be updated on the corresponding MBean(s) iff the attribute is present.

      A Set of ObjectNames corresponding to the updated MBeans is returned. These MBeans have been updated with the matching attributes provided to this update method. Attributes not present on the targeted MBean are silently ignored unless there are no attributes that match and therefore will be absent from the returned set of ObjectNames.

      Parameters:
      query - the MBeanAccessor.QueryBuilder.ParsedQuery to be used to determine applicable MBeans
      mapAttributes - the attributes to update
      Returns:
      a map keyed by ObjectNames updated with the map of attributes that were updated (based on the attributes present on the MBean)
    • queryKeys

      Return a list of MBean ObjectNames determined by the provided MBeanAccessor.QueryBuilder.
      Parameters:
      query - the MBeanAccessor.QueryBuilder.ParsedQuery to be used to determine applicable MBeans
      Returns:
      the Set of MBean ObjectNames
    • aggregate

      public Map<String,Object> aggregate(MBeanAccessor.QueryBuilder.ParsedQuery query, String sLocator, String sAttribute, String sCollector)
      Process the request for MBean attributes.

      The requested MBean solely depends on the 'type' input. This may be one of the values specified in the mbean types constant.

      The processing can be modified in three ways:

      1. reducing the data (querying)
      2. choosing the collector implementation (aggregating)
      3. select the attributes to return
      The data can be reduced by specifying a context sensitive name. This name is either the cache name, service name or a concatenation of service name and cache name delimited by '!'. In addition, either a regular expression evaluated against nodeIds or specifying a role name is supported to reduce the MBeans to interrogate.

      If the data is not reduced to a single MBean some attribute level aggregation is applied to the MBeans. By default this aggregation is a list, however each attribute may specify its own default as defined in the service or cache enums.

      Either all attributes are returned or a single attribute based upon the absence or presence, respectively, of the attribute in the URI.

      Parameters:
      query - the MBeanAccessor.QueryBuilder to be used to generate MBean query
      sLocator - either a regex to be applied against nodeids or a role name
      sAttribute - the attribute to return
      sCollector - the collector to use instead of the default
      Returns:
      a Map of attribute name to attribute value; the attribute value may be the result of an aggregation based upon the request