Interface Event

  • All Known Subinterfaces:
    JackrabbitEvent

    public interface Event
    An event fired by the observation mechanism.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int NODE_ADDED
      Generated on persist when a node is added.
      static int NODE_MOVED
      Generated on persist when a node is moved.
      static int NODE_REMOVED
      Generated on persist when a node is removed.
      static int PERSIST
      If event bundling is supported, this event is used to indicate a bundle boundary within the event journal.
      static int PROPERTY_ADDED
      Generated on persist when a property is added.
      static int PROPERTY_CHANGED
      Generated on persist when a property is changed.
      static int PROPERTY_REMOVED
      Generated on persist when a property is removed.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getDate()
      Returns the date when the change was persisted that caused this event.
      java.lang.String getIdentifier()
      Returns the identifier associated with this event or null if this event has no associated identifier.
      java.util.Map getInfo()
      Returns the information map associated with this event.
      java.lang.String getPath()
      Returns the absolute path associated with this event or null if this event has no associated identifier.
      int getType()
      Returns the type of this event: a constant defined by this interface.
      java.lang.String getUserData()
      Returns the user data set through ObservationManager.setUserData(java.lang.String) on the ObservationManager bound to the Session that caused the event.
      java.lang.String getUserID()
      Returns the user ID connected with this event.
    • Field Detail

      • NODE_ADDED

        static final int NODE_ADDED
        Generated 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 empty Map object.
        See Also:
        Constant Field Values
      • NODE_REMOVED

        static final int NODE_REMOVED
        Generated 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 empty Map object.
        See Also:
        Constant Field Values
      • PROPERTY_ADDED

        static final int PROPERTY_ADDED
        Generated 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 empty Map object.
        See Also:
        Constant Field Values
      • PROPERTY_REMOVED

        static final int PROPERTY_REMOVED
        Generated 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 empty Map object.
        See Also:
        Constant Field Values
      • PROPERTY_CHANGED

        static final int PROPERTY_CHANGED
        Generated 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 empty Map object.
        See Also:
        Constant Field Values
      • NODE_MOVED

        static final int NODE_MOVED
        Generated 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 a Session.move or Workspace.move then the returned Map has keys srcAbsPath and destAbsPath with values corresponding to the parameters passed to the move method.

          If the method that caused this event was a Node.orderBefore then the returned Map has keys srcChildRelPath and destChildRelPath with values corresponding to the parameters passed to the orderBefore method.

        Since:
        JCR 2.0
        See Also:
        Constant Field Values
      • PERSIST

        static final int PERSIST
        If event bundling is supported, this event is used to indicate a bundle boundary within the event journal.
        Since:
        JCR 2.0
        See Also:
        Constant Field Values
    • Method Detail

      • getType

        int getType()
        Returns the type of this event: a constant defined by this interface. One of:
        • NODE_ADDED
        • NODE_REMOVED
        • PROPERTY_ADDED
        • PROPERTY_REMOVED
        • PROPERTY_CHANGED
        • NODE_MOVED
        • PERSIST
        Returns:
        the type of this event.
      • getPath

        java.lang.String getPath()
                          throws RepositoryException
        Returns the absolute path associated with this event or null if 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

        java.lang.String getUserID()
        Returns the user ID connected with this event. This is the string returned by Session.getUserID() of the session that caused the event.
        Returns:
        the user ID.
      • getIdentifier

        java.lang.String getIdentifier()
                                throws RepositoryException
        Returns the identifier associated with this event or null if 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

        java.util.Map getInfo()
                       throws RepositoryException
        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 Map containing parameter information for instances of a NODE_MOVED event.
        Throws:
        RepositoryException - if an error occurs.
        Since:
        JCR 2.0
      • getDate

        long getDate()
              throws RepositoryException
        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