Search in sources :

Example 1 with ServiceStateMBean

use of org.osgi.jmx.framework.ServiceStateMBean in project aries by apache.

the class Activator method start.

public void start(BundleContext context) throws Exception {
    ctx = context;
    logger = new Logger(ctx);
    Filter filter = getFilter(context, PACKAGE_ADMIN, START_LEVEL, PERMISSION_ADMIN, CONFIG_ADMIN, USER_ADMIN, PROVISIONING_SERVICE);
    tracker = new ServiceTracker(context, filter, this);
    tracker.open();
    stateConfig = StateConfig.register(context);
    registerMBean(ServiceStateMBean.class.getName(), new Factory<ServiceStateMBean>() {

        public ServiceStateMBean create() {
            return new ServiceState(ctx, stateConfig, logger);
        }
    }, ServiceStateMBean.OBJECTNAME, _serviceStateMbean);
}
Also used : ServiceState(org.apache.aries.jmx.framework.ServiceState) Filter(org.osgi.framework.Filter) ServiceTracker(org.osgi.util.tracker.ServiceTracker) ServiceStateMBean(org.osgi.jmx.framework.ServiceStateMBean) Logger(org.apache.aries.jmx.Logger)

Example 2 with ServiceStateMBean

use of org.osgi.jmx.framework.ServiceStateMBean 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)

Aggregations

ServiceStateMBean (org.osgi.jmx.framework.ServiceStateMBean)2 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)1 Logger (org.apache.aries.jmx.Logger)1 ServiceState (org.apache.aries.jmx.framework.ServiceState)1 RegistrableStandardEmitterMBean (org.apache.aries.jmx.util.shared.RegistrableStandardEmitterMBean)1 Filter (org.osgi.framework.Filter)1 ServiceTracker (org.osgi.util.tracker.ServiceTracker)1