Example usage for javax.management AttributeChangeNotificationFilter AttributeChangeNotificationFilter

List of usage examples for javax.management AttributeChangeNotificationFilter AttributeChangeNotificationFilter

Introduction

In this page you can find the example usage for javax.management AttributeChangeNotificationFilter AttributeChangeNotificationFilter.

Prototype

AttributeChangeNotificationFilter

Source Link

Usage

From source file:org.mule.providers.jmx.JmxEndpointBuilder.java

private NotificationFilter createNotificationFilter(String authority, Properties params)
        throws MalformedObjectNameException {

    boolean isConnector = URI_AUTHORITY_CONNECTOR.equals(authority);
    boolean isDelegate = URI_AUTHORITY_MBSDELEGATE.equals(authority);

    if (isDelegate && params.containsKey(URIPROP_FILTER_NOTIFBEANS)) {
        MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter();
        String beansStr = params.getProperty(URIPROP_FILTER_NOTIFBEANS);
        if (beansStr != null) {
            setNotificationMBeans(filter, beansStr.split(";"));
        }/*from   w  w  w.  j  av  a 2s. c  om*/

        setNotificationTypes(filter, params, isDelegate, isConnector);
        return filter;
    }

    if (params.containsKey(URIPROP_FILTER_ATTRIBUTES)) {
        AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter();
        for (String attribute : params.getProperty(URIPROP_FILTER_ATTRIBUTES).split(";")) {
            filter.enableAttribute(attribute);
        }
        return filter;
    }

    if (params.containsKey(URIPROP_FILTER_NOTIFTYPE)) {
        NotificationFilterSupport filter = new NotificationFilterSupport();
        setNotificationTypes(filter, params, isDelegate, isConnector);
        return filter;
    }

    return null;
}

From source file:org.zenoss.jmxnl.NotificationListener.java

public NotificationListener(String url, String scope, String username, String password, String zenossDevice,
        String[] attributeFilters, String connectionRetryInterval)
        throws MalformedURLException, MalformedObjectNameException, NullPointerException {
    this.url = new JMXServiceURL(url);

    if (scope != null) {
        this.scope = new ObjectName(scope);
    } else {/*w  w w .  ja  va 2  s .  c  o  m*/
        this.scope = new ObjectName("*:*");
    }

    environment = new HashMap<String, String[]>();
    if (username != null && password != null) {
        String[] credentials = new String[] { username, password };
        environment.put("jmx.remote.credentials", credentials);
    }

    this.zenossDevice = zenossDevice;

    if (attributeFilters == null) {
        log.debug(url + ": No attribute filters configured");
        attributeFilter = null;
    } else {
        attributeFilter = new AttributeChangeNotificationFilter();
        for (int i = 0; i < attributeFilters.length; i++) {
            log.info(url + ": Registering attribute filter for " + attributeFilters[i]);
            attributeFilter.enableAttribute(attributeFilters[i]);
        }
    }

    this.connectionRetryInterval = connectionRetryInterval;

    connectionEvent = new HashMap<String, String>();
    connectionEvent.put("device", zenossDevice);
    connectionEvent.put("component", "zenjmxnl");
    connectionEvent.put("eventKey", this.url.toString());
    connectionEvent.put("eventClass", "/Status/JMX/Conn");
}