Search in sources :

Example 6 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 synchronized void removedService(ServiceReference reference, Object service) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (plugin != null) {
        ControlServlet controller = ((WebConsolePlugin) plugin).controller;
        if (controller != null) {
            controller.removedService(reference);
        }
    }
    if (tracker.size() == 0 && plugin != null) {
        plugin.unregister();
        this.plugin = null;
        // unregister configuration printer too
        ServiceRegistration reg = printerRegistration;
        if (reg != null) {
            reg.unregister();
            printerRegistration = null;
        }
    }
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 7 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 synchronized Object addingService(ServiceReference reference) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (plugin == null) {
        this.plugin = plugin = new WebConsolePlugin(tracker).register(context);
        // register configuration printer
        final Dictionary /*<String, Object>*/
        props = new Hashtable();
        // $NON-NLS-1$
        props.put(InventoryPrinter.NAME, "upnp");
        // $NON-NLS-1$
        props.put(InventoryPrinter.TITLE, "UPnP Devices");
        props.put(InventoryPrinter.FORMAT, new String[] { Format.TEXT.toString(), Format.JSON.toString() });
        printerRegistration = context.registerService(InventoryPrinter.SERVICE, new ConfigurationPrinterImpl(tracker), props);
    }
    return context.getService(reference);
}
Also used : Dictionary(java.util.Dictionary) Hashtable(java.util.Hashtable) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 8 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(final ServiceReference<ServiceComponentRuntime> reference, final ServiceComponentRuntime service) {
    SimpleWebConsolePlugin plugin = this.plugin;
    if (tracker.getTrackingCount() == 0 && plugin != null) {
        // remove service
        plugin.unregister();
        this.plugin = null;
        // unregister configuration printer too
        ServiceRegistration<?> reg = printerRegistration;
        if (reg != null) {
            reg.unregister();
            printerRegistration = null;
        }
        // unregister info provider too
        reg = infoRegistration;
        if (reg != null) {
            reg.unregister();
            infoRegistration = null;
        }
    }
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

Example 9 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 10 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;
    Object ret = null;
    if (plugin == null) {
        ret = context.getService(reference);
        this.plugin = plugin = new WebConsolePlugin(context, ret).register(context);
    }
    return ret;
}
Also used : SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin) SimpleWebConsolePlugin(org.apache.felix.webconsole.SimpleWebConsolePlugin)

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