Am 09.02.2006 um 15:23 schrieb Christian Mittendorf:
I'm already inside a service, but inside this Service a Factory is
used for returning objects that are necessary for initializing
beans. Each of these might require access to different services,
therefore a reference to the Registry will help. And I don't want
to inject every service available ;-)
Ok, we've solved the problem by injecting ApplicationGlobals into the
Service and getting the Registry from the ServletContext:
<implementation service-id="InitService">
<invoke-factory>
<construct class="hivemind.impl.InitServiceImpl">
<set-service property="applicationGlobals" service-
id="tapestry.globals.ApplicationGlobals"/>
</construct>
</invoke-factory>
</implementation>
private static final String REGISTRY_KEY_PREFIX =
"org.apache.tapestry.Registry:";
private Registry registry = null;
public void setApplicationGlobals(ApplicationGlobals globals)
{
ApplicationSpecification spec = (ApplicationSpecification)
globals.getSpecification();
String key = BeanInitServiceImpl.REGISTRY_KEY_PREFIX +
spec.getName();
ServletContext context = globals.getServletContext();
this.registry = (Registry) context.getAttribute(key);
}
Are there any points speaking against this solution?
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]