Re: JOGL with OSGi
Posted by
Wade Walker on
May 29, 2013; 4:23pm
URL: https://forum.jogamp.org/JOGL-with-OSGi-tp3773888p4029256.html
The resolver I use in Eclipse RCP apps looks like this:
JarUtil.setResolver( new JarUtil.Resolver() {
public URL resolve( URL url ) {
try {
return( FileLocator.resolve( url ) );
}
catch( IOException ioexception ) {
return( url );
}
}
} );
where org.eclipse.core.runtime.FileLocator is a part of Eclipse's framework code. FileLocator.resolve(url) converts the URL from an Eclipse/OSGi "bundleresource:" URL protocol (which is how Eclipse locates JARs/libraries that have been packaged into OSGi bundles) to a normal "file:" URL protocol that JOGL and other non-Eclipse code can use.
The purpose of the Resolver interface is to allow dependency injection, so JOGL can indirectly call this Eclipse/OSGi FileLocator.resolve() method without directly depending on an outside framework's code. In any given situation where your framework uses non-standard URL protocols, just wrap a Resolver around your framework's URL resolver and JOGL's auto-JAR-unpack feature should work correctly.