Overwriting ExtResourceBundle

You could use ExtResourceBundle as is, creating the table from the scripts and setting the System properties. In a couple of cases I found it actually helpful to overwrite ExtResourceBundle

The principle stayed the same, but the use of it was greatly extended

General considerations

If you want to overwrite ExtResourceBundle you need to re implement the Constructor and re implement the getExtBundle(..) methods returning the result of getBundleImpl(..):

public class MyResourceBundle extends ExtResourceBundle {
	public MyResourceBundle(String baseName, Locale locale) {
	public static ResourcBundle getExtBundle(String baseName) {
		return getBundleImpl(new MyResourceBundle(baseName,Locale.getDefault()));
	public static ResourcBundle getExtBundle(String baseName) {
		return getBundleImpl(new MyResourceBundle(baseName,Locale.getDefault()));
Now you can overwrite the methods which you need to overwrite.

Using another connection

To use a different source from the properties to get your connection from you can overwrite the protected void makeConnection() throws SQLException and setting the member variable m_con to a valid connection.

Example one: Say we have a controller which is a singleton that manages the database connections within an application

protected void makeConnection() throws SQLException {
    m_con = Controller.getInstance().getConnection();

Example two: You could use it to get information from an application server managing your database connections.

protected void makeConnection() throws SQLException {
	Context initContext = new InitialContext();
	Context envContext  = (Context)initContext.lookup("java:/comp/env");
	DataSource ds = (DataSource)envContext.lookup("jdbc/myJDBC");
	m_con = ds.getConnection();

Note: The connection is never closed directly by ExtResourceBundle

Using another table

It might be true that there actually is a table which contains the necessary information for localizing your application or you want to use another table for collecting your resources. The query which is actually send to the database is retrieved from the method public String getSQL() overwriting this will thus make it possible to use a completly different table.

Note:ExtResourceBundle expect the SQL to return just two columns, the first one containing the key, the second one containing the value

Example: We assume we have a table called BOILERPLATE with a DOMAIN,KEY and TEXT column and just one column for LOCALE

public String getSQL() {
	StringBuffer sb=new StringBuffer();
	sb.append(" AND LOCALE='").append(m_locale.toString()).append("'");
	return sb;

Differentiate bundles on subdomains

For one project I had to make a difference in creating a great number of keys just slightly different, to represent labels with slightly different values for screens or divide the domains in subdomains so the relation to the keys still can be determined. To make this work I have overwritten protected ResourceBundle getParent()

Example: The name of the domains consists of a subdomain and domain seperated by a dot. If the values are different from one subdomain, but with the same key, the value is defined in the subdomain, other values are retrieved from the main domain.

protected ResourceBundle getParent() {
	int idx = getBaseName().indexOf('.');
	if (idx != -1) {
		return getExtBundle(getBaseName().substring(idx + 1), getLocale());
	} else {
		ResourceBundle parent = null;
		if (!getLocale().getLanguage().equals("")) {
			if (!getLocale().getCountry().equals("")) {
				Locale pLoc = new Locale(getLocale().getLanguage(), "");
				parent = getExtBundle(getBaseName(), pLoc);
			} else {
				parent = getExtBundle(getBaseName(), new Locale("", ""));
		return parent;

The Waldorf branch for which I'm code reviewing all projects and published a couple that are finished also led to the decision to finish some of the applications that have been almost finished for quite a while. CoffeeBreak is the first of these orange-apps to be published.
Got annoyed by trying to figure out which version of a jar was used, so @test was born to look into a Manifest file from my right mousebutton
From now on all recent javadocs will be published with each component