Search in sources :

Example 1 with SimpleWebConsolePlugin

use of org.apache.felix.webconsole.SimpleWebConsolePlugin in project felix by apache.

the class Activator method removedService.

/**
 * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
 *      java.lang.Object)
 */
public final void removedService(ServiceReference reference, Object service) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (tracker.getTrackingCount() == 0 && plugin != null) {
        plugin.unregister();
        this.plugin = null;
    }
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 2 with SimpleWebConsolePlugin

use of org.apache.felix.webconsole.SimpleWebConsolePlugin in project felix by apache.

the class Activator method removedService.

/**
 * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
 *      java.lang.Object)
 */
public final void removedService(ServiceReference reference, Object service) {
    SimpleWebConsolePlugin plugin = this.plugin;
    this.plugin = null;
    if (plugin != null) {
        // remove service
        plugin.unregister();
    }
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 3 with SimpleWebConsolePlugin

use of org.apache.felix.webconsole.SimpleWebConsolePlugin in project felix by apache.

the class Activator method addingService.

/**
 * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
 */
public final Object addingService(ServiceReference reference) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (plugin == null) {
        final UserAdmin service = (UserAdmin) context.getService(reference);
        this.plugin = new WebConsolePlugin(service).register(context);
    // printerRegistration = context.registerService(ConfigurationPrinter.SERVICE,
    // new ComponentConfigurationPrinter(service), null);
    }
    return context.getService(reference);
}
Also used : UserAdmin(org.osgi.service.useradmin.UserAdmin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 4 with SimpleWebConsolePlugin

use of org.apache.felix.webconsole.SimpleWebConsolePlugin in project felix by apache.

the class Activator method removedService.

/**
 * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
 *      java.lang.Object)
 */
public final void removedService(ServiceReference reference, Object service) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (tracker.getTrackingCount() == 0 && plugin != null) {
        plugin.unregister();
        this.plugin = null;
    }
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 5 with SimpleWebConsolePlugin

use of org.apache.felix.webconsole.SimpleWebConsolePlugin in project felix by apache.

the class Activator method addingService.

/**
 * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
 */
public final ServiceComponentRuntime addingService(final ServiceReference<ServiceComponentRuntime> reference) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (plugin == null) {
        final ServiceComponentRuntime service = context.getService(reference);
        this.plugin = plugin = new WebConsolePlugin(service).register(context);
        final Dictionary<String, Object> props = new Hashtable<String, Object>();
        final String name = "Declarative Services Components";
        // $NON-NLS-1$
        props.put(InventoryPrinter.NAME, "scr");
        props.put(InventoryPrinter.TITLE, name);
        props.put(InventoryPrinter.FORMAT, new String[] { Format.TEXT.toString(), Format.JSON.toString() });
        printerRegistration = context.registerService(InventoryPrinter.class, new ComponentConfigurationPrinter(service, (WebConsolePlugin) plugin), props);
        infoRegistration = new InfoProvider(context.getBundle(), service).register(context);
    }
    return context.getService(reference);
}
Also used : BundleInfoProvider(org.apache.felix.webconsole.bundleinfo.BundleInfoProvider) Hashtable(java.util.Hashtable) InventoryPrinter(org.apache.felix.inventory.InventoryPrinter) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) ServiceComponentRuntime(org.osgi.service.component.runtime.ServiceComponentRuntime)

Aggregations

SimpleWebConsolePlugin (org.apache.felix.webconsole.SimpleWebConsolePlugin)11 Hashtable (java.util.Hashtable)2 Dictionary (java.util.Dictionary)1 InventoryPrinter (org.apache.felix.inventory.InventoryPrinter)1 BundleInfoProvider (org.apache.felix.webconsole.bundleinfo.BundleInfoProvider)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 ServiceComponentRuntime (org.osgi.service.component.runtime.ServiceComponentRuntime)1 UserAdmin (org.osgi.service.useradmin.UserAdmin)1