tags:

views:

28

answers:

3

I have a updater bundle that lookups in a specific folder "bundle" and checks for new bundles to install and updates for currently installed bundles. Inside a parent directory, OSGi framework is in the "/framework" directory, updater bundle is in the "/system" directory and the directory needs to be checked is the "/bundles" directory in the same parent directory. Inside the updater bundle, a File object with a relative path is created but it's not working with the "./bundles" string, and i dont know which jar file the path is supposed to be relative with. I would appreciate any insight or information about this problem.. Thanks, Deniz

Edit: Already figured out. Looks like path is resolved according to the Ruby script i use to start Equinox. So resolution path is a directory i start Equinox by passing it a "-console" flag using Ruby system. Thanks for answers, Deniz

A: 

Depends on your OSGi configuration and implementation. It could be relative to a number of places, the most likely one being the framework location. Why don't you test by creating your File with a relative path, and the checking the value of

new File("./bundles").getAbsolutePath();

Hope this helps.

omerkudat
+1  A: 

Doing new File("./bundles") resolves against the current working directory.

You can install your bundle by getting an input stream yourself and calling BundleContext#installBundle(String, InputStream).

OSGi itself makes no assumptions about filesystem layout, or that bundles are even on disk. But if you are using Equinox as your framework you can resolve your relative paths against the "osgi.install.area". The Location service can give you this. And then use the absolute path to install the bundle.

Or, you can get the System Bundle (BundleContext.getBundle(0)), and use FileLocator (from org.eclipse.equinox.common) to find it on disk.

Andrew Niefer
thats a useful information for future needs, thanks..
Deniz Acay
A: 

Already figured out. Looks like path is resolved according to the Ruby script i use to start Equinox. So resolution path is a directory i start Equinox by passing it a "-console" flag using Ruby system. Thanks for answers, Deniz

Deniz Acay