felix

OSGi/Felix Declarative Services: How to filter the services to be bound?

I am using Apache Felix and its Declarative Services (SCR) to wire the service dependencies between bundles. For example, if I need access to a java.util.Dictionary I can say the following to have SCR provide one: /** * @scr.reference name=properties interface=java.util.Dictionary */ protected void bindProperties(Dictionary d) { } pr...

accessing command-line arguments from OSGi bundle

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...

Felix/OSGi: How to use SCR components that are not OSGi services?

Apache Felix's SCR allows to declare (via annotations or XML) components that will then be instantiated, hooked up to their dependencies, and registered as OSGi services. It is also possible to skip the service registration part, and just have SCR create the component (by specifying @scr.component, but omitting @scr.service). I was thin...

ServiceTracker in OSGi r4.1

Im using a org.osgi.util.tracker.ServiceTracker (PrintableServiceTracker implements ServiceTrackerCustomizer and simply prints when a new service is added). Filter filter = bc.createFilter("(objectClass=se.enea.print.Printable)"); tracker = new ServiceTracker(bc, filter, new PrintableServiceTracker(bc)); I've read about "pse...

Apache Felix: What are extension bundles?

Apache Felix has the concept of an "extension bundle". This seems to be a bundle that contributes to the system bundle. There is also a special URL "felix://extensions/" being registered for them. When would I need to use extensions as opposed to regular bundles? Are there examples of bundles that use this approach? Is this a Felix-on...

OSGi felix: Sharing a class between the host application and a bundle possible?

Hi there! Inside my host application I tried implement a simple pushService, which shall be used to transfer an instance of a class named Vehicle to the OSGi world, by providing a set and get method. To be able to use the service I exported both the service interface and the Vehicle class to a jar file and imported that file within the ...

Why can't JAXB find my jaxb.index when running inside Apache Felix?

It's right there, in the package that it should be indexing. Still, when I call JAXBContext jc = JAXBContext.newInstance("my.package.name"); I get a JAXBException saying that "my.package.name" doesnt contain ObjectFactory.class or jaxb.index although it does contain both. What does work, but isn't quite what I want, is JAXBCo...

How to configure Felix OBR repositories list?

Is there any way to specify a number of OBR repositories in Felix's config.properties file? I do can add a repository at runtime, but I have to do it after restart. "Prefrences Service" does not help, it seems "Bundle Repository" does not use it. ...

How do you build a JAR in eclipse with a custom manifest file?

I am trying to to build a Felix bundle in Eclipse. This basically includes having Eclipse create a JAR (through export) and adding my custom manifest file, however, I can't seem to get this to work. When I try exporting a JAR file, my custom manifest file shows up in the JAR, but doesn't ever get added to the right location within the JA...

getting started with osgi + felix

Which packages of Felix do I need to get started? There are a zillion of them on the downloads page. (p.s. is the name a reference to the Odd Couple + in contrast to OSGI's "Oscar" reference framework? this occurred to me after reading one of the tutorial pages & I got a chuckle out of it.) ...

pax-run using Maven Plugin in pom.xml

How can I execute Pax-Runner tasks using a Maven Plugin, which I can specify in the pom.xml file? i.e. I can do the following in command line using Pax-Runner (to convert a war file into an OSGi bundle) pax-run war:file:C:/somefile.war warref:C:/somefile.properties What should I do to make it happen in a pom.xml file? Thanks in adva...

How do i register the OSGIhost jar(itself) with DS ?

Hi, Im trying to create an application which can fire-up felix, and also publish services to the 'Declarative Services' bundle. But with my 'felix-starter' and services effectively being inside the same jar. i assume the jar containing both the osgi-host(Felix) and misc. services should contain the xml file describing the provided/re...

Felix 'pref' bundle requires 'log version >=1.3', but D/L 'log' bundle version = 1.0

Hi, the Felix download page shows Log bundle version 1.0.0 Preferences bundle version 1.0.2 But preferences requires log-bundle version >= 1.3 It just want to get an idea of how 'preferences' works, so any log compatible bundle is welcome :) Regards. ...

mangen adds 'Bundle-ManifestVersion: 1' to manifest, but felix doesn't seem to accept value 1

Hi, I've used 'Mangen' to process my jar, which works but it adds the next line to the manifest Bundle-ManifestVersion: 1 after which Felix 1.8.0 complains with -> install file:D:/bundles/osgi_ds_1.jar.new.jar org.osgi.framework.BundleException: Unknown 'Bundle-ManifestVersion' value: 1 at org.apache.felix.framework.util.ma...

OSGi in Netbeans, ClassCastException when retrieving service

Hi, im having a ClassLoader issue. Since im quite an osgi newby, hopefully the answer isn't that hard :) I think it has to do with Compile vs. Runtime libraries. in Netbeans 6.7.1 project properties, the compiletime libs are always propagated to the other categories.. so i can't differentiate there. When compiling the FelixHost the ...

In an OSGi environment, how are the classpaths and classloaders set up?

I'm confused about class visibility in OSGi. I'm running Apache Felix and loading the following bundles: the antlr, asm, jpa and core bundles from eclipselink an OSGi-fied jar for javax.persistence 1.99 an OSGi-fied jar with the com.mysql.jdbc driver a bundle of my own that contains annotated entity classes and a persistence.xml anothe...

Need to read own Jar's manifest, and not root-classloaders' manifest

Hi, i need to read the Manifest file, which delivered my class. but it seems that when i use getClass().getClassLoader().getResources(...) i end up getting the MANIFEST from the first Jar loaded into the Java Runtime. My app will be running from applet or webstart, so i will not have access to my own .jar file i guess i actually w...

Apache Felix Bundle Repository - Calling from another bundle

I have a simple test program which is designed to consume the Apache Felix Bundle Repository bundle service however I am having trouble configuring it through eclipse. I am using the jar for the bundle (org.apache.felix.bundlerepository-1.4.0.jar) as an referenced library and have added it to the classpath in the manifest. When I try t...

How do I deploy a webapp into Apache Felix?

What bundles do I need to install? At least, this would have to be a servlet container / web server such as Jetty, but will the basic org.apache.felix.http.jetty bundle do, or is there anything else needed to discover the web.xml in other bundles? Do I put the webapp in a standard WAR, add OSGi headers and am done? Or are there any weba...

OSGi: What are the differences between Apache Felix and Apache Karaf?

Apache Karaf is a sub project of Apache Felix. It is defined as "a lightweight OSGi container". I don't understand when should I use the heavyweight and when to use the lightweight. Their site doesn't explain this too much ...