hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Mittendorf <christian.mittend...@freenet.de>
Subject Re: How to access the Hivemind Registry ?
Date Thu, 09 Feb 2006 15:46:05 GMT
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: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message