+ /*
+ * PLAIN OSGI LAUNCHER
+ */
+ /** Launch an OSGi framework. OSGi Boot initialisation is NOT performed. */
+ public static Framework defaultOsgiLaunch(Map<String, String> configuration) {
+ Optional<FrameworkFactory> frameworkFactory = ServiceLoader.load(FrameworkFactory.class).findFirst();
+ if (frameworkFactory.isEmpty())
+ throw new IllegalStateException("No framework factory found");
+ return defaultOsgiLaunch(frameworkFactory.get(), configuration);
+ }
+
+ /** Launch an OSGi framework. OSGi Boot initialisation is NOT performed. */
+ public static Framework defaultOsgiLaunch(FrameworkFactory frameworkFactory, Map<String, String> configuration) {
+ // start OSGi
+ Framework framework = frameworkFactory.newFramework(configuration);
+ try {
+ framework.start();
+ } catch (BundleException e) {
+ throw new IllegalStateException("Cannot start OSGi framework", e);
+ }
+ return framework;
+ }
+