Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: Re[2]: [platform-core-dev] Can I use Eclipse Platform Core functionality outside Eclipse?


Peter,

If someone else (besides the Framework) sets themselves as the URLStreamHandlerFactory then the Framework will have problems trying to run.  

-  First of all, it will prevent the framework from defining the protocols used to access bundle resource/entry URLs.  There may be other ways of doing this but the current implementation in eclipse uses the URLStreamHandlerFactory registered by the framework to locate the proper URLStreamHandler to use for the bundle resource/entry URLs.  This will not become evident until someone uses a bundle resource/entry URL as a context to create a new URL or if someone constructs a new URL using the output of toExternalForm() from a bundle resource/entry URL.  For example,

Bundle b;
URL entry = b.getEntry("somefile.txt");
URL url1 = new URL(entry, "someotherfile.txt");
URL url2 = new URL(entry.toExternalForm());

This may seem like a strange usecase but keep in mind that bundle resource/entry URLs are used by the classloaders in OSGi.  We do not have control over what 3rd party code is doing with the URLs returned by ClassLoader#getResource.  As a result we have to support construction of URLs using one of our bundle resource/entry URLs as a context.  Otherwise many 3rd party software will start to fail with unsupported protocol exceptions.

-  If the framework cannot set the URLStreamHandlerFactory (and the ContentHandlerFactory) for the VM then the framework cannot support the URL Handler Service Specification in OSGi.  The eclipse runtime uses this specification to register additional protocols which are used by the rest of eclipse.  If this functionality is not available then eclipse will not function.

I know of other projects that are having to deal with this.  In Eclipse 3.0 we had to deal with this because Eclipse 2.x used to register its own URLStreamHandlerFactory with the VM to support the additional protocols (i.e platform: protocol).  Now eclipse 3.0 uses the URL Handler Service Specification to add additional protocol support.  There are other projects that are investigating using the URL Handler Service Specification to plugin their own additional protocols instead of setting the URLStreamHandlerFactory themselves.

Tom.

platform-core-dev-bounces@xxxxxxxxxxx wrote on 04/13/2005 04:35:39 AM:

> This should be easy to prevent by setting it yourself before you start
> the framework.
>
> However, I am a bit confused. The framework should preserve the
> existing handlers and it allows new handlers to be added. So what is
> the problem?
>
> Kind regards,
>
>      Peter Kriens
>

Back to the top