Thank you. This is realy the better aproach.

On Thu, 4 Sep 2003 14:55:55 -0400, Howard M. Lewis Ship <[EMAIL PROTECTED]> wrote:


As I see the option to override the contribution to a service was removed. The cvs log just states that this was
a bad idea. Why was override a bad idea?.

It led to a lot of ambiguities as I was adding new service models. I found other, better ways to
accomplish the same kind of thing.



<service id="OriginalService" ....> </service>

<extension point-id="hivemind.FactoryDefaults">
<default symbol="ServiceToUse" value="mymodule.OriginalService"/>
</extension>

<service id="MyDependentService" ...>
<invoke-factory service-id="hivemind.BuilderFactory">
<construct ...>
<set-service property="otherService" service-id="${ServiceToUse}"/>
</construct>
</invoke-factory>
</service>


Using symbols for indirection, MyDependentService will be linked to OriginalService.
Now, in another module:



<service id="ReplacementService" ...>


<extension point-id="hivemind.ApplicationDefaults">
<default symbol="ServiceToUse" value="newmodule.ReplacementService"/>
</extension>



ApplicationDefaults override FactoryDefaults. MyDependentService will now be linked to
ReplacementService.


The advantage to this system is that ReplacementService can gain access to OriginalService. This is
important to me, because this is a very common pattern in Tapestry, where it is common to wrap the
default service implementation with a thin wrapper that adds some special features. I want a
graceful way to accomplish the same thing in HiveMind.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com



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




-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

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



Reply via email to