phpcr/src/PHPCR/Observation/ObservationManagerInterface.php
Copyright 2008-2011 Karsten Dambekalns karsten@typo3.org
Licensed 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.
\PHPCR\Observation\ObservationManagerInterface
Acquired via WorkspaceInterface::getObservationManager(). Allows for the registration and deregistration of event listeners.
The \Traversable interface enables the implementation to be addressed with foreach. ObservationManager has to implement either \IteratorAggregate or \Iterator. The iterator is equivalent to getRegisteredEventListeners() returning a list of all registered event listeners. The iterator keys have no significant meaning.
- Parent(s)
- \Traversable
- Api
Methods
addEventListener(\PHPCR\Observation\EventListenerInterface $listener, \PHPCR\Observation\EventFilterInterface $filter) : void
Adds an event listener that listens for the events specified by the passed {@link EventFilterInterface}.
In addition to the EventFilter, the set of events reported will be further filtered by the access rights of the current Session.
See EventFilter 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.
Name | Type | Description |
---|---|---|
$listener | \PHPCR\Observation\EventListenerInterface | |
$filter | \PHPCR\Observation\EventFilterInterface |
Exception | Description |
---|---|
\PHPCR\RepositoryException | If an error occurs. |
- Api
- Since
- JCR 2.1
createEventFilter() : \PHPCR\Observation\EventFilterInterface
Creates an EventFilter that can then be configured and passed to the method addEventListener.
Type | Description |
---|---|
\PHPCR\Observation\EventFilterInterface |
- Api
- Since
- JCR 2.1
getEventJournal(\PHPCR\Observation\EventFilterInterface $filter) : \PHPCR\Observation\EventJournalInterface
Retrieves the event journal for this workspace.
If journaled observation is not supported for this workspace, null is returned.
Events returned in the EventJournal instance will be filtered according to the parameters set on the EventFilter that is passed to this method.
Additionally, the current session's access restrictions as well as any additional restrictions specified through implementation-specific configuration will also affect the set of returned events.
Name | Type | Description |
---|---|---|
$filter | \PHPCR\Observation\EventFilterInterface |
Type | Description |
---|---|
\PHPCR\Observation\EventJournalInterface | an EventJournal (or null). |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
- Since
- JCR 2.1
getRegisteredEventListeners() : \Iterator
Returns all event listeners that have been registered through this session.
If no listeners have been registered, an empty iterator is returned.
Type | Description |
---|---|
\Iterator | implementing <b>SeekableIterator</b> and <b>Countable</b>. Values are the EventListenerInterface instances. Keys have no meaning. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api
removeEventListener(\PHPCR\Observation\EventListenerInterface $listener) : void
Deregisters an event listener.
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 onEvent method. In this case, the deregistration method returns immediately, but deregistration will effectively be delayed until the listener completes.
Name | Type | Description |
---|---|---|
$listener | \PHPCR\Observation\EventListenerInterface | The listener to deregister. |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs. |
- Api
setUserData(string $userData) : void
Sets the user data information that will be returned by EventInterface::getUserData().
Name | Type | Description |
---|---|---|
$userData | string | the user data |
Exception | Description |
---|---|
\PHPCR\RepositoryException | if an error occurs |
- Api