Package javax.jcr.observation
Interface Event
- All Known Subinterfaces:
JackrabbitEvent
public interface Event
An event fired by the observation mechanism.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intGenerated on persist when a node is added.static final intGenerated on persist when a node is moved.static final intGenerated on persist when a node is removed.static final intIf event bundling is supported, this event is used to indicate a bundle boundary within the event journal.static final intGenerated on persist when a property is added.static final intGenerated on persist when a property is changed.static final intGenerated on persist when a property is removed. -
Method Summary
Modifier and TypeMethodDescriptionlonggetDate()Returns the date when the change was persisted that caused this event.Returns the identifier associated with this event ornullif this event has no associated identifier.getInfo()Returns the information map associated with this event.getPath()Returns the absolute path associated with this event ornullif this event has no associated identifier.intgetType()Returns the type of this event: a constant defined by this interface.Returns the user data set throughObservationManager.setUserData(java.lang.String)on theObservationManagerbound to theSessionthat caused the event.Returns the user ID connected with this event.
-
Field Details
-
NODE_ADDED
static final int NODE_ADDEDGenerated on persist when a node is added.getPath()returns the absolute path of the node that was added.getIdentifier()returns the identifier of the node that was added.getInfo()returns an emptyMapobject.
- See Also:
-
NODE_REMOVED
static final int NODE_REMOVEDGenerated on persist when a node is removed.getPath()returns the absolute path of the node that was removed.getIdentifier()returns the identifier of the node that was removed.getInfo()returns an emptyMapobject.
- See Also:
-
PROPERTY_ADDED
static final int PROPERTY_ADDEDGenerated on persist when a property is added.getPath()returns the absolute path of the property that was added.getIdentifier()returns the identifier of the parent node of the property that was added.getInfo()returns an emptyMapobject.
- See Also:
-
PROPERTY_REMOVED
static final int PROPERTY_REMOVEDGenerated on persist when a property is removed.getPath()returns the absolute path of the property that was removed.getIdentifier()returns the identifier of the parent node of the property that was removed.getInfo()returns an emptyMapobject.
- See Also:
-
PROPERTY_CHANGED
static final int PROPERTY_CHANGEDGenerated on persist when a property is changed.getPath()returns the absolute path of the property that was changed.getIdentifier()returns the identifier of the parent node of the property that was changed.getInfo()returns an emptyMapobject.
- See Also:
-
NODE_MOVED
static final int NODE_MOVEDGenerated on persist when a node is moved.getPath()returns the absolute path of the destination of the move.getIdentifier()returns the identifier of the moved node.-
getInfo()If the method that caused this event was aSession.moveorWorkspace.movethen the returnedMaphas keyssrcAbsPathanddestAbsPathwith values corresponding to the parameters passed to themovemethod.If the method that caused this event was a
Node.orderBeforethen the returnedMaphas keyssrcChildRelPathanddestChildRelPathwith values corresponding to the parameters passed to theorderBeforemethod.
- Since:
- JCR 2.0
- See Also:
-
PERSIST
static final int PERSISTIf event bundling is supported, this event is used to indicate a bundle boundary within the event journal.getPath()returnsnull.getIdentifier()returnsnull.getInfo()returns an emptyMapobject.
- Since:
- JCR 2.0
- See Also:
-
-
Method Details
-
getType
int getType()Returns the type of this event: a constant defined by this interface. One of:NODE_ADDEDNODE_REMOVEDPROPERTY_ADDEDPROPERTY_REMOVEDPROPERTY_CHANGEDNODE_MOVEDPERSIST
- Returns:
- the type of this event.
-
getPath
Returns the absolute path associated with this event ornullif this event has no associated identifier. The meaning of the associated path depends upon the type of the event. See event type constants above.- Returns:
- the absolute path associated with this event or
null. - Throws:
RepositoryException- if an error occurs.
-
getUserID
String getUserID()Returns the user ID connected with this event. This is the string returned bySession.getUserID()of the session that caused the event.- Returns:
- the user ID.
-
getIdentifier
Returns the identifier associated with this event ornullif this event has no associated identifier. The meaning of the associated identifier depends upon the type of the event. See event type constants above.- Returns:
- the identifier associated with this event or
null. - Throws:
RepositoryException- if an error occurs.- Since:
- JCR 2.0
-
getInfo
Returns the information map associated with this event. The meaning of the map depends upon the type of the event. See event type constants above.- Returns:
- A
Mapcontaining parameter information for instances of aNODE_MOVEDevent. - Throws:
RepositoryException- if an error occurs.- Since:
- JCR 2.0
-
getUserData
Returns the user data set throughObservationManager.setUserData(java.lang.String)on theObservationManagerbound to theSessionthat caused the event.- Returns:
- The user data string.
- Throws:
RepositoryException- if an error occurs.- Since:
- JCR 2.0
-
getDate
Returns the date when the change was persisted that caused this event. The date is represented as a millisecond value that is an offset from the Epoch, January 1, 1970 00:00:00.000 GMT (Gregorian). The granularity of the returned value is implementation dependent.- Returns:
- the date when the change was persisted that caused this event.
- Throws:
RepositoryException- if an error occurs.- Since:
- JCR 2.0
-