Brix uses the concept of wrapping for intercepting JCR calls and extending the API functionality.

There are two wrapper in Brix.

Base Wrapper

Base wrapper’s main functionality is to provide notification about API calls and also to provide certain degree of caching.

In order for the base wrapper to provide API calls notifications it uses actions and events.


Actions are notifications right before and right after certain JCR API calls. Classes that require actions notification should extend AbstractActionHandler?. The handler must be registered with wrapped Session using the BrixSession?#addActionHandler(AbstractActionHandler? handler) method to receive the notifications.

As an usecase example, actions are handy to intercept API calls before they are executed to check the appropriate permissions.


Events are suitable for scenarios where actions are too finegrained and too frequent. When Item or Session is saved, Base Wrapper can provide normalized list of events concerning the Item (or entire Session) that have happened before the save call.

Possible events are defined in package brix.jcr.base.event.

In order to receive the events object that implements EventListener? must be registered with BrixSession? using BrixSession?#addEventsListener(EventsListener? listener).

The listener will then obtain normalized list of Event objects right before and right after the Item (or Session) has been saved.

API Wrapper

API Wrapper wraps around the BaseWrapper? and provides additional functionality. Most notably the API Wrapper extends each Jcr API interface with an interface that removes the checked exceptions. The exceptions are handled and translated to unchecked exceptions by the wrapper. The exception handling is pluggable.

E.g. instead of Node interface the wrapper uses JcrNode? interface that extends the Node interface but removes the checked exceptions.

Another significant feature of API Wrapper is automatic node wrapping by custom subclasses of NodeWrapper?. The custom wrapping depends on SessionBehavior?#wrap(Node node, JcrSession? session) method implementation.

To wrap a regular Session with a API Wrapper JcrSession? use the Brix#wrapSession(Session session) method.

This is a unique website which will require a more modern browser to work!

Please upgrade today!