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: setting list parameters
Date Thu, 02 Nov 2006 07:40:33 GMT
Ryan,

Using a configuration point would probably be the most natural way to
do this. But if you prefer there are other possibilities. But these
would require you to write some Java code.

One alternative would be to implement an object provider. With that
(let's call it service-list) you'd set the property as follows:

<set-object property="myCustomServices"
value="service-list:service.MyCustomServiceX,service.MyCustomServiceY,service.MyCustomServiceZ"/>

You contribute this object provider as a service to the configuration
hivemind.ObjectProviders:

  <service-point id="ServiceListObjectProvider"
interface="org.apache.hivemind.service.ObjectProvider"
visibility="private">
    <create-instance class="service.impl.ServiceListObjectProvider"/>
  </service-point>

  <contribution configuration-id="hivemind.ObjectProviders">
    <provider prefix="service" service-id="ServiceListObjectProvider"/>
  </contribution>

Now it's just a matter of implementing the ServiceListObjectProvider
class which should be straight forward.

This is all of course more work than a simple configuration. But if
it's a common pattern in your code it might make sense.

HTH,

--knut

BTW Don't worry about the gift certificate :-)

On 10/31/06, ryan@unrighteousdominion.com <ryan@unrighteousdominion.com> wrote:
> I have a service that has method like "setMyCustomServices(List
> services)" but I can't figure out how to set this in the hivemind module
> descriptor. This is what I tried:
>
> <service-point id="SomeService" interface="SomeServiceInterface">
>         <invoke-factory>
>             <construct class="SomeServiceImpl" >
>                 <set-service property="myCustomServices">
>                     <list>
>                         <service-id>service.MyCustomServiceX</service-id>
>                         <service-id>service.MyCustomServiceY</service-id>
>                         <service-id>service.MyCustomServiceZ</service-id>
>                     </list>
>                 </set-service>
>             </construct>
>         </invoke-factory>
>     </service-point>
>
> I looked at using configuration points, but that seems like more
> complexity than is necessary.
>
> Anyone know the best way to do this?
>
> Thanks
>

Mime
View raw message