blob: bc5ad110ca21bdb01dc4ee23bef7cbd18875555a [file] [log] [blame]
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once 'PHPCR/RepositoryException.php';
require_once 'PHPCR/observation/EventListener.php';
require_once 'PHPCR/observation/EventListenerIterator.php';
/**
* The ObservationManager object.
* <p>
* Allows for the registration and deregistration of event listeners.
*
* @author Markus Nix <mnix@mayflower.de>
* @package phpcr
* @subpackage observation
*/
interface ObservationManager
{
/**
* Adds an event listener that listens for the specified <code>eventTypes</code> (a combination of one or more
* event types encoded as a bit mask value).
* <p>
* 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 <code>NODE_ADDED</code> and <code>NODE_REMOVED</code>, the node
* associated with an event is the node at (or formerly at) the path returned by <code>Event.getPath</code>.
* In the case of event types <code>PROPERTY_ADDED</code>, <code>PROPERTY_REMOVED</code> and
* <code>PROPERTY_CHANGED</code>, the node associated with an event is the parent node of the property at
* (or formerly at) the path returned by <code>Event.getPath</code>:
* <ul>
* <li>
* <code>absPath</code>, <code>isDeep</code>: Only events whose associated node is at
* <code>absPath</code> (or within its subtree, if <code>isDeep</code> is <code>true</code>) will be received.
* It is permissible to register a listener for a path where no node currently exists.
* </li>
* <li>
* <code>uuid</code>: Only events whose associated node has one of the UUIDs in this list will be
* received. If his parameter is <code>null</code> then no UUID-related restriction is placed on events
* received.
* </li>
* <li>
* <code>nodeTypeName</code>: 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 his parameter is
* <code>null</code> then no node type-related restriction is placed on events received.
* </li>
* </ul>
* The restrictions are "ANDed" together. In other words, for a particular node to be "listened to" it must meet all the restrictions.
* <p>
* Additionally, if <code>noLocal</code> is <code>true</code>, then events generated by the session through which
* the listener was registered are ignored. Otherwise, they are not ignored.
* <p>
* The filters of an already-registered <code>EventListener</code> can be changed at runtime by re-registering the
* same <code>EventListener</code> 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.
*
* @param listener an {@link EventListener} object.
* @param eventTypes A combination of one or more event type constants encoded as a bitmask.
* @param absPath an absolute path.
* @param isDeep a <code>boolean</code>.
* @param uuid array of UUIDs.
* @param nodeTypeName array of node type names.
* @param noLocal a <code>boolean</code>.
* @throws RepositoryException If an error occurs.
*/
public function addEventListener( EventListener $listener, $eventTypes, $absPath, $isDeep, $uuid, $nodeTypeName, $noLocal );
/**
* Deregisters an event listener.
* <p>
* A listener may be deregistered while it is being executed. The
* deregistration method will block until the listener has completed
* executing. An exception to this rule is a listener which deregisters
* itself from within the <code>onEvent</code> method. In this case, the
* deregistration method returns immediately, but deregistration will
* effectively be delayed until the listener completes.
*
* @param listener The listener to deregister.
*
* @throws RepositoryException If an error occurs.
*/
public function removeEventListener( EventListener $listener );
/**
* Returns all event listeners that have been registered through this session.
* If no listeners have been registered, an empty iterator is returned.
*
* @return an <code>EventListenerIterator</code>.
* @throws RepositoryException
*/
public function getRegisteredEventListeners();
}
?>