Index: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java (revision ) +++ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitObservationManager.java (revision ) @@ -0,0 +1,38 @@ +package org.apache.jackrabbit.api.observation; + +import javax.jcr.RepositoryException; +import javax.jcr.observation.EventListener; + +/** + * Jackrabbit specific extensions to {@link javax.jcr.observation.ObservationManager}. + */ +public interface JackrabbitObservationManager { + + /** + * Adds an event listener that listens for the events specified + * by the passed {@link JackrabbitEventFilter}. + *

+ * In addition to the EventFilter, the set of events reported + * will be further filtered by the access rights of the + * current Session. + *

+ * See {@link JackrabbitEventFilter} for a description of the filtering parameters available. + *

+ * The filter 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 filter. + * The implementation must ensure that no events are lost during the changeover. + *

+ * In addition to the filters placed on a listener above, the scope of + * observation support, in terms of which parts of a workspace are observable, may also + * be subject to implementation-specific restrictions. For example, in some + * repositories observation of changes in the jcr:system + * subgraph may not be supported. + * + * @param listener an {@link EventListener} object. + * @param filter an {@link JackrabbitEventFilter} object. + * @throws RepositoryException If an error occurs. + */ + void addEventListener(EventListener listener, JackrabbitEventFilter filter) + throws RepositoryException; +} Index: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java (revision ) +++ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java (revision ) @@ -0,0 +1,175 @@ +package org.apache.jackrabbit.api.observation; + +/** + * A storage object for event filter configuration. + *

+ * The parameters of the filter can then be set by chaining the set methods, + * since each method returns the same EventFilter with the indicated parameter set. + *

+ * Once the filter is configured, it and an {@link javax.jcr.observation.EventListener} object are + * passed to + * {@link org.apache.jackrabbit.api.observation.JackrabbitObservationManager#addEventListener(javax.jcr.observation.EventListener, JackrabbitEventFilter)}. + *

+ * The filter restricts which events are sent to the EventListener according to the + * following parameters. Note that the term associated parent node of an event means the + * parent node of the item at (or formerly at) the path returned by + * {@link javax.jcr.observation.Event#getPath}. + *

+ * The restrictions are "ANDed" together. In other words, for a particular node to be "listened to" it + * must meet all the restrictions. + * + */ +public interface JackrabbitEventFilter { // TODO extends EventFilter once JCR 2.1 is out + + /** + * Sets the eventTypes parameter of the filter. + * If left unset, this parameter defaults to null. + * @param eventTypes an int. + * @return This EventFilter object with the eventTypes parameter set. + */ + JackrabbitEventFilter setEventTypes(int eventTypes); + + /** + * Returns the eventTypes parameter of the filter. + * @return an int. + */ + int getEventTypes(); + + /** + * Sets the absPath parameter of the filter. + * If left unset, this parameter defaults to null. + * @param absPath an absolute path String. + * @return This EventFilter object with the absPath parameter set. + */ + JackrabbitEventFilter setAbsPath(String absPath); + + /** + * Returns the absPath parameter of the filter. + * @return a String. + */ + String getAbsPath(); + + /** + * Sets the isDeep parameter of the filter. + * If left unset, this parameter defaults to false. + * @param isDeep a boolean. + * @return This EventFilter object with the isDeep parameter set. + */ + JackrabbitEventFilter setIsDeep(boolean isDeep); + + /** + * Returns the isDeep parameter of the filter. + * @return a boolean. + */ + boolean getIsDeep(); + + /** + * Sets the identifiers parameter of the filter. + * If left unset, this parameter defaults to null. + * @param identifiers a String array. + * @return This EventFilter object with the identifiers parameter set. + */ + JackrabbitEventFilter setIdentifiers(String[] identifiers); + + /** + * Returns the uuids parameter of the filter. + * @return a String array. + */ + String[] getIdentifiers(); + + /** + * Sets the nodeTypeNames parameter of the filter. + * If left unset, this parameter defaults to null. + * @param nodeTypeNames a String array. + * @return This EventFilter object with the nodeTypes parameter set. + */ + JackrabbitEventFilter setNodeTypes(String[] nodeTypeNames); + + /** + * Returns the nodeTypeName parameter of the filter. + * @return a String array. + */ + String[] getNodeTypes(); + + /** + * Sets the noLocal parameter of the filter. + * If left unset, this parameter defaults to false. + * @param noLocal a boolean. + * @return This EventFilter object with the noLocal parameter set. + */ + JackrabbitEventFilter setNoLocal(boolean noLocal); + + /** + * Returns the noLocal parameter of the filter. + * @return a boolean. + */ + boolean getNoLocal(); + + /** + * Sets the absPaths parameter of the filter. + * If left unset, this parameter defaults to an empty array. + * @param absPaths an absolute path String array. + * @return This EventFilter object with the absPaths parameter set. + */ + JackrabbitEventFilter setAdditionalPaths(String[] absPaths); + + /** + * Returns the absPaths parameter of the filter. + * @return a String array. + */ + String[] getAdditionalPaths(); + + /** + * Sets the noExternal parameter of the filter. + * If left unset, this parameter defaults to false. + * @param noExternal a boolean. + * @return This EventFilter object with the noExternal parameter set. + */ + JackrabbitEventFilter setNoExternal(boolean noExternal); + + /** + * Returns the noExternal parameter of the filter. + * @return a boolean. + */ + boolean getNoExternal(); +} \ No newline at end of file