You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Strutynski, Oliver" <ol...@sdm-research.de> on 2004/09/21 11:50:06 UTC

Multiple interfaces again

I have one more problem(?) with multiple interfaces:

Define interfaces A,B
Interface C extends A,B
Class X implements C

Now I have two more services Y and Z. Both depend on the implementation 
X, but import different service interfaces. So in my hivemodule.xml I 
have something like:


  <service-point id="MyA" interface="A">
      <invoke-factory service-id="hivemind.BuilderFactory">
          <construct autowire-services="true" class="X">
              <boolean>false</boolean>
          </construct>
      </invoke-factory>
  </service-point>
 
  <service-point id="MyB" interface="B">
      <invoke-factory service-id="hivemind.BuilderFactory">
          <construct autowire-services="true" class="X">
              <boolean>false</boolean>
          </construct>
      </invoke-factory>
  </service-point>

  and simple service points for Y and Z.

Hivemind correctly autowires everything and both Y and Z get an instance 
of X, however because Y and Z import different interfaces, two instances 
of X are being created. Is there a proper way to make sure that only one 
instance of X will be created and handed to both Y and Z, without making 
X and Z depend on the combined interface C (which is not really an option)?

Probably a definition like

   <service-point id="MyAandB" interface="A,B">
      <invoke-factory service-id="hivemind.BuilderFactory">
          <construct autowire-services="true" class="X">
              <boolean>false</boolean>
          </construct>
      </invoke-factory>
  </service-point>

could do the job, but that is not currently possible with Hivemind.

Thanks again for any help.

Oliver Strutynski

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


Re: Multiple interfaces again

Posted by Aarti Parikh <aa...@gmail.com>.
I had the same problem.  Did you hear back on the subject? 
I ended up using service-property.


On Tue, 21 Sep 2004 11:50:06 +0200, Strutynski, Oliver
<ol...@sdm-research.de> wrote:
> I have one more problem(?) with multiple interfaces:
> 
> Define interfaces A,B
> Interface C extends A,B
> Class X implements C
> 
> Now I have two more services Y and Z. Both depend on the implementation
> X, but import different service interfaces. So in my hivemodule.xml I
> have something like:
> 
>   <service-point id="MyA" interface="A">
>       <invoke-factory service-id="hivemind.BuilderFactory">
>           <construct autowire-services="true" class="X">
>               <boolean>false</boolean>
>           </construct>
>       </invoke-factory>
>   </service-point>
> 
>   <service-point id="MyB" interface="B">
>       <invoke-factory service-id="hivemind.BuilderFactory">
>           <construct autowire-services="true" class="X">
>               <boolean>false</boolean>
>           </construct>
>       </invoke-factory>
>   </service-point>
> 
>   and simple service points for Y and Z.
> 
> Hivemind correctly autowires everything and both Y and Z get an instance
> of X, however because Y and Z import different interfaces, two instances
> of X are being created. Is there a proper way to make sure that only one
> instance of X will be created and handed to both Y and Z, without making
> X and Z depend on the combined interface C (which is not really an option)?
> 
> Probably a definition like
> 
>    <service-point id="MyAandB" interface="A,B">
>       <invoke-factory service-id="hivemind.BuilderFactory">
>           <construct autowire-services="true" class="X">
>               <boolean>false</boolean>
>           </construct>
>       </invoke-factory>
>   </service-point>
> 
> could do the job, but that is not currently possible with Hivemind.
> 
> Thanks again for any help.
> 
> Oliver Strutynski
> 
> ---------------------------------------------------------------------
> 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