Stephen,

OK, now I get it. I thought that the lookup operation would be replaced by casting, so that if I had a component that had a dependency on, say, StoreService and ConnectionPool, I would do this:

public void service (Locator locator) {
StoreService ss = (StoreService) locator;
ConnectionPool cp = (ConnectionPool) locator;
}

That was the root of my "but method names will conflict" post.

I think your proposal and mine are very similar.

We both allow the component to declare a context with any key-value mappings, and you extend it to allow even services to be accessed via a context. Where you have the component cast the context interface to multiple locator interfaces:

That is,

<context>
<locator type="org.a.a.f.context.SystemLocator" version="4.1.2"/>
<locator type="org.a.j.MailetLocator" version="2"/>
</context>

means that:

public void contextualize( Locator locator ) throws LocatorException {
SystemLocator system = (SystemLocator) locator;
MailetLocator mailet = (MailetLocator) locator;
}

is valid.

I would aggregate the two interfaces like this:

interface MyLocator extends SystemLocator, MailetLocator {}

declare it like this:

<context>
<locator type="MyLocator" version="4"/>
</context>

and then do this:

public void contextualize( Locator locator ) throws LocatorException {
MyLocator myLocator = (MyLocator) locator;
}

Is the above a correct understanding of your Locators?

/LS


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to