Search in sources :

Example 1 with ServiceComponentRuntime

use of org.osgi.service.component.runtime.ServiceComponentRuntime 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)

Example 2 with ServiceComponentRuntime

use of org.osgi.service.component.runtime.ServiceComponentRuntime in project felix by apache.

the class ComponentTestBase method disableAndCheck.

protected void disableAndCheck(ComponentDescriptionDTO cd) throws InvocationTargetException, InterruptedException {
    ServiceComponentRuntime scr = scrTracker.getService();
    if (scr != null) {
        scr.disableComponent(cd).getValue();
        Assert.assertFalse("Expected component disabled", scr.isComponentEnabled(cd));
    } else {
        throw new NullPointerException("no ServiceComponentRuntime");
    }
}
Also used : ServiceComponentRuntime(org.osgi.service.component.runtime.ServiceComponentRuntime)

Example 3 with ServiceComponentRuntime

use of org.osgi.service.component.runtime.ServiceComponentRuntime in project smarthome by eclipse.

the class MissingServiceAnalyzer method printMissingServiceDetails.

public <T> void printMissingServiceDetails(Class<T> clazz) {
    ServiceReference<ServiceComponentRuntime> scrReference = bundleContext.getServiceReference(ServiceComponentRuntime.class);
    if (scrReference != null) {
        ServiceComponentRuntime scr = bundleContext.getService(scrReference);
        if (scr != null) {
            ps.println("Components implementing " + clazz.getName() + ":");
            printUnsatisfiedServices(scr, clazz.getName(), "");
        }
    } else {
        ps.println("SCR is not started!");
    }
}
Also used : ServiceComponentRuntime(org.osgi.service.component.runtime.ServiceComponentRuntime)

Example 4 with ServiceComponentRuntime

use of org.osgi.service.component.runtime.ServiceComponentRuntime in project felix by apache.

the class ComponentTestBase method enableAndCheck.

protected void enableAndCheck(ComponentDescriptionDTO cd) throws InvocationTargetException, InterruptedException {
    ServiceComponentRuntime scr = scrTracker.getService();
    if (scr != null) {
        scr.enableComponent(cd).getValue();
        Assert.assertTrue("Expected component enabled", scr.isComponentEnabled(cd));
    } else {
        throw new NullPointerException("no ServiceComponentRuntime");
    }
}
Also used : ServiceComponentRuntime(org.osgi.service.component.runtime.ServiceComponentRuntime)

Example 5 with ServiceComponentRuntime

use of org.osgi.service.component.runtime.ServiceComponentRuntime in project felix by apache.

the class ComponentTestBase method info.

void info(PrintWriter out) {
    ServiceComponentRuntime scr = scrTracker.getService();
    if (scr == null) {
        TestCase.fail("no ServiceComponentRuntime");
    }
    new InfoWriter(scr).list(null, out);
}
Also used : ServiceComponentRuntime(org.osgi.service.component.runtime.ServiceComponentRuntime)

Aggregations

ServiceComponentRuntime (org.osgi.service.component.runtime.ServiceComponentRuntime)10 ComponentConfigurationDTO (org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)3 ComponentDescriptionDTO (org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)3 Hashtable (java.util.Hashtable)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 InventoryPrinter (org.apache.felix.inventory.InventoryPrinter)1 ScrInfo (org.apache.felix.scr.ScrInfo)1 ScrService (org.apache.felix.scr.ScrService)1 ServiceComponentRuntimeImpl (org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl)1 SimpleWebConsolePlugin (org.apache.felix.webconsole.SimpleWebConsolePlugin)1 BundleInfoProvider (org.apache.felix.webconsole.bundleinfo.BundleInfoProvider)1 ServiceReference (org.osgi.framework.ServiceReference)1 ServiceTrackerCustomizer (org.osgi.util.tracker.ServiceTrackerCustomizer)1