Controller SPI
The Controller SPI enhances the read-only portal Model SPI by adding writable aspects. Controllers offer methods to modify the topology and properties of the model, and of its nodes. Modifications are instantly reflected for the controller, and to the persistence layer after they are commited.
Classes and interfaces include...
Model SPI Controller SPI ContentNode
- MarkupCapable
- Localized
- Identifiable
- ActiveFlag
ModifiableContentNode
- ModifiableMarkupCapable
- ModifiableLocalized
- ModifiableIdentifiable
- ModifiableActiveFlag
Controller instances workspaces are where we make modifications, assessing them in a preview mode. When changes meet the requirements, we apply them to the portal with a commit step. We can make and apply the changes to a running portal environment. We do not need to restart the portal for the changes to take effect.
Controllers:
Content Model Controller Modify the content topology, and the properties of content nodes such as pages, labels, and content URLs. Modifying content topology may change navigation of the portal for the users. Layout Model Controller Modify the layout of a page, such as the topology of layout elements of a page, and the properties of layout elements such as layout containers and layout controls. Portlet Model Controller Create, update, and delete portlets.
There is no controller for the following models:
NavigationModel This is by implication of the structure of the content model. NavigationSelectionModel Computed from the navigational state per request. LanguageList, MarkupList, SkinList, and ThemeList.
A controller is based on the corresponding read-only model. When a controller is created on the basis of a read-only model, both the controller and the model expose the same information. We use the controller to create, update, or delete information exposed through it. These changes will be reflected in the controller immediately. To persist changes made to the underlying read-only model, we commit the controller.
Controller methods...
- Provide modifiable instances of existing resources.
These modifiable instances exist for each modifiable resource property, and they allow for these properties to be modified.
- Create and delete model resources.
- Obtain dependent controllers. This is optional. For example, a ContentModelController offers a method to obtain a LayoutModelController.
- Persist the modifications.
Scope of the Controller SPI
A controller instance is based on a read-only model instance. Therefore it has the same scope and lifetime as the corresponding read-only model. Consequently, the following equivalences apply:
- If the underlying model is scoped to a particular user, then so is the controller.
- If the underlying model is scoped to a request, then so is the controller.
- If the underlying model is scoped to a virtual portal, then so is the controller.
See
Parent DevelopingRelated concepts:
Model SPI overview
HCL WebSphere Portal 8 API and SPI Reference