public class JCRObservationManager extends Object implements javax.jcr.observation.ObservationManager
| Modifier and Type | Class and Description |
|---|---|
static class |
JCRObservationManager.EventWrapper |
| Modifier and Type | Field and Description |
|---|---|
static int |
API |
static int |
EXTERNAL_SYNC |
static int |
IMPORT |
static int |
NODE_CHECKIN |
static int |
NODE_CHECKOUT |
static int |
NODE_CHECKPOINT |
static int |
NODE_MERGE |
static int |
NODE_RESTORE |
static int |
NODE_UPDATE |
static int |
SESSION_SAVE |
static int |
WORKSPACE_CLONE |
static int |
WORKSPACE_COPY |
static int |
WORKSPACE_CREATE_ACTIVITY |
static int |
WORKSPACE_MOVE |
| Constructor and Description |
|---|
JCRObservationManager(JCRWorkspaceWrapper ws) |
| Modifier and Type | Method and Description |
|---|---|
static void |
addEvent(javax.jcr.observation.Event event,
String mountPoint,
String relativeRoot) |
void |
addEventListener(javax.jcr.observation.EventListener listener,
int eventTypes,
String absPath,
boolean isDeep,
String[] uuid,
String[] nodeTypeName,
boolean noLocal)
Adds an event listener that listens for the specified
eventTypes (a combination of one or more
event types encoded as a bit mask value). |
static void |
consume(List<JCRObservationManager.EventWrapper> list,
JCRSessionWrapper session,
int operationType,
int lastOperationType) |
static <X> X |
doWithOperationType(JCRSessionWrapper session,
int operationType,
JCRCallback<X> callback) |
static <X> X |
doWorkspaceWriteCall(JCRSessionWrapper session,
int operationType,
JCRCallback<X> callback) |
static Integer |
getCurrentOperationType() |
javax.jcr.observation.EventJournal |
getEventJournal() |
javax.jcr.observation.EventJournal |
getEventJournal(int i,
String s,
boolean b,
String[] strings,
String[] strings1) |
static JCRObservationManager.EventWrapper |
getEventWrapper(javax.jcr.observation.Event event,
JCRSessionWrapper session,
String mountPoint,
String relativeRoot) |
static List<String> |
getNodeTypesForDeletedNode(javax.jcr.observation.Event event)
Returns a list of node types for deleted node, if this information is available in the provided event object.
|
javax.jcr.observation.EventListenerIterator |
getRegisteredEventListeners()
Returns all event listeners that have been registered through this session.
|
static boolean |
isExtensionNode(String path)
Check if the denoted path is in a mounted folder
|
static void |
popEventListenersAvailableDuringPublishOnly()
Switches the scope of listeners for publication to off.
|
static void |
pushEventListenersAvailableDuringPublishOnly()
Switches the scope of listeners for publication, that means that only listeners, targeted at publication stage, will be called,
before the last call to
popEventListenersAvailableDuringPublishOnly() will be done (the last caller will call the pop
method). |
void |
removeEventListener(javax.jcr.observation.EventListener listener)
Deregisters an event listener.
|
static void |
setAllEventListenersDisabled(Boolean eventsDisabled) |
static void |
setEventListenersAvailableDuringPublishOnly(Boolean eventsDisabled)
Deprecated.
use directly
pushEventListenersAvailableDuringPublishOnly() and
popEventListenersAvailableDuringPublishOnly() methods as they consider the number of calls to this method |
void |
setUserData(String userData) |
public static final int SESSION_SAVE
public static final int WORKSPACE_MOVE
public static final int WORKSPACE_COPY
public static final int WORKSPACE_CLONE
public static final int WORKSPACE_CREATE_ACTIVITY
public static final int NODE_CHECKIN
public static final int NODE_CHECKOUT
public static final int NODE_CHECKPOINT
public static final int NODE_RESTORE
public static final int NODE_UPDATE
public static final int NODE_MERGE
public static final int EXTERNAL_SYNC
public static final int IMPORT
public static final int API
public JCRObservationManager(JCRWorkspaceWrapper ws)
public static void consume(List<JCRObservationManager.EventWrapper> list, JCRSessionWrapper session, int operationType, int lastOperationType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic void removeEventListener(javax.jcr.observation.EventListener listener)
throws javax.jcr.RepositoryException
onEvent method. In this case, the
deregistration method returns immediately, but deregistration will
effectively be delayed until the listener completes.removeEventListener in interface javax.jcr.observation.ObservationManagerlistener - The listener to deregister.javax.jcr.RepositoryException - If an error occurs.public javax.jcr.observation.EventListenerIterator getRegisteredEventListeners()
throws javax.jcr.RepositoryException
getRegisteredEventListeners in interface javax.jcr.observation.ObservationManagerEventListenerIterator.javax.jcr.RepositoryExceptionpublic void setUserData(String userData) throws javax.jcr.RepositoryException
setUserData in interface javax.jcr.observation.ObservationManagerjavax.jcr.RepositoryExceptionpublic javax.jcr.observation.EventJournal getEventJournal()
throws javax.jcr.RepositoryException
getEventJournal in interface javax.jcr.observation.ObservationManagerjavax.jcr.RepositoryExceptionpublic javax.jcr.observation.EventJournal getEventJournal(int i,
String s,
boolean b,
String[] strings,
String[] strings1)
throws javax.jcr.RepositoryException
getEventJournal in interface javax.jcr.observation.ObservationManagerjavax.jcr.RepositoryException@Deprecated public static void setEventListenersAvailableDuringPublishOnly(Boolean eventsDisabled)
pushEventListenersAvailableDuringPublishOnly() and
popEventListenersAvailableDuringPublishOnly() methods as they consider the number of calls to this methodeventsDisabled - true to enable event listeners targeted for publication only; false enables all the
listenerspublic static void pushEventListenersAvailableDuringPublishOnly()
popEventListenersAvailableDuringPublishOnly() will be done (the last caller will call the pop
method).public static void popEventListenersAvailableDuringPublishOnly()
public static void setAllEventListenersDisabled(Boolean eventsDisabled)
public static void addEvent(javax.jcr.observation.Event event,
String mountPoint,
String relativeRoot)
public static JCRObservationManager.EventWrapper getEventWrapper(javax.jcr.observation.Event event, JCRSessionWrapper session, String mountPoint, String relativeRoot)
public void addEventListener(javax.jcr.observation.EventListener listener,
int eventTypes,
String absPath,
boolean isDeep,
String[] uuid,
String[] nodeTypeName,
boolean noLocal)
throws javax.jcr.RepositoryException
eventTypes (a combination of one or more
event types encoded as a bit mask value).
The set of events can be filtered by specifying restrictions based on characteristics of the node associated
with the event. In the case of event types NODE_ADDED and NODE_REMOVED, the node
associated with an event is the node at (or formerly at) the path returned by Event.getPath.
In the case of event types PROPERTY_ADDED, PROPERTY_REMOVED and
PROPERTY_CHANGED, the node associated with an event is the parent node of the property at
(or formerly at) the path returned by Event.getPath:
absPath, isDeep: Only events whose associated node is at
absPath (or within its subtree, if isDeep is true) will be received.
It is permissible to register a listener for a path where no node currently exists. The path can also be
a regular expression (as the parameter is an absolute path, Jahia will automatically add the begin/end line
character and if isDeep is true, Jahia appends to the regular expression, to include the path and subtree).
If this parameter is null then no path-related restriction is placed on events received.
uuid: Only events whose associated node has one of the UUIDs in this list will be
received. If his parameter is null then no UUID-related restriction is placed on events
received.
nodeTypeName: Only events whose associated node has one of the node types
(or a subtype of one of the node types) in this list will be received. If this parameter is
null then no node type-related restriction is placed on events received.
WARNING: if a listener only filters on nodeTypeName, then this can slow down the system, as for all
events we need to determine the nodeType of the node. If possible you should use another filter like
the path to reduce the number of events, where nodetype needs to be determined.
noLocal is true, then events generated by the session through which
the listener was registered are ignored. Otherwise, they are not ignored.
The filters of an already-registered EventListener can be changed at runtime by re-registering the
same EventListener object (i.e. the same actual Java object) with a new set of filter arguments.
The implementation must ensure that no events are lost during the changeover.addEventListener in interface javax.jcr.observation.ObservationManagerlistener - an EventListener object.eventTypes - A combination of one or more event type constants encoded as a bitmask.absPath - an absolute path.isDeep - a boolean.uuid - array of UUIDs.nodeTypeName - array of node type names.noLocal - a boolean.javax.jcr.RepositoryException - If an error occurs.public static <X> X doWorkspaceWriteCall(JCRSessionWrapper session, int operationType, JCRCallback<X> callback) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static <X> X doWithOperationType(JCRSessionWrapper session, int operationType, JCRCallback<X> callback) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static Integer getCurrentOperationType()
public static boolean isExtensionNode(String path) throws javax.jcr.RepositoryException
path - javax.jcr.RepositoryException - in case of JCR-related errorspublic static List<String> getNodeTypesForDeletedNode(javax.jcr.observation.Event event)
event - the event for deleted nodeCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.