use of org.osgi.service.log.LogService in project bnd by bndtools.
the class DSAnnotationTest method testInheritance.
public void testInheritance(String key, String value, String extender) throws Exception {
Builder b = new Builder();
b.setProperty(Constants.DSANNOTATIONS, "test.component.DSAnnotationTest*Bottom");
b.setProperty(key, value);
b.setProperty("Private-Package", "test.component");
b.addClasspath(new File("bin"));
Jar jar = b.build();
assertOk(b);
Attributes a = getAttr(jar);
checkProvides(a);
checkRequires(a, extender, LogService.class.getName());
Resource r = jar.getResource("OSGI-INF/bottom.xml");
assertNotNull(r);
r.write(System.err);
XmlTester xt = new XmlTester(r.openInputStream(), "scr", "http://www.osgi.org/xmlns/scr/v1.3.0");
xt.assertAttribute("LogService", "scr:component/reference[1]/@name");
xt.assertAttribute("setLogService", "scr:component/reference[1]/@bind");
xt.assertAttribute("unsetLogService", "scr:component/reference[1]/@unbind");
xt.assertAttribute("updatedLogService", "scr:component/reference[1]/@updated");
xt.assertAttribute("PrivateLogService", "scr:component/reference[2]/@name");
xt.assertAttribute("setPrivateLogService", "scr:component/reference[2]/@bind");
xt.assertAttribute("unsetPrivateLogService", "scr:component/reference[2]/@unbind");
// is private in super class
xt.assertAttribute("", "scr:component/reference[2]/@updated");
}
use of org.osgi.service.log.LogService in project bnd by bndtools.
the class DSAnnotationTest method testBinds.
public void testBinds(String extender) throws Exception {
Builder b = new Builder();
b.setProperty(Constants.DSANNOTATIONS, "test.component.DSAnnotationTest*CheckBinds");
if (extender != null)
b.setProperty(Constants.DSANNOTATIONS_OPTIONS, "extender");
b.setProperty(Constants.DSANNOTATIONS_OPTIONS + ".min", "version;minimum=1.2.0");
b.setProperty("Private-Package", "test.component");
b.addClasspath(new File("bin"));
Jar jar = b.build();
assertOk(b);
Attributes a = getAttr(jar);
checkProvides(a);
checkRequires(a, extender, LogService.class.getName());
Resource r = jar.getResource("OSGI-INF/prototypes.xml");
assertNotNull(r);
r.write(System.err);
XmlTester xt = new XmlTester(r.openInputStream(), "scr", "http://www.osgi.org/xmlns/scr/v1.2.0");
xt.assertAttribute("LogService", "scr:component/reference[1]/@name");
xt.assertAttribute("bindLogService", "scr:component/reference[1]/@bind");
xt.assertAttribute("unbindLogService", "scr:component/reference[1]/@unbind");
xt.assertAttribute("updatedLogService", "scr:component/reference[1]/@updated");
}
use of org.osgi.service.log.LogService in project felix by apache.
the class LogServiceTracker method addingService.
@Override
public Object addingService(final ServiceReference reference) {
final LogService result = (LogService) super.addingService(reference);
if (result != null) {
synchronized (logServices) {
logServices.put(reference, result);
SystemLogger.setLogService(logServices.values().iterator().next());
}
}
return result;
}
use of org.osgi.service.log.LogService in project felix by apache.
the class TestManifestLoggerInfo method init.
@Before
public void init() {
log = (LogReaderService) osgiHelper.getServiceObject(LogReaderService.class.getName(), null);
if (log == null) {
throw new RuntimeException("No Log Service !");
}
LogService logs = (LogService) osgiHelper.getServiceObject(LogService.class.getName(), null);
logs.log(LogService.LOG_WARNING, "Ready");
}
use of org.osgi.service.log.LogService in project felix by apache.
the class DropBundleCommand method doExecute.
protected void doExecute(DeploymentSessionImpl session) throws Exception {
AbstractDeploymentPackage target = session.getTargetAbstractDeploymentPackage();
AbstractDeploymentPackage source = session.getSourceAbstractDeploymentPackage();
LogService log = session.getLog();
BundleInfoImpl[] orderedTargetBundles = target.getOrderedBundleInfos();
for (int i = orderedTargetBundles.length - 1; i >= 0; i--) {
BundleInfoImpl bundleInfo = orderedTargetBundles[i];
String symbolicName = bundleInfo.getSymbolicName();
if (!bundleInfo.isCustomizer() && source.getBundleInfoByName(symbolicName) == null) {
// stale bundle, save a copy for rolling back and uninstall it
try {
Bundle bundle = target.getBundle(symbolicName);
bundle.uninstall();
addRollback(new InstallBundleRunnable(bundle, target, log));
} catch (Exception be) {
log.log(LogService.LOG_WARNING, "Bundle '" + symbolicName + "' could not be uninstalled", be);
}
}
}
}
Aggregations