KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > observation > VetoableEventListener


1 /*
2  * $Id: VetoableEventListener.java,v 1.2 2004/07/24 00:16:23 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.observation;
25
26 /**
27  * A vetoable event listener.
28  * <p/>
29  * <b>Level 2 only</b>
30  * <p/>
31  * A <code>VetoableEventListener</code> can be
32  * registered via the <code>{@link javax.jcr.observation.ObservationManager}</code> object.
33  * Vetoable event listeners may veto the action that the events represent. If an
34  * event is vetoed, the corresponding action is forbidden by the repository.
35  * Vetoable listeners are notified synchronously, and see events prior to the
36  * repository acting upon them. A vetoable listener only sees events for which
37  * the ticket that registered it has sufficient access rights.
38  * <p/>
39  * To veto an event, a class implementing the <code>VetoableEventListener</code>
40  * interface returns true from the <code>onEvent</code> method. If this happens
41  * during a transaction, the transaction is rolled back. If multiple vetoable
42  * listeners are registered, the first listener to veto an event causes the
43  * original operation to fail. No other vetoable listener is invoked.
44  *
45  * @author Tim Anderson
46  * @author Peeter Piegaze
47  */

48 public interface VetoableEventListener {
49
50   /**
51    * Performs some action upon receipt of the event. Returning
52    * <code>false</code> will cause the operation in question to proceed,,
53    * returning false will veto the operation in quetion.
54    *
55    * @param event
56    * @return <code>true</code> to veto, <code>false</code> to proceed
57    */

58   public boolean onEvent(Event event);
59 }
60
Popular Tags