Search in sources :

Example 96 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class ServiceStateMBeanHandler method open.

/**
 * @see org.apache.aries.jmx.MBeanHandler#open()
 */
public void open() {
    serviceStateMBean = new ServiceState(bundleContext, stateConfig, logger);
    try {
        mbean = new RegistrableStandardEmitterMBean(serviceStateMBean, ServiceStateMBean.class);
    } catch (NotCompliantMBeanException e) {
        logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + ServiceStateMBean.class.getName(), e);
    }
    agentContext.registerMBean(this);
}
Also used : ServiceStateMBean(org.osgi.jmx.framework.ServiceStateMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) RegistrableStandardEmitterMBean(org.apache.aries.jmx.util.shared.RegistrableStandardEmitterMBean)

Example 97 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class JMXAgentImpl method registerMBeans.

/**
 * @see org.apache.aries.jmx.agent.JMXAgent#registerMBeans(javax.management.MBeanServer)
 */
public synchronized void registerMBeans(final MBeanServer server) {
    for (MBeanHandler mbeanHandler : mbeansHandlers.keySet()) {
        if (mbeansHandlers.get(mbeanHandler) == Boolean.TRUE) {
            String name = mbeanHandler.getName();
            StandardMBean mbean = mbeanHandler.getMbean();
            if (mbean != null) {
                try {
                    logger.log(LogService.LOG_INFO, "Registering " + mbean.getMBeanInterface().getName() + " to MBeanServer " + server + " with name " + name);
                    server.registerMBean(mbean, new ObjectName(name));
                } catch (InstanceAlreadyExistsException e) {
                    logger.log(LogService.LOG_ERROR, "MBean is already registered", e);
                } catch (MBeanRegistrationException e) {
                    logger.log(LogService.LOG_ERROR, "Can't register MBean", e);
                } catch (NotCompliantMBeanException e) {
                    logger.log(LogService.LOG_ERROR, "MBean is not compliant MBean", e);
                } catch (MalformedObjectNameException e) {
                    logger.log(LogService.LOG_ERROR, "Try to register with no valid objectname", e);
                } catch (NullPointerException e) {
                    logger.log(LogService.LOG_ERROR, "Name of objectname can't be null", e);
                }
            }
        }
    }
    mbeanServers.put(server, Boolean.TRUE);
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) StandardMBean(javax.management.StandardMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ConfigurationAdminMBeanHandler(org.apache.aries.jmx.cm.ConfigurationAdminMBeanHandler) ProvisioningServiceMBeanHandler(org.apache.aries.jmx.provisioning.ProvisioningServiceMBeanHandler) MBeanHandler(org.apache.aries.jmx.MBeanHandler) PackageStateMBeanHandler(org.apache.aries.jmx.framework.PackageStateMBeanHandler) PermissionAdminMBeanHandler(org.apache.aries.jmx.permissionadmin.PermissionAdminMBeanHandler) BundleStateMBeanHandler(org.apache.aries.jmx.framework.BundleStateMBeanHandler) UserAdminMBeanHandler(org.apache.aries.jmx.useradmin.UserAdminMBeanHandler) FrameworkMBeanHandler(org.apache.aries.jmx.framework.FrameworkMBeanHandler) BundleWiringStateMBeanHandler(org.apache.aries.jmx.framework.wiring.BundleWiringStateMBeanHandler) ServiceStateMBeanHandler(org.apache.aries.jmx.framework.ServiceStateMBeanHandler) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName)

Example 98 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class JMXAgentImpl method registerMBean.

/**
 * @see org.apache.aries.jmx.agent.JMXAgent#registerMBean(org.apache.aries.jmx.MBeanHandler)
 */
public synchronized void registerMBean(final MBeanHandler mBeanHandler) {
    for (MBeanServer server : mbeanServers.keySet()) {
        String name = mBeanHandler.getName();
        StandardMBean mbean = mBeanHandler.getMbean();
        try {
            logger.log(LogService.LOG_INFO, "Registering " + mbean.getMBeanInterface().getName() + " to MBeanServer " + server + " with name " + name);
            server.registerMBean(mbean, new ObjectName(name));
        } catch (InstanceAlreadyExistsException e) {
            logger.log(LogService.LOG_ERROR, "MBean is already registered", e);
        } catch (MBeanRegistrationException e) {
            logger.log(LogService.LOG_ERROR, "Can't register MBean", e);
        } catch (NotCompliantMBeanException e) {
            logger.log(LogService.LOG_ERROR, "MBean is not compliant MBean, Stopping registration", e);
            return;
        } catch (MalformedObjectNameException e) {
            logger.log(LogService.LOG_ERROR, "Try to register with no valid objectname, Stopping registration", e);
            return;
        } catch (NullPointerException e) {
            logger.log(LogService.LOG_ERROR, "Name of objectname can't be null, Stopping registration", e);
            return;
        }
    }
    mbeansHandlers.put(mBeanHandler, Boolean.TRUE);
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) StandardMBean(javax.management.StandardMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) MBeanRegistrationException(javax.management.MBeanRegistrationException) MBeanServer(javax.management.MBeanServer) ObjectName(javax.management.ObjectName)

Example 99 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class BundleStateMBeanHandler method open.

/**
 * @see org.apache.aries.jmx.MBeanHandler#open()
 */
public void open() {
    packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
    PackageAdmin packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
    startLevelRef = bundleContext.getServiceReference(StartLevel.class.getName());
    StartLevel startLevel = (StartLevel) bundleContext.getService(startLevelRef);
    bundleStateMBean = new BundleState(bundleContext, packageAdmin, startLevel, stateConfig, logger);
    try {
        mbean = new RegistrableStandardEmitterMBean(bundleStateMBean, BundleStateMBean.class);
    } catch (NotCompliantMBeanException e) {
        logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for " + BundleStateMBean.class.getName(), e);
    }
    agentContext.registerMBean(this);
}
Also used : PackageAdmin(org.osgi.service.packageadmin.PackageAdmin) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) RegistrableStandardEmitterMBean(org.apache.aries.jmx.util.shared.RegistrableStandardEmitterMBean) StartLevel(org.osgi.service.startlevel.StartLevel) BundleStateMBean(org.osgi.jmx.framework.BundleStateMBean)

Example 100 with NotCompliantMBeanException

use of javax.management.NotCompliantMBeanException in project aries by apache.

the class FrameworkMBeanHandler method open.

/**
 * @see org.apache.aries.jmx.MBeanHandler#open()
 */
public void open() {
    ServiceReference adminRef = context.getServiceReference(PackageAdmin.class.getCanonicalName());
    PackageAdmin packageAdmin = (PackageAdmin) context.getService(adminRef);
    ServiceReference startLevelRef = context.getServiceReference(StartLevel.class.getCanonicalName());
    StartLevel startLevel = (StartLevel) context.getService(startLevelRef);
    FrameworkMBean framework = new Framework(context, startLevel, packageAdmin);
    try {
        mbean = new StandardMBean(framework, FrameworkMBean.class);
    } catch (NotCompliantMBeanException e) {
        logger.log(LogService.LOG_ERROR, "Not compliant MBean", e);
    }
    agentContext.registerMBean(this);
}
Also used : PackageAdmin(org.osgi.service.packageadmin.PackageAdmin) StandardMBean(javax.management.StandardMBean) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) StartLevel(org.osgi.service.startlevel.StartLevel) FrameworkMBean(org.osgi.jmx.framework.FrameworkMBean) ServiceReference(org.osgi.framework.ServiceReference)

Aggregations

NotCompliantMBeanException (javax.management.NotCompliantMBeanException)106 ObjectName (javax.management.ObjectName)73 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)71 MBeanRegistrationException (javax.management.MBeanRegistrationException)71 MalformedObjectNameException (javax.management.MalformedObjectNameException)59 MBeanServer (javax.management.MBeanServer)39 InstanceNotFoundException (javax.management.InstanceNotFoundException)23 StandardMBean (javax.management.StandardMBean)20 MBeanException (javax.management.MBeanException)8 ReflectionException (javax.management.ReflectionException)8 IOException (java.io.IOException)7 ObjectInstance (javax.management.ObjectInstance)5 AttributeNotFoundException (javax.management.AttributeNotFoundException)4 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)4 ListenerNotFoundException (javax.management.ListenerNotFoundException)4 Logger (org.apache.aries.jmx.Logger)4 MalformedURLException (java.net.MalformedURLException)3 DynamicMBean (javax.management.DynamicMBean)3 IntrospectionException (javax.management.IntrospectionException)3 JMRuntimeException (javax.management.JMRuntimeException)3