All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.jcr.observation.Event Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2009 Day Management AG, Switzerland. All rights reserved.
 */
package javax.jcr.observation;

import javax.jcr.RepositoryException;
import java.util.Map;

/**
 * An event fired by the observation mechanism.
 */
public interface Event {

    /**
     * Generated on persist when a node is added. 
  • {@link #getPath} * returns the absolute path of the node that was added.
  • {@link * #getIdentifier} returns the identifier of the node that was added.
  • *
  • {@link #getInfo} returns an empty Map object.
  • *
*/ public static final int NODE_ADDED = 0x1; /** * Generated on persist when a node is removed.
  • {@link #getPath} * returns the absolute path of the node that was removed.
  • {@link * #getIdentifier} returns the identifier of the node that was removed.
  • *
  • {@link #getInfo} returns an empty Map object.
  • *
*/ public static final int NODE_REMOVED = 0x2; /** * Generated on persist when a property is added.
  • {@link #getPath} * returns the absolute path of the property that was added.
  • {@link * #getIdentifier} returns the identifier of the parent node of the property * that was added.
  • {@link #getInfo} returns an empty Map * object.
*/ public static final int PROPERTY_ADDED = 0x4; /** * Generated on persist when a property is removed.
  • {@link * #getPath} returns the absolute path of the property that was * removed.
  • {@link #getIdentifier} returns the identifier of the * parent node of the property that was removed.
  • {@link #getInfo} * returns an empty Map object.
*/ public static final int PROPERTY_REMOVED = 0x8; /** * Generated on persist when a property is changed.
  • {@link * #getPath} returns the absolute path of the property that was * changed.
  • {@link #getIdentifier} returns the identifier of the * parent node of the property that was changed.
  • {@link #getInfo} * returns an empty Map object.
*/ public static final int PROPERTY_CHANGED = 0x10; /** * Generated on persist when a node is moved.
  • {@link #getPath} * returns the absolute path of the destination of the move.
  • {@link * #getIdentifier} returns the identifier of the moved node.
  • {@link * #getInfo} If the method that caused this event was a {@link * javax.jcr.Session#move Session.move} or {@link javax.jcr.Workspace#move * Workspace.move} then the returned {@link java.util.Map 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 {@link * javax.jcr.Node#orderBefore 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 */ public static final int NODE_MOVED = 0x20; /** * If event bundling is supported, this event is used to indicate a bundle * boundary within the event journal.
  • {@link #getPath} returns * null.
  • {@link #getIdentifier} returns * null.
  • {@link #getInfo} returns an empty * Map object.
* * @since JCR 2.0 */ public static final int PERSIST = 0x40; /** * 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
* * @return the type of this event. */ public int getType(); /** * 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. * * @return the absolute path associated with this event or * null
. * @throws RepositoryException if an error occurs. */ public String getPath() throws RepositoryException; /** * Returns the user ID connected with this event. This is the string * returned by {@link javax.jcr.Session#getUserID} of the session that * caused the event. * * @return the user ID. */ public String getUserID(); /** * 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. * * @return the identifier associated with this event or null. * @throws RepositoryException if an error occurs. * @since JCR 2.0 */ public String getIdentifier() 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. * * @return A Map containing parameter information for instances * of a NODE_MOVED event. * @throws RepositoryException if an error occurs. * @since JCR 2.0 */ public Map getInfo() throws RepositoryException; /** * Returns the user data set through {@link ObservationManager#setUserData} * on the ObservationManager bound to the Session * that caused the event. * * @return The user data string. * @throws RepositoryException if an error occurs. * @since JCR 2.0 */ public String getUserData() 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. * * @return the date when the change was persisted that caused this event. * @throws RepositoryException if an error occurs. * @since JCR 2.0 */ public long getDate() throws RepositoryException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy