Search in sources :

Example 1 with AccessControlMBean

use of org.apache.geode.management.internal.security.AccessControlMBean in project geode by apache.

the class ManagementAgent method registerAccessControlMBean.

private void registerAccessControlMBean() {
    try {
        AccessControlMBean acc = new AccessControlMBean();
        ObjectName accessControlMBeanON = new ObjectName(ResourceConstants.OBJECT_NAME_ACCESSCONTROL);
        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
        Set<ObjectName> names = platformMBeanServer.queryNames(accessControlMBeanON, null);
        if (names.isEmpty()) {
            try {
                platformMBeanServer.registerMBean(acc, accessControlMBeanON);
                logger.info("Registered AccessControlMBean on " + accessControlMBeanON);
            } catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) {
                throw new GemFireConfigException("Error while configuring accesscontrol for jmx resource", e);
            }
        }
    } catch (MalformedObjectNameException e) {
        throw new GemFireConfigException("Error while configuring accesscontrol for jmx resource", e);
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) GemFireConfigException(org.apache.geode.GemFireConfigException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) AccessControlMBean(org.apache.geode.management.internal.security.AccessControlMBean) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName) MBeanServer(javax.management.MBeanServer)

Aggregations

InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 MBeanServer (javax.management.MBeanServer)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)1 ObjectName (javax.management.ObjectName)1 GemFireConfigException (org.apache.geode.GemFireConfigException)1 AccessControlMBean (org.apache.geode.management.internal.security.AccessControlMBean)1