You can use registry.getService(serviceId, serviceInterface)

On Thu, Feb 28, 2013 at 11:52 AM, antalk <nab...@vankalleveen.net> wrote:

> Is it an idea to add a 'getServiceById' method to the Registry ?
>
> The reason:
>
> We are calling Tapestry service methods from a declarative view. We have
> some file , say an XML file with a element that says:
> action="serviceid$method"
>
> The method is invoked through reflection and the service is looked up by
> its
> 'id' because we dont want to specify the full classpath of the matching
> interface in the XML part.
>
> Now i have the following solution: ( which i dont know is a good / correct
> one )
>
> final List<ServiceActivity> services =
>
> TapestryFilter.getRegistry().getService(ServiceActivityScoreboard.class).getServiceActivity();
>                                 for (ServiceActivity service:services) {
>                                         if
> (service.getServiceId().equals(serviceid) {
>                                                 final Object o =
> TapestryFilter.getRegistry().getService(service.getServiceInterface());
>                                                 return
> o.getClass().getMethod(method, null).invoke(o, null);
>                                         }
>                                 }
>
>
> It would be much easier to just have a method 'getServiceByID' which i
> think
> can be used in other situations as well.
>
> Thx
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Add-a-getServiceById-method-to-Registry-tp5720273.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
BR
Ivan

Reply via email to