hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Wannheden <knut.wannhe...@gmail.com>
Subject Re: Few interfaces with a lot of implementation
Date Wed, 18 May 2005 09:39:23 GMT
Massimo,

On 5/18/05, Massimo Lusetti <mlusetti@gmail.com> wrote:
> 
> I've 10 java interfaces which represent 10 different business process
> but for each of this java interfaces I've 40 different
> implementations, so from HiveMind point of view, I'll end up with 400
> services
> Which different implementations choose to process data are based on
> some kind of meta-data associated with the real data and are performed
> by the "main class" of the application.

Depending on your situation there are the following alternatives:

1. If you at registry construction time already know which of the 40
implementations is the "correct" one for a given service then you
could actually encode this knowledge into the module descriptors, in
which case you would end up with 10 services instead of 400 (of which
390 would be unused).

2. If you on the other hand have to be able to let client code at
runtime chose which of th 40 implementations to use then you indeed
have to create 40 distinct services. This is because a HiveMind
service can at runtime only have one implementation.

3. If your service itself can at runtime decide (let's say based upon
argument values passed to the invoked service method and environment
settings) which of the 40 implementations to use then you have the
possibility to create a "dispatch implementation". You'd again end up
with a total of 10 services. In version 1.1 of hivemind-lib there is a
service factory that helps here: hivemind.lib.StrategyFactory. See
http://jakarta.apache.org/hivemind/hivemind-lib/StrategyFactory.html
and http://howardlewisship.com/blog/2004/11/hivemind-adapterregistryfactory.html.

> I think I'll approach this with a solution with a lot of thin jar,
> maybe keeping separated the interfaces from the implementations so
> I'll have implementation-jar depending on interface-jar.
> I hope to have been more clear now.
> Does this sounds good ?
> 

Yes, that sounds good.

--knut

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


Mime
View raw message