avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [Proposal] Should we introduce a new idiom for Components?
Date Thu, 17 May 2001 09:30:52 GMT
The problem I have with this is that the role name may not always equal the
interface name, or even make sense if it does.

For example, assume that my application has two stores:

<role name="texturecache" class="leos.classes.VolatileStore"/>
<role name="playerstatestore" class="berins.classes.PersistentStore"/>

It makes no sense to have role name == interface name in this case. I
believe that this is a common occurence.

/LS

> -----Original Message-----
> From: Berin Loritsch [mailto:bloritsch@apache.org]
> Sent: den 16 maj 2001 19:52
> To: avalon-dev@jakarta.apache.org
> Subject: [Proposal] Should we introduce a new idiom for Components?
>
>
> 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
>
>


---------------------------------------------------------------------
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