osgi

How to reference an included file in OSGi bundle when performing java.io.File or FileInputStream

半腔热情 提交于 2019-11-30 12:15:55
I am using the aQute Bnd toolset to create an OSGi bundle and have packaged with some dependant 'resource' files. This includes *.css files and *.xsd files in a resources directory I have created. I have included the following in the bundle.bnd file: Include-Resource: resources/=resources/ and when I do a build, the generated *.jar file has the *.css and *.xsd files in the resources directory in the top directory of the jar bundle file. However, in the actual code I am having difficulty in trying to refer to this as part of my class path: I have tried the following: new File("resources/example

Using OSGi to implement auto-update

可紊 提交于 2019-11-30 12:11:59
What I'd like to do is create a "launcher" framework for my code that, given a URL and a predefined versioning scheme: 1) go check if an update exists 2) download the updates 3) "install" the update 4) "re-run" the application I want to a) do all of this inside of the existing JVM and b) be platform independent. Tall order right? Based on my (limited) knowledge of OSGi and Apache Felix I'm pretty sure this is possible, but I'm really getting lost in the details. Checking for an update and downloading it is trivial. Causing the "old" bundle to unload and the "new" bundle to load is where I'm

Search OSGI services by properties

你。 提交于 2019-11-30 11:28:52
How can I distinguish between published OSGI services implementing same interface by their properties? Assuming that you want to retrieve registered services based on certain values for properties, you need to use a filter (which is based on the LDAP syntax). For example: int myport = 5000; String filter = "&(objectClass=" + MyInterface.class.getName() + ")(port=" + myport + ")"; ServiceReference[] serviceReferences = bundleContext.getServiceReferences(null,filter); where you want to look for services both implementing MyInterface and having a value of the port property equal to myport . Here

How can an Android Activity use a Knopflerfish OSGi Bundle installed on the device

孤街醉人 提交于 2019-11-30 10:27:09
I have installed Knopflerfish on an Android emulator using this tutorial: http://www.knopflerfish.org/releases/current/docs/android_dalvik_tutorial.html The installation on the emulator is ok, and now I would like to call an OSGi bundle running on the emulator from my Android Activity. But I just can't find any way to do this. Is there somebody who has already done such a thing? Have you seen this? http://nilvec.com/embedding-osgi-into-an-android-application-part-1.html The patches I submitted for better Android/Dalvik support in Knopflerfish have been merged so patching and recompiling KF

OSGi, Java Modularity and Jigsaw

▼魔方 西西 提交于 2019-11-30 10:10:01
问题 So as of yesterday morning I hadn't a clue as to what OSGi even was. OSGi was just some buzzword that I kept seeing cropping up over and over again, and so I finally set aside some time to brush up on it. It actually seems like pretty cool stuff, so I'd like to start off by stating (for the record) that I'm not anti-OSGi in any respect, nor is this is some "OSGi-bashing" question. At the end of the day, it seems that OSGi has - essentially - addressed JSR 277 on Java Modularity, which

accessing command-line arguments from OSGi bundle

心不动则不痛 提交于 2019-11-30 09:57:35
I have an application that runs as a collection of OSGi bundles. I start it using a very small wrapper that embeds the Felix framework. The necessity of that wrapper irks me a little, as does the fact that it depends on Felix (whereas the application itself could run just as well in, say, Equinox), so I want to get rid of it, and use the default Felix launcher. The only thing that the wrapper really does is passing the command line arguments into the launched OSGi framework, so that a bundle there can react upon them. Note that it does not actually parse the arguments, just pushes the String[]

OSGI missing requirement error

≡放荡痞女 提交于 2019-11-30 09:34:37
I am new to OSGI and I am trying to figure out how I resolve errors such as the one below org.osgi.framework.BundleException: Unresolved constraint in bundle org.foo.serviceBundle [253]: Unable to resolve 253.0: missing requirement [253.0] package; (&(package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0))) I used a maven archetype to generate a bundle and added some simple slf4j logging to my Activator class. I am also using the maven bundle plugin as follows: <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.2.0</version> <extensions>true<

Component inside a fragment never activated

不想你离开。 提交于 2019-11-30 09:02:38
问题 When I create a component inside a fragment using OSGi Declarative Service way this component is not getting activated but my components in host bundle gets activated. Am I missing something? My fragment has proper meta-inf file entry for host bundle symbolic name. I declare a componet in this way @Component(immediate = true) 回答1: Because bundle fragments are never started, only resolved, declarative services components in them are never activated. The specification specifically states that

How to get classloader for a bundle in equinox?

和自甴很熟 提交于 2019-11-30 07:08:18
问题 I have read a lot of equinox code for this, but still can't figure out a non-hacky way of getting the classloader for a osgi bundle in eclipse equinox setup. Is there one? 回答1: The short answer (certainly for OSGi 4.1, not sure of 4.2) is you can't get a bundle's classloader. However the Bundle interface exposes a loadClass() method and this would allow you to write a classloader that wraps the bundle API and delegates to that loadClass() method. Or you can save some time and use Spring DM's

Is MEF OSGi for .NET?

橙三吉。 提交于 2019-11-30 06:42:59
问题 I'm just trying to get my head around the Managed Extensibility Framework (MEF) at the moment and digging into a bit. I have an Eclipse background so in my brain I currently have the equation: MEF =~ OSGi for .NET Based on what I have heard so far. Am I on the right lines? 回答1: Scott Hanselman helped to highlights the specifics about MEF in his podcast 148 with Glenn Block. Compared to OSGi, MEF is built upon "Inversion of Control" and OSGi is not: it (OSGi) will discover new bundle through a