Obtain a controller for working with resources
To modify, create, or delete portal resources using the Controller SPI, create a controller using a JNDI lookup for the "home" interface. The following controllers are available via JNDI:
Controller Look up string in JNDI ContentModelController ContentModelControllerHome.CONTENT_MODEL_CONTROLLER_JNDI_NAME PortletModelController PortletModelControllerHome.PORTLET_MODEL_CONTROLLER_JNDI_NAME
The LayoutModelController cannot be obtained via a JNDI lookup. You obtain it through its associated ContentModelController.
Example - Obtaining a content model controller:ContentModelController result = null; final Context ctx = new InitialContext(); final ContentModelControllerHome home = (ContentModelControllerHome) ctx.lookup(ContentModelControllerHome.CONTENT_MODEL_CONTROLLER_JNDI_NAME); if (home != null) { result = home.getContentModelControllerProvider().createContentModelController(aContentModel); }To obtain a ContentModelController, pass an existing content model to the createContentModelController method of the ContentModelControllerProvider.
Obtain a layout model controller for a specific page:// locate the page for which to create a LayoutModelController final Locator locator = cmController.getLocator(); final ContentPage page = (ContentPage) locator.findByUniqueName("MyPage"); // create a LayoutModelController final LayoutModelController lmController = cmController.getLayoutModelController(page);
Parent Work with controllersRelated concepts:
Obtain a model from the portal