Leo Sutic wrote:
>
> 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.
The paper I am writing (and will donate) covers the Role naming policy
we currently have. Neither of your role names above qualify for the
official naming policy. This is part of the documentation that is lacking
in Framework--though not for long.
Basically we have instantiated the following policy (check out the archives
if you want):
General Rule) Interface name == Role name
Exception 1) if (component.accessedBy(ComponentSelector)) roleName = interfaceName +
"Selector";
Exception 2) if (workInterface.numRoles() > 1) {
roleName.packageName = interfaceName.packageName;
for (each Role) {
roleName += specificContract;
}
}
In other words if there is explicitly only one type of contract on an interface,
and only one instance of the role in a system, we use the interface name.
If there is explicitly only one type of contract on an interface, and multiple
instances of the role in a system, we append "Selector" to the role name.
If there is explicitly more than one type of contract on an interface (like
Cocoon's store interface), and each contract has different semantics/purpose
of use, then the role name is in the same package as the interface name--but
differentiated where the class/interface name is.
>
> /LS
>
> > -----Original Message-----
> > From: Berin Loritsch [mailto:[EMAIL PROTECTED]]
> > Sent: den 16 maj 2001 19:52
> > To: [EMAIL PROTECTED]
> > 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]