Felix utils has a few classes that you can use. https://github.com/apache/felix/tree/trunk/utils/src/main/java/org/apache/felix/utils/version Though with osgi r5, there is a new VersionRange class. So depending on which osgi minimal version you target, pick the one you need.
2014-06-11 15:11 GMT+02:00 Christopher BROWN <[email protected]>: > Hello, > > Regarding version ranges, such as [1.0.0,2.0.0), is there any way to > construct an object representation of that range in code with Felix / OSGi > in general, and then test if a given Version object matches? Something > along the lines of FrameworkUtil.createFilter(string)... > > This is all done automatically for package dependencies, but I'm looking > for a solution in a different area. > > The OSGi-based product I'm working on uses OSGi for packing code, that's > fine. However, the user interface associated is packaged up in ZIP files > that the application loads, containing templates, CSS, and JavaScript. The > JavaScript files in particular can have dependencies on specific versions > of specific libraries, such as jQuery 1.9.x or 2.x+, Underscore, Backbone, > to name but a few. The non-technical suppliers of these ZIP files aren't > skilled in defining OSGi manifests to express these dependencies but they > can choose to pick a library and a version from a list. These JavaScript > libraries are made available as URLs that are injected into the templates > based on these declared dependencies. > > So I'd like to be able to reuse this logic at an application level, instead > of reimplementing it (for the principle, even if it's not a huge > challenge). > > Is there any such solution available with Felix? > > Thanks, > Christopher >

