Making modifications by using the Controller SPI

The Controller SPI allows you to modify portal resources, the topology of the portal, and properties.

The following topics describe how you use the Controller SPI for different types of modifications. Some topics provide example code snippets. For these snippets to work, they need to be completed with preceding and subsequent code. Examples are shown in the following.
Preceding code: Each snippet must be preceded at least by the following code:

ContentModelController cmController= null;
final Context ctx = new InitialContext();
final ContentModelControllerHome home = (ContentModelControllerHome) 
      ctx.lookup(ContentModelControllerHome.CONTENT_MODEL_CONTROLLER_JNDI_NAME);
if (homeĀ != null) {
      cmController = home.getContentModelControllerProvider().
           createContentModelController(aContentModel);
}

Depending on the modification that you want to make, you might require additional preceding code statements. For more details refer to Obtaining a controller for working with resources.
Subsequent code: After you have completed modifications, you commit the controller so that the modification take effect. After that you cannot use or commit the controller any more, but you dispose it. To commit modifications and dispose the controller, add the following statements to code:

// commit the controller
try {
    controller.commit();
} finally {
    controller.dispose();
}

For more details about this refer to Committing and persisting modifications.


Parent

Controller SPI
Packages of the Controller SPI
Work with controllers
Confirming modifications
Hints and tips for using the Controller SPI


Related tasks


Obtaining a controller for working with resources
Committing and persisting modifications

 


+

Search Tips   |   Advanced Search