Hello, currently I’m looking forward to use Apache Felix inside a already working application as a Extension mechanism. Apache Felix should be embedded into the Main Application.
Actually I tried to look at: http://svn.apache.org/repos/asf/felix/trunk/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/launch/ <http://svn.apache.org/repos/asf/felix/trunk/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/launch/> However all these examples under examples are for Apache Felix 4.0. But I guess after adding the correct OSGi packages it should work for 5.4, too. However now my Question, currently my application code is something like that, scala: def createFramework(config: Map[String, String]): Framework = { val factoryLoader = ServiceLoader.load(classOf[FrameworkFactory]) val data = for (factory <- factoryLoader.iterator().asScala.toList) yield factory.newFramework(config.asJava) data.headOption.getOrElse(throw new IllegalStateException("Unable to load FrameworkFactory service.")) } val config = Map( Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA -> "org.apache.felix.example.servicebased.host.service; version=1.0.0" ) val framework = createFramework(config) framework.init() framework.start() val bundleContext = framework.getBundleContext val activator = new Activator() activator.start(bundleContext) applicationLifecycle.addStopHook(() => Future { framework.waitForStop(0) }) Now I want to upload a bundle via HTTP and register it / start it. Is the only thing I need to do now expose the bundleContext so that I can use it somewhere else, and then upload the bundle to a well known path and call bundleContext.installBundle(wellKnownPath) bundle.start() ? The next thing is stopping? There is a well known method called bundleContext.getBundle(id int) where do I retrieve the bundle ID? I guess I could just use bundleContext.getBundle(String location) again. Next is register a service/thing and retrieve it? If I have a bundle that defines serviceX and another bundle that defines serviceX and start both, does this give an exception or how do I know which service is correct and especially how to retrieve register them? Do I need to call bundleContext.registerService(…) before I install the bundles? Somehow that is not exactly clear to me on how my application can then get a Service from Felix to do something useful. Beste Grüße / Best Regards Christian Schmitt Entwickler / Developer
smime.p7s
Description: S/MIME cryptographic signature

