KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ddloaders > web > event > DDChangeEvent


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
20 package org.netbeans.modules.j2ee.ddloaders.web.event;
21
22 import org.netbeans.modules.j2ee.ddloaders.web.DDDataObject;
23
24 /** DDChangeEvent describes the change that affects deployment of web application.
25  * Deployment descriptor object can listen to these changes
26  * and update its configuration according to change.
27  *
28  * @author Radim Kubacki
29  */

30 public class DDChangeEvent extends java.util.EventObject JavaDoc {
31
32     /** Event fired when new servlet is added or copied from another location */
33     public static final int SERVLET_ADDED = 1;
34
35     /** Event fired when servlet is renamed or moved within one web module */
36     public static final int SERVLET_CHANGED = 2;
37     
38     /** Event fired when servlet is deleted */
39     public static final int SERVLET_DELETED = 3; // delete
40

41     /** Event fired when servlet is moved from one web module to another one */
42     public static final int SERVLET_MOVED = 4;
43     
44     /** Event fired when new filter is added or copied from another location */
45     //public static final int FILTER_ADDED = 5;
46

47     /** Event fired when filter is renamed or moved within one web module */
48     public static final int FILTER_CHANGED = 6;
49     
50     /** Event fired when filter is deleted */
51     public static final int FILTER_DELETED = 7;
52     
53     /** Event fired when listener is moved from one web module to another one */
54     //public static final int FILTER_MOVED = 8;
55

56     /** Event fired when new listener is added or copied from another location */
57     //public static final int LISTENER_ADDED = 9;
58

59     /** Event fired when listener is renamed or moved within one web module */
60     public static final int LISTENER_CHANGED = 10;
61     
62     /** Event fired when listener is deleted */
63     public static final int LISTENER_DELETED = 11;
64     
65     /** Event fired when listener is moved from one web module to another one */
66     //public static final int LISTENER_MOVED = 12;
67

68     /** Event fired when new JSP is added or copied from another location */
69     //public static final int JSP_ADDED = 13;
70

71     /** Event fired when JSP is renamed or moved within one web module */
72     public static final int JSP_CHANGED = 14;
73     
74     /** Event fired when JSP is deleted */
75     public static final int JSP_DELETED = 15;
76     
77     /** Event fired when JSP is moved from one web module to another one */
78     //public static final int JSP_MOVED = 16;
79

80     /** Newly set value. Usually current classname of servlet if it makes sense. */
81     private String JavaDoc newValue;
82     
83     /** Old value. Usually old classname of servlet if it makes sense. */
84     private String JavaDoc oldValue;
85     
86     /** Event type */
87     private int type;
88     
89     /** placeholder for old depl. descriptor (only for servlet moves) */
90     private DDDataObject oldDD;
91     
92     /** Creates new event.
93      *
94      * @param src class name of servlet
95      * @param type type of change
96      */

97     public DDChangeEvent (Object JavaDoc src, DDDataObject oldDD, String JavaDoc oldVal, String JavaDoc newVal, int type) {
98         super (src);
99         newValue = newVal;
100         oldValue = oldVal;
101         this.type = type;
102         this.oldDD = oldDD;
103     }
104     
105     /** Creates new event.
106      *
107      * @param src class name of servlet
108      * @param type type of change
109      */

110     public DDChangeEvent (Object JavaDoc src, String JavaDoc oldVal, String JavaDoc newVal, int type) {
111         this (src, null, oldVal, newVal, type);
112     }
113     
114     public String JavaDoc getNewValue () {
115         return newValue;
116     }
117     
118     public String JavaDoc getOldValue () {
119         return oldValue;
120     }
121     
122     public DDDataObject getOldDD () {
123         return oldDD;
124     }
125     
126     /** Getter for change type
127      *
128      * @return change type
129      */

130     public int getType () {
131         return type;
132     }
133     
134     public String JavaDoc toString () {
135         return "DDChangeEvent "+getSource ()+" of type "+type; // NOI18N
136
}
137     
138 }
139
Popular Tags