Using JSAGA within an equinox application

Equinox is the OSGi implementation used by the eclipse platform. This page explain how to address the problems of integrating JSAGA into an eclipse applications.

httpg:// URLs

httpg:// URLs are not supported by default by the URL implementation of the JDK. So, a problem arise when one tries to use the srm adaptator of JSAGA. To solve this :

- Create a bundle with an activator depending on the jsaga bundle and org.eclipse.osgi

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.simexplorer.jsaga
Bundle-SymbolicName: org.simexplorer.jsaga
Bundle-Version: 1.0.0
Bundle-Activator: org.simexplorer.jsaga.internal.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0" 
Require-Bundle: fr.in2p3.jsaga;bundle-version="1.0.0",
Export-Package: org.simexplorer.jsaga

- Implement the following class in you bundle


class HttpgURLStreamHandlerService extends AbstractURLStreamHandlerService {

  public URLConnection openConnection( final URL url ) throws IOException {
    return new GSIHttpURLConnection( url );


- Register the handler during bundle the activation process

private void initializeURLProtocol( final BundleContext context )
    String protocol = "httpg";
    Hashtable properties = new Hashtable();
    properties.put( URLConstants.URL_HANDLER_PROTOCOL, new String[]{protocol});
    context.registerService( URLStreamHandlerService.class.getName(),
                 new HttpgURLStreamHandlerService(),
                 properties );

- You'll need furthermore to specify the following properties

System.setProperty("jsaga.universe.create.if.missing", "true");
System.setProperty("saga.factory", "fr.in2p3.jsaga.impl.SagaFactoryImpl");