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);
}
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");
}
}
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!");
}
}
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");
}
}
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);
}
Aggregations