Class 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:
    Introduction to Oracle Coherence Management
    • Field Detail

      • SERVICE

        public static final String SERVICE
        The "service" key in the ObjectName.
      • 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:
        Constant Field Values
    • Constructor Detail

      • MBeanAccessor

        public MBeanAccessor()
        Default Constructor.
      • MBeanAccessor

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

      • 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
      • update

        public Map<String,​Map<String,​Object>> update​(MBeanAccessor.QueryBuilder.ParsedQuery query,
                                                                 Map<String,​Object> mapAttributes)
        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)
      • 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