SiteVision Public API

The public API of SiteVision consists of two loosely coupled (but also very related) parts:

  1. The JCR Model API ("data" part of the API)
    The SiteVision data model can be accessed using the JSR 283 (Java Content Repository) standard.
  2. The Utilities API ("helper" part of the API)
    The utilities adds helpers and shortcuts that make your SiteVision development easier - especially if you use the JCR data model from Velocity.

API Documentation

The SiteVision Public API is documented via the Java Javadoc tool. The Javadoc contains both parts of the Public API (JCR Model and Utilities).

  1. The JCR Model API is located in the javax.jcr packages
  2. The Utilities API is located in the senselogic.sitevision.api packages.
Overview of SiteVision Public API Javadoc

Overview of SiteVision Public API Javadoc

Tip! Bookmark the Javdoc URL for swift access https://developer.sitevision.se/javadoc

API Updates

The SiteVision Public API is continuously updated. Interfaces, classes, enums, methods and fields are introduced, updated or deprecated. Bug fixes might affect previous behaviour. Properties of JCR Node Types are also continously introduced and updated.

Be sure to always check any potential @since and @deprecated markup in the documentation.

Always check the SiteVision Public API Change Log whenever you upgrade or a new SiteVision version is released. All changes in the Public API is listed there.

Accessing the API

More specific information about accessing the API and its parts are available in the JCR Model API section and the Utilities API section.

The API hooks are available as attributes in current javax.portlet.PortletRequest at all times.

Example: Retrieve the API hooks in a struts-2 portlet.

import com.opensymphony.xwork2.ActionContext;
import javax.portlet.PortletRequest;
import javax.jcr.Session;
import org.apache.struts2.dispatcher.DefaultActionSupport;
import senselogic.sitevision.api.Utils;

public class IndexAction
   extends DefaultActionSupport 
{
   @Override
   public String execute()
   {
       ActionContext ctx = ActionContext.getContext();
       PortletRequest request = (PortletRequest) ctx.get(
          "struts.portlet.request"
       );

       // Retrieve the JCR session - the hook to the JCR Model API
       Session jcrSession = (Session) request.getAttribute(
          "sitevision.jcr.session"
       );

       // Retrieve the SiteVision Utils - the hook to the Utilities API
       Utils sitevisionUtils = (Utils) request.getAttribute(
          "sitevision.utils"
       );
   
      ...
   
      return SUCCESS;
   }
}