db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neeme Praks <ne...@apache.org>
Subject org.apache.ojb.broker.util.configuration vs. org.apache.avalon.framework.configuration?
Date Wed, 23 Apr 2003 12:07:29 GMT

While browsing through OJB source code to find an easy way to write an 
OJB component for Avalon containers, I can across the following TODO item:
org/apache/ojb/broker/util/configuration/package.html:
[snip]
Todo:
merge with jakarta commons-configuration API
[snip]

While this looks like a sensible idea at first sight, I have a different 
opinion: OJB should use Avalon framework API interfaces instead of 
commons configuration API interfaces.

Why?
Both OJB and Avalon framework configuration interfaces support 
"inversion of control" pattern, commons configuration doesn't.
As a result, it would be quite painless to do the following conversion:

org.apache.ojb.broker.util.configuration.Configurable ->
    org.apache.avalon.framework.configuration.Configurable
easy match, 1-1 mapping

org.apache.ojb.broker.util.configuration.Configuration ->
    org.apache.avalon.framework.configuration.Configuration
here we have some differences:
Avalon is missing:
    Class getClass(...); //this seems like an implementation detail, why 
is this exposed in the interface?
    String[] getStrings(...); //this could be replaced by Avalon support 
for child values
Avalon has additional support for XML conf:
    attributes, values, namespaces, children.

org.apache.ojb.broker.util.configuration.ConfigurationException ->
    org.apache.avalon.framework.configuration.ConfigurationException
one difference: OJB has protected ConfigurationException(String key, 
String message), but as this is protected, this should not be an issue.

org.apache.ojb.broker.util.configuration.Configurator
This interface has no real equivalent in Avalon and should probably stay 
with OJB. However, the configurator implementations can probably take 
advantage of the following avalon helper classes:
org.apache.avalon.framework.configuration.ConfigurationUtil
org.apache.avalon.framework.configuration.DefaultConfigurationBuilder
org.apache.avalon.framework.configuration.DefaultConfigurationSerializer

If you would be interested, then I could try to convert OJB to use 
Avalon interfaces (or maybe after 1.0)? If not, then I will write some 
glue code to adapt avalon configuration to OJB interfaces.

Rgds,
Neeme


Mime
View raw message