camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject OSGi resource loading question
Date Thu, 26 Apr 2012 12:09:32 GMT
Hi

I was looking into
https://issues.apache.org/jira/browse/CAMEL-5223

And that leads me to the camel-core-osgi component where we have our
OSGi empowered Camel stuff.
And the class org.apache.camel.core.osgi.OsgiClassResolver is used for
loading resources and classes from OSGi.

Now I got a bit baffled that the method to load a resource from the
classpath, such as a .xslt file, or what ever the user wants is
implemented as:

    public URL loadResourceAsURL(String uri) {
        ObjectHelper.notEmpty(uri, "uri");
        return bundleContext.getBundle().getEntry(uri);
    }

Now reading the javadoc for getEntry it seems that it doesnt use
classloader at all, but some other means of loading the resource.
There is another method called getResource.

So I wonder if it should have been implemented as

    public URL loadResourceAsURL(String uri) {
        ObjectHelper.notEmpty(uri, "uri");
        return bundleContext.getBundle().getResource(uri);
    }

Guillaume in case you read this. The code was developed by you. So
maybe you have a thought about this?



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message