Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Accessing ResourceBundles from a bundle


I don't think that we actually need to call this function out on Bundle or some such.  It is an implementation detail.  If a particular implementation uses multiple classloaders or fragments or... it still has to ensure that it loads things correctly.   For example, if my implementation uses one loader per jar and the jars are spec'd as a.jar, b.jar and c.jar in the manifest, a class in b.jar should still be able to see the classes in a.jar.  The are all in the same bundle.  Likewise for resources.  

I would expect this support to come at the classloader level by having the classloaders know that they are cooperating to form a single context (the bundle).

Jeff



Olivier Gruber <ogruber@xxxxxxxxxx>
Sent by: equinox-dev-admin@xxxxxxxxxxx

07/18/2003 12:55 PM

       
        To:        BJ Hargrave <hargrave@xxxxxxxxxx>
        cc:        equinox-dev@xxxxxxxxxxx, equinox-dev-admin@xxxxxxxxxxx, Pascal Rapicault/Ottawa/IBM@IBMCA
        Subject:        Re: [equinox-dev] Accessing ResourceBundles from a bundle




Correct BJ.


This is what I raised as an issue regarding ResourceBundle when we were all together

in Ottawa. Remember?


I added the support on a bundle to support finding the resource across the
different class loaders of a bundle, including fragment support.


This is part of looking at Bundle like a replacement for the functionality of ClassLoaders:


       - find resources

       - get ResourceBundle

       - load classes


Best regards,

Olivier Gruber, Ph.D.
Persistent & Distributed Object Platforms and Frameworks
IBM TJ Watson Research Center



BJ Hargrave/Austin/IBM@IBMUS
Sent by: equinox-dev-admin@xxxxxxxxxxx

07/18/2003 11:47 AM

       
       To:        "Pascal Rapicault" <Pascal_Rapicault@xxxxxxxxxx>

       cc:        equinox-dev@xxxxxxxxxxx

       Subject:        Re: [equinox-dev] Accessing ResourceBundles from a bundle





From looking at the ResourceBundle class, ResourceBundle.getBundle(String) will use the context class loader of the caller to locate the resource bundle. This means it will use the classloader of the bundle which loaded the class which defines the method which calls ResourceBundle.getBundle(String).


So if the class which defines the method comes from a different bundle (imported package) than the resource, the resource probably will not be located.


BJ Hargrave
Senior Software Engineer, IBM Pervasive Computing - Austin, TX
OSGi Fellow and CTO of the OSGi Alliance
mailto:hargrave@xxxxxxxxxx  902/6C-003 T/L 678-9938
Office: +1 512 838 9938  Mobile: +1 512 785 7386

"Pascal Rapicault" <Pascal_Rapicault@xxxxxxxxxx>
Sent by: equinox-dev-admin@xxxxxxxxxxx

2003-07-18 10:32 AM

       
      To:        equinox-dev@xxxxxxxxxxx

      cc:        

      Subject:        [equinox-dev] Accessing ResourceBundles from a bundle






Hi,

Is there any knwon problem using the java API   ResourceBundle.getResourceBundle(String baseName) from the code of a bundle?

It does not work in the implementation that I have.


     PaScaL




Back to the top