KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > mdr > events > MDRPreChangeListener


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.api.mdr.events;
20
21 import java.util.EventListener JavaDoc;
22
23 /** Listener interface containing methods that allow clients to keep track of planned
24  * changes in the metadata before they are performed. Both methods defined in this
25  * interface should be called synchronously. It is forbidden to use these methods
26  * to make changes in the repository - code in these methods should have only
27  * read access to the MDR. Implementors of these methods should keep in mind that the
28  * longer the code in their implementation of these methods performs, the longer the whole
29  * repository is blocked by the source operation that fired these events.<p>
30  * It is not guaranteed that operations of this listener interface will see the intermediate
31  * state of any complex operation (like addAll). This behavior is implementation specific
32  * so the pre-change listeners should not rely on it.
33  * <p>Note: Adding a listener to any of the MDR event sources is not considered as a write
34  * operation.
35  *
36  * @author Martin Matula
37  */

38 public interface MDRPreChangeListener extends MDRChangeListener {
39     /** This method gets called when a repository change is planned to occur.
40      * Any operation that performs a change in MDR has to fire this notification
41      * synchronously on each registered pre-change listener before the change is performed.<p>
42      * Any run-time exception thrown by the implementation of this method should
43      * not affect the events dispatching (i.e. it should be ignored by the event source).
44      * @param e Object describing the planned change.
45      */

46     public void plannedChange(MDRChangeEvent e) throws VetoChangeException;
47     
48     /** This method gets called if a planned change (which was already announced
49      * by calling {@link #plannedChange} was cancelled (e.g. the operation that was
50      * going to perform the change failed). This method is called synchronously by
51      * the operation that tried to perform the change.<p>
52      * Any run-time exception thrown by the implementation of this method should
53      * not affect the events dispatching (i.e. it should be ignored by the event source).
54      * @param e Object describing the cancelled change (has to be the same instance
55      * as passed to the {@link #plannedChange} method).
56      */

57     public void changeCancelled(MDRChangeEvent e);
58 }
59
Popular Tags