Search in sources :

Example 1 with DiagnosticDumpMBeanImpl

use of org.apache.karaf.diagnostic.management.internal.DiagnosticDumpMBeanImpl in project karaf by apache.

the class Activator method start.

@Override
public void start(final BundleContext context) throws Exception {
    registrations = new ArrayList<>();
    registrations.add(context.registerService(DumpProvider.class, new LogDumpProvider(context), null));
    featuresServiceTracker = new SingleServiceTracker<>(context, FeaturesService.class, (oldFs, newFs) -> {
        if (featuresProviderRegistration != null) {
            featuresProviderRegistration.unregister();
            featuresProviderRegistration = null;
        }
        if (newFs != null) {
            featuresProviderRegistration = context.registerService(DumpProvider.class, new FeaturesDumpProvider(newFs), null);
        }
    });
    featuresServiceTracker.open();
    final DiagnosticDumpMBeanImpl diagnostic = new DiagnosticDumpMBeanImpl();
    diagnostic.setBundleContext(context);
    Hashtable<String, Object> props = new Hashtable<>();
    props.put("jmx.objectname", "org.apache.karaf:type=diagnostic,name=" + System.getProperty("karaf.name"));
    mbeanRegistration = context.registerService(getInterfaceNames(diagnostic), diagnostic, props);
}
Also used : BundleActivator(org.osgi.framework.BundleActivator) DiagnosticDumpMBeanImpl(org.apache.karaf.diagnostic.management.internal.DiagnosticDumpMBeanImpl) DumpProvider(org.apache.karaf.diagnostic.core.DumpProvider) FeaturesService(org.apache.karaf.features.FeaturesService) BundleContext(org.osgi.framework.BundleContext) ArrayList(java.util.ArrayList) LogDumpProvider(org.apache.karaf.diagnostic.common.LogDumpProvider) FeaturesDumpProvider(org.apache.karaf.diagnostic.common.FeaturesDumpProvider) List(java.util.List) SingleServiceTracker(org.apache.karaf.util.tracker.SingleServiceTracker) ServiceTracker(org.osgi.util.tracker.ServiceTracker) Hashtable(java.util.Hashtable) ServiceRegistration(org.osgi.framework.ServiceRegistration) LogDumpProvider(org.apache.karaf.diagnostic.common.LogDumpProvider) Hashtable(java.util.Hashtable) FeaturesService(org.apache.karaf.features.FeaturesService) DiagnosticDumpMBeanImpl(org.apache.karaf.diagnostic.management.internal.DiagnosticDumpMBeanImpl) DumpProvider(org.apache.karaf.diagnostic.core.DumpProvider) LogDumpProvider(org.apache.karaf.diagnostic.common.LogDumpProvider) FeaturesDumpProvider(org.apache.karaf.diagnostic.common.FeaturesDumpProvider) FeaturesDumpProvider(org.apache.karaf.diagnostic.common.FeaturesDumpProvider)

Aggregations

ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 List (java.util.List)1 FeaturesDumpProvider (org.apache.karaf.diagnostic.common.FeaturesDumpProvider)1 LogDumpProvider (org.apache.karaf.diagnostic.common.LogDumpProvider)1 DumpProvider (org.apache.karaf.diagnostic.core.DumpProvider)1 DiagnosticDumpMBeanImpl (org.apache.karaf.diagnostic.management.internal.DiagnosticDumpMBeanImpl)1 FeaturesService (org.apache.karaf.features.FeaturesService)1 SingleServiceTracker (org.apache.karaf.util.tracker.SingleServiceTracker)1 BundleActivator (org.osgi.framework.BundleActivator)1 BundleContext (org.osgi.framework.BundleContext)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 ServiceTracker (org.osgi.util.tracker.ServiceTracker)1