1 Reply Latest reply on Jun 16, 2010 11:18 AM by Marko Strukelj

    GateIn - injection to the portlets

    Michal Bonach Newbie



      I need to create one object for entire portal and inject instance of this object to every portlet. Could someone explain or give some hints how to achive this?


      Thanks in advance

        • 1. Re: GateIn - injection to the portlets
          Marko Strukelj Master

          Could you explain in detail what you are trying to achieve?


          Creating one object for entire portal ... depends on what you understand with 'portal', as you can have several portal applications within one JVM instance of GateIn.


          Behind the scenes each portal application is represented by one PortalContainer which is a registry for singletons within the scope of that portal.


          There is also a registry for singletons that are shared among all portal applications within JVM instance of GateIn - this one is called RootContainer.


          It's very easy to create your own service component and register it with either RootContainer to have one instance of the component shared among all the portal apps, or with PortalContainer to have one instance per portal application.


          You can lookup these services from your portlets using GateIn APIs, but that's not injection ...




          As far as 'injection into all the portlets' is concerned ...


          What do you mean by 'inject' and what do you mean by 'all portlets'?


          You mean JSR-299 (CDI) injection using @Inject?  That's not yet supported in GateIn.


          All portlets of all the applications - including those you have no control over - in that case the question is where would you inject - as PortletContext attribute?, and why you would need something like that.


          Or do you mean all the portlets of your application, maybe all extending a specific type with specific public setter method ...


          See what I mean? Your question is too vague, too broad ...