avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject [Proposal] Should we introduce a new idiom for Components?
Date Wed, 16 May 2001 17:52:13 GMT
I am specifically thinking about the Excalibur components.  In order to enforce
the Role names being correct, I am proposing that we augment the work interface
with the following idiom:


interface DataSourceComponent {
    String ROLE = "org.apache.avalon.excalibur.datasources.DataSourceComponentSelector";

    Connection getConnection();
}


That way when we wanted to use the Component, we can take advantage of the
fact that we already have the interface imported:

manager.lookup(DataSourceComponent.ROLE);



For systems that like to have one interface to collect all the role names can use:

interface Roles {
    DATASOURCES = DataSourceComponent.ROLE;
}

It greatly reduces errors when typing, and places the responsibility for fixing
a role name in one place.  If the role name changes for some reason, impact is
similarly reduced.

The reason that I am proposing it is because it
1) has little to no impact on API
2) because I want to document the idiom should we choose to adopt it.

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message