JDK-4075467 : RFE: ResourceBundle should support resources other than .class or .properties formats
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-08-29
  • Updated: 2004-11-01
  • Resolved: 2004-11-01
Related Reports
Duplicate :  
Description
Name: joT67522			Date: 08/29/97


ResourceBundle doesn't support resource formats other than .class and .properties. 
We found this a bit restrictive since we want to have our own format.

There are two reasons why we want to define our own format:
1) For each key we want to associate it with type and description in addition to value.
2) Some of our resources reside remotely and the default bundle finding algorithm 
does not support it.

We could NOT define a new format by extending the ResourceBundle class nor the 
PropertyResourceBundle class, as ResourceBundle.findBundle() (private method - 
which is called by getBundle()) only knows about these two types.

Ideally, it could be improved in two ways:
1) Seperating the get bundle functionality of ResourceBundle and put it into another 
class called BundleFetcher, say, leaving ResourceBundle to do its own job, e.g. getObject(), 
getString() etc.

BundleFetcher supports the default resource file formats, i.e. .class and .properties.

2) Define a BundleFinder interface which allows programmers to define their own bundle 
finding algorithms, i.e. for their own formats. Instances of BundleFinder can be added 
to BundleFetcher, e.g. BundleFetcher.addBundleFinder( myBundleFinder ), so that when 
the user calls BundeFetcher.getBundle( "MyResources", frenchLocale ), myBundleFinder 
will try to find the bundle in the  file format which I define.

I am sure there are other (better) ways to improve ResourceBundle.
company - Lucent Technologies, Bell Labs , email - ###@###.###
======================================================================
###@###.### 11/1/04 01:42 GMT

Comments
WORK AROUND Name: joT67522 Date: 08/29/97 We have defined our own resource bundle classes based on the above. Due to the limit of space provided, we have not included the source code here, however, we are more than happy to share it with you, if you are interested. Just email me for it. ======================================================================
11-06-2004

EVALUATION ResourceBundle would require a lot of overhaul to allow different formats. john.oconner@Eng 2000-02-22 Closing (again) as a duplicate of 4303146. ###@###.### 11/1/04 01:44 GMT
22-02-2000