hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject RE: Problem with "multiple service points for interface"
Date Thu, 19 Aug 2004 14:26:57 GMT
What happens if there are three implementations of a service interface?
Does it assign the references in a "round robin" fashion?  I think the
current implementation is not necessarily a bad thing.  I don't know how
often you'll have this case where you have one service implementation that
needs to reference another implementation of the same service interface.
I'm not saying that it will NEVER come up, but I would doubt that it's
likely enough to make special cases for it, when there is already a
work-around for it by turning off autowiring.

-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com] 
Sent: Thursday, August 19, 2004 9:55 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: Problem with "multiple service points for interface"

The BuliderFactory assumes that if you are creating a core service
implementation, you want to hook up to the other services in HiveMind.
Autowiring is an attempt to make the module deployment descriptor less
needlessly verbose.

BuilderFactory can't always do the right thing, so you can turn
autowiring off, in which case you have to explicitly wire your
serviices together.

However, I think I see your point ... BuilderFactory probably should
understand that when you have exactly two services implementing an
interface, autowiring should be to each other, not an error. That's
something that can be looked into (hint: add a  bug), but it starts to
open up a rats nest of special cases and ambiguity.

On Thu, 19 Aug 2004 15:29:35 +0200, Teshler, Andre <andre.teshler@tui.de>
wrote:
> Thank you for the fast answer.
> 
>  >>The definition of TestComponent2 doesn't specify a value for property
>  >>component2.
>  >>So autowiring is tried and searches for a unique service
>  >>that implements the TestComponent interface in order to assign it to
>  >>property component2. Since two services with this interface exist an
>  >>error is raised.
> 
> 
> I think it's very natural to have private properties which
> are not not hivemind initialized. Why should I initialize
> something I do not want to be initialized ?
> 
>  >>>>Autowiring can be switched off:
>  >>>>  <construct autowire-services="false" class="framework...">
>  >>>>  </construct>
> 
> Great !
> 
> Probably I misunderstand something, but the feature looks unflexible:
> once I have made an implementation property
> of some service interface "visible" to hivemind
> using <set-service>, I allways need to inject it
> even when using this service interface for different
> Service and even with the different implementation class.
> 
> Is the Autowiring new added at beta-2 ?
> 
> Thanks
> Andre
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Achim Huegen [mailto:ahuegen@gmx-topmail.de]
> Gesendet: Donnerstag, 19. August 2004 14:54
> An: hivemind-user@jakarta.apache.org
> Betreff: Re: Problem with "multiple service points for interface"
> 
> 
> 
> 
> The definition of TestComponent2 doesn't specify a value for property
> component2. So autowiring is tried and searches for a unique service
> that implements the TestComponent interface in order to assign it to
> property component2. Since two services with this interface exist an
> error is raised.
> You can fix this by specifying a value for component2, but I dont't know
how
> you can leave it null.
> 
> Achim Huegen
> 
> Teshler, Andre wrote:
> 
> > I am working with beta-2 and use following configuration for my
> > service:
> >
> >     <service-point id="TestComponent*1*"
> > interface="framework.transaction.TestComponent">
> >         <invoke-factory service-id="hivemind.BuilderFactory">
> >             <construct class="framework.transaction.TestComponentImpl">
> >                 <set-service property="*component2*"
> > service-id="TestComponent*2*"/>
> >             </construct>
> >         </invoke-factory>
> >     </service-point>
> >
> >     <service-point id="TestComponent*2*"
> > interface="framework.transaction.TestComponent">
> >         <invoke-factory service-id="hivemind.BuilderFactory">
> >             <construct class="framework.transaction.TestComponentImpl">
> >             </construct>
> >         </invoke-factory>
> >     </service-point>
> >
> > With implementation class:
> >
> > public class TestComponentImpl implements TestComponent {  private
> > TestComponent *component2*;  public void setComponent2(TestComponent
> > component2) {
> >   this.component2 = component2;
> >  }
> >  // ...
> > }
> >
> > TestComponent1 will be initialized correctly, but acessing the
> > property
> > 'component2' I get following exception:
> >
> > /Unable to autowire property component2 of service
> > framework.transaction.TestComponent2: There are multiple service points
> > for interface framework.transaction.TestComponent:
> > {framework.transaction.TestComponent,
> > framework.transaction.TestComponent2}./
> >
> > What is wrong here ? It should be possible to define two services with
> > the same interface (and same implementation class) but different
> > injektions for member-services.
> >
> > By the way: this example has worked withe beta-1.
> >
> > Thanks.
> >
> > Andre
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

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




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