On 6/20/12 10:20 , Dan Gravell wrote:
On Wed, Jun 20, 2012 at 3:10 PM, Richard S. Hall <[email protected]>wrote:

The bundle, as provided by OBR, has a location of "obr://[bundle
name]/[some string]". Jetty doesn't know how to interpret that. Is there
any way of finding the filesystem location from the OBR provided bundle?

No, there is no way of determining it other than knowing the bundle cache
format of the framework and calculating it yourself.

That's ok - I know we are using Felix. And this worked before I used OBR,
because bundle.getLocation would return a file URL. However the OBR URL
returned by getLocation is totally abstracted. How might I find the
location in the bundle cache?

Just to be clear, we are talking about two different locations:

1. The bundle.getLocation() method was returning the original location
   from which the framework made a copy of the bundle to install into
   its bundle cache.
2. The bundle in the bundle cache is the copy made from the original
   location above.

So, in your old solution you were getting it from the source. Now you will be getting it from the copy.


Other than explicitly finding it on the filesystem - new
File("felix-cache") and going through the bundle.infos... or is that what
you meant? If so, this might be a show-stopper unless I can think of some
other way.

Well, you can configure the location of the bundle cache using the org.osgi.framework.storage property, so you can look up this property. After that, then yes you'll need to know the structure of the cache to find the bundle you want. You shouldn't need to read any of the files, though, you just need to know the structure so you can find what you want.

Still sucks, I know, but this is a pretty crappy thing to do in the first place. ;-)

Some frameworks (hint: Equinox) provide some utility to do this, but we never have. You could hide all of this behind some method, but it is still ugly...

-> richard


Dan



Reply via email to