commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Shaposhnikov <>
Subject Re: [configuration] Missed an email about providing a good AbstractConfiguration class
Date Thu, 25 Sep 2003 12:30:28 GMT

Here is my previous mail:
I've tried to create my own Configuration class which loads properties 
from database. Because I don't want to implement all methods from 
Configuration interface by myself I decide to extend my class from 
BaseConfiguration and found that it is not easy task.

All methods which retrieve properties call private method 
resolveContainerStore, which directly access store Map in which 
BaseConfiguration store properties. So if I only want to change way how 
properties retrieved from underlying data store I also need to override 
all getProperty methods (JNDIConfiguration implemented in this way).

There is easy solution for this problem. We can add new protected method 
in BaseConfiguration which provide way to retrieve property values (and 
call it f.e. getPropertyDirect) and replace all occurrence of accessing 
store map with call to this method.

What do you think about it?

Also I have some more comments about implementation of BaseConfiguration
class. May be we can discuss them too. I think that all getProperty 
methods should behave similar.

Now methods getBoolean, getByte, getDouble, getFloat, getInt, getLong, 
getShort which take only key as argument (without default value) throw 
NoSuchElementException if there is no element associated with given key, 
but getString and getObject methods behave different - they simply 
return null.

Also I think that method getProperty(String key, Object defaultValue) 
also can be useful.

Eric Pugh wrote:
> Hi all,
> Someone sent I think to me directly an email about the difficulty they had
> in creating a JDBCConfiguration object because of some cruft in the
> BaseConfiguration class in reponse to an earlier post I made.
> Unfortunantly I deleted it..  Could they resend it to the list and maybe we
> can figure out how to make a nice easy to extend BaseConfiguration class?
> Eric Pugh
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message