Portal, Express Beta Version 6.1
Operating systems: i5/OS, Linux,Windows |
Portal models can be obtained using three different ways, depending on where the code using them resides.
try { Context ctx = new InitialContext(); ContentModelHome home = (ContentModelHome) ctx.lookup("portal:service/model/ContentModel"); if (home != null) { ContentModelProvider provider = home.getContentModelProvider(); ContentModel model = provider.getContentModel(aRequest, aResponse); ... } } catch (NamingException nx) { // some error handling code here }
PortletServiceHome psh; javax.naming.Context ctx = new javax.naming.InitialContext(); boolean serviceAvailable = false; try { psh = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.portlet.service.model.NavigationModelProvider"); serviceAvailable = true; } catch(javax.naming.NameNotFoundException ex) { ... error handling... } ... if (serviceAvailable) { NavigationModelProvider provider = (NavigationModelProvider) psh.getPortletService(NavigationModelProvider.class); NavigationModel model = provider.getNavigationModel(aRequest, aResponse); ... }
NavigationModelProvider provider = (NavigationModelProvider) PortletContext.getService("com.ibm.portal.ibmportlet.service.model.NavigationModelProvider"); if (provider != null) { NavigationModel model = provider.getNavigationModel(aRequest, aResponse); ... }