4 Replies Latest reply on Mar 29, 2009 4:15 PM by Nico Ziegenhals

    Getting Access to assigned Portlet Instances => Portlet Wind

    Nico Ziegenhals Newbie

      Hello Everybody,

      I need access to the Window Page => Portlet Instance and Portlet Defintion => Portlet Instance Assignment in a programmatic way (using the portal core API).
      I wrote a Command Interceptor, where I just get the requested Window Page Name. For this Page, I need a Map, which Portlet Instances are assigned to the Page. By using the Portlet Instance, I need the corresponding Portlet Definition (because many Portlet Instances could exist for one Portlet Definition). Could anybody of you tell me the name of MBeans oder something like this, which I have to use, getting my desired Information?


        • 2. Re: Getting Access to assigned Portlet Instances => Portlet
          Nico Ziegenhals Newbie

          To make my topic more clear, we can assume a concrete Portlet Page. To this Page it is possible to assign Portlet Instances, which should be displayed on the page. Many portlet Instances could reference to one Portlet Reference. This relationship is stored in the portals database. During the Portals Startup these information have to be stored in objects. I need to get access to these objects, which hold the information about Portlet Page assigned Portlet Instances and which portlet definition is referenced. My hope is, that I get access by using some MBeans for this purpose. I already find MBeans like: service=PortletInvoker,type=Container in the Portal domain. This MBeans hold the Portlets, but now I need a Mbean which give me a List of Windows and Portlet Instances registered in the Portal.

          Best regards

          • 3. Re: Getting Access to assigned Portlet Instances => Portlet
            vivek saini Newbie

            To get information regarding all deployed portlets, Mbean is


            Example of using it

            Collection col=instanceContainer.getDefinitions();
             for(Object o:col)
             Instance inst =(Instance)o;
             log.debug("portlet name is :"+inst.getId());

            And for getting all portlet from some particular page you can do something like

            templatePortletFromSelectedObject = new HashMap();
             if(currentTemplatePageObj!=null) {
             PortalObjectId pageId = PortalObjectId.parse(currentTemplatePageObj, PortalObjectPath.CANONICAL_FORMAT);
             Page selectedPage = (Page) portalObjectContainer.getObject(pageId);
             Collection portletWindows = selectedPage.getChildren(PortalObject.WINDOW_MASK);
             Iterator it= portletWindows.iterator();
             while (it.hasNext()) {
             WindowImpl window = (WindowImpl) it.next();
             templatePortletFromSelectedObject.put(window.getURI(), window.getName());
             else if (window.getContentType()==ContentType.CMS)
             templatePortletFromSelectedObject.put("CMSPortletInstance", window.getName());

            To find out more on how to use portal api you can refer to /core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java and other files in same package.

            • 4. Re: Getting Access to assigned Portlet Instances => Portlet
              Nico Ziegenhals Newbie

              Dear Vivek,

              thank you for your post. I will use your hint and post a solution here.