-
1. Re: Getting Access to assigned Portlet Instances => Portlet
vantek Mar 26, 2009 4:27 AM (in response to zicolino)Hi
it interests me to! -
2. Re: Getting Access to assigned Portlet Instances => Portlet
zicolino Mar 26, 2009 5:21 PM (in response to zicolino)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_saini07 Mar 27, 2009 1:12 PM (in response to zicolino)Hi
To get information regarding all deployed portlets, Mbean is<service-name>InstanceContainer</service-name> <service-class>org.jboss.portal.core.model.instance.InstanceContainer</service-class> <service-ref>:container=Instance</service-ref>
Example of using itCollection 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 liketemplatePortletFromSelectedObject = 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(); if(window.getContentType()==ContentType.PORTLET) 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
zicolino Mar 29, 2009 4:15 PM (in response to zicolino)Dear Vivek,
thank you for your post. I will use your hint and post a solution here.
Greetings