Sitevision Public API
The public API of Sitevision consists of two loosely coupled (but also very related) parts:
- The JCR Model API ("data" part of the API)
The Sitevision data model can be accessed using the JSR 283 (Java Content Repository) standard. - 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).
- The JCR Model API is located in the javax.jcr packages
- The Utilities API is located in the senselogic.sitevision.api packages.
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
The API hooks are available as attributes in current javax.portlet.PortletRequest at all times.
More specific information about accessing the API and its parts are available in the JCR Model API section and the Utilities API section.
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;
}
}