Mail Archive Home | exoplatform List | April 2008 Index
| <-- Date Index --> | <-- Thread Index --> |
Hi Rodrigue,I don't know if this will help but in a UIComponent I usually use this to retrieve a service instance :
PortalContainer pc = PortalContainer.getInstance();
MyService monService = (MyService)
pc.getComponentInstanceOfType(MyService.class);
MyService beeing the interface of MyServiceImpland in conf/portal/configuration.xml in my the classpath of my project, I have :
<configuration>
<component>
<key>org.ow2.portal.service.MyService</key>
<type>org.ow2.portal.service.MyServiceImpl</type>
</component>
</configuration> Anthony Rodrigue Le Gall a écrit :
hi community, I'm facing to a strange behavior of the picontainer included in eXo...I have written a startable service (implements the org.picocontainer.Startable ) and I configure it with a configuration.xml file:----------------------- <configuration> <component> <type>org.ow2.novabpm.admin.service.bonita.BonitaService</type> </component> </configuration> ------------------------I want to get this component in a method of an UIContainer, so I have written the next line:-------------------- BonitaService bs = getApplicationComponent(BonitaService.class); ---------------------Ok, all sounds right, but when I run eXo, my service starts (cool) and my bs variable is null (not cool).PS: To be sure that my service is well registered in my ExoContainer (aka PicoContainer), I have quickly (& dirty) written the next sample code and I found my service listed:---------------WebuiRequestContext context = WebuiRequestContext.getCurrentInstance() ; ExoContainer container = context.getApplication().getApplicationServiceContainer() ;List<Object> list = container.getComponentInstances(); Iterator<Object> iteO = list.iterator(); while(iteO.hasNext()) { Object o = iteO.next();System.out.println("COMPONENT OF TYPE : " + o.getClass().toString());} --------------- Have you any idea about the reason of this strange behaviour? Regards
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.