KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > dd > impl > web > WebAppProxy


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.dd.impl.web;
21
22 import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException;
23 import org.netbeans.modules.j2ee.dd.api.web.JspConfig;
24 import org.netbeans.modules.j2ee.dd.api.web.WebApp;
25 import org.netbeans.modules.j2ee.dd.impl.common.DDProviderDataObject;
26 import org.netbeans.modules.schema2beans.Schema2BeansUtil;
27 import org.netbeans.modules.schema2beans.BaseBean;
28 import org.openide.loaders.DataObject;
29 import org.openide.filesystems.FileLock;
30 import java.io.OutputStream JavaDoc;
31
32 /**
33  * @author mk115033
34  */

35 public class WebAppProxy implements WebApp {
36     private WebApp webApp;
37     private String JavaDoc version;
38     private java.util.List JavaDoc listeners;
39     public boolean writing=false;
40     private org.xml.sax.SAXParseException JavaDoc error;
41     private int ddStatus;
42     private Schema2BeansUtil.ReindentationListener reindentationListener = new Schema2BeansUtil.ReindentationListener();
43
44     /** Creates a new instance of WebAppProxy */
45     public WebAppProxy(WebApp webApp, String JavaDoc version) {
46         this.webApp=webApp;
47         this.version = version;
48         listeners = new java.util.ArrayList JavaDoc();
49         addPropertyChangeListener(reindentationListener);
50     }
51
52     public void setOriginal(WebApp webApp) {
53         if (this.webApp!=webApp) {
54             for (int i=0;i<listeners.size();i++) {
55                 java.beans.PropertyChangeListener JavaDoc pcl =
56                     (java.beans.PropertyChangeListener JavaDoc)listeners.get(i);
57                 if (this.webApp!=null) this.webApp.removePropertyChangeListener(pcl);
58                 if (webApp!=null) webApp.addPropertyChangeListener(pcl);
59
60             }
61             this.webApp=webApp;
62             if (webApp!=null) setProxyVersion(webApp.getVersion());
63         }
64     }
65
66     public WebApp getOriginal() {
67         return webApp;
68     }
69
70     public void setProxyVersion(java.lang.String JavaDoc value) {
71         if ((version==null && value!=null) || !version.equals(value)) {
72             java.beans.PropertyChangeEvent JavaDoc evt =
73                 new java.beans.PropertyChangeEvent JavaDoc(this, PROPERTY_VERSION, version, value);
74             version=value;
75             for (int i=0;i<listeners.size();i++) {
76                 ((java.beans.PropertyChangeListener JavaDoc)listeners.get(i)).propertyChange(evt);
77             }
78         }
79     }
80     /*
81     public void setVersion(java.lang.String value) {
82     }
83     */

84     public java.lang.String JavaDoc getVersion() {
85         return version;
86     }
87     public org.xml.sax.SAXParseException JavaDoc getError() {
88         return error;
89     }
90     public void setError(org.xml.sax.SAXParseException JavaDoc error) {
91         this.error=error;
92     }
93     public int getStatus() {
94         return ddStatus;
95     }
96     public void setStatus(int value) {
97         if (ddStatus!=value) {
98             java.beans.PropertyChangeEvent JavaDoc evt =
99                 new java.beans.PropertyChangeEvent JavaDoc(this, PROPERTY_STATUS, new Integer JavaDoc(ddStatus), new Integer JavaDoc(value));
100             ddStatus=value;
101             for (int i=0;i<listeners.size();i++) {
102                 ((java.beans.PropertyChangeListener JavaDoc)listeners.get(i)).propertyChange(evt);
103             }
104         }
105     }
106
107     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
108         if (webApp!=null) webApp.addPropertyChangeListener(pcl);
109         listeners.add(pcl);
110     }
111
112     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
113         if (webApp!=null) webApp.removePropertyChangeListener(pcl);
114         listeners.remove(pcl);
115     }
116
117     public int addContextParam(org.netbeans.modules.j2ee.dd.api.common.InitParam value) {
118         return webApp==null?-1:webApp.addContextParam(value);
119     }
120
121     public int addEjbLocalRef(org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef value) {
122         return webApp==null?-1:webApp.addEjbLocalRef(value);
123     }
124
125     public int addEjbRef(org.netbeans.modules.j2ee.dd.api.common.EjbRef value) {
126         return webApp==null?-1:webApp.addEjbRef(value);
127     }
128
129     public int addEnvEntry(org.netbeans.modules.j2ee.dd.api.common.EnvEntry value) {
130         return webApp==null?-1:webApp.addEnvEntry(value);
131     }
132
133     public int addErrorPage(org.netbeans.modules.j2ee.dd.api.web.ErrorPage value) {
134         return webApp==null?-1:webApp.addErrorPage(value);
135     }
136
137     public int addFilter(org.netbeans.modules.j2ee.dd.api.web.Filter value) {
138         return webApp==null?-1:webApp.addFilter(value);
139     }
140
141     public int addFilterMapping(org.netbeans.modules.j2ee.dd.api.web.FilterMapping value) {
142         return webApp==null?-1:webApp.addFilterMapping(value);
143     }
144
145     public int addListener(org.netbeans.modules.j2ee.dd.api.web.Listener value) {
146         return webApp==null?-1:webApp.addListener(value);
147     }
148
149     public int addMessageDestination(org.netbeans.modules.j2ee.dd.api.common.MessageDestination value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
150         return webApp==null?-1:webApp.addMessageDestination(value);
151     }
152
153     public int addMessageDestinationRef(org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
154         return webApp==null?-1:webApp.addMessageDestinationRef(value);
155     }
156
157     public int addMimeMapping(org.netbeans.modules.j2ee.dd.api.web.MimeMapping value) {
158         return webApp==null?-1:webApp.addMimeMapping(value);
159     }
160
161     public int addResourceEnvRef(org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef value) {
162         return webApp==null?-1:webApp.addResourceEnvRef(value);
163     }
164
165     public int addResourceRef(org.netbeans.modules.j2ee.dd.api.common.ResourceRef value) {
166         return webApp==null?-1:webApp.addResourceRef(value);
167     }
168
169     public int addSecurityConstraint(org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint value) {
170         return webApp==null?-1:webApp.addSecurityConstraint(value);
171     }
172
173     public int addSecurityRole(org.netbeans.modules.j2ee.dd.api.common.SecurityRole value) {
174         return webApp==null?-1:webApp.addSecurityRole(value);
175     }
176
177     public int addServiceRef(org.netbeans.modules.j2ee.dd.api.common.ServiceRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
178         return webApp==null?-1:webApp.addServiceRef(value);
179     }
180
181     public int addServlet(org.netbeans.modules.j2ee.dd.api.web.Servlet value) {
182         return webApp==null?-1:webApp.addServlet(value);
183     }
184
185     public int addServletMapping(org.netbeans.modules.j2ee.dd.api.web.ServletMapping value) {
186         return webApp==null?-1:webApp.addServletMapping(value);
187     }
188
189     public int addTaglib(org.netbeans.modules.j2ee.dd.api.web.Taglib value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
190         return webApp==null?-1:webApp.addTaglib(value);
191     }
192
193     public org.netbeans.modules.j2ee.dd.api.common.CommonDDBean createBean(String JavaDoc beanName) throws ClassNotFoundException JavaDoc {
194         return webApp==null?null:webApp.createBean(beanName);
195     }
196
197     public org.netbeans.modules.j2ee.dd.api.common.CommonDDBean addBean(String JavaDoc beanName, String JavaDoc[] propertyNames, Object JavaDoc[] propertyValues, String JavaDoc keyProperty) throws ClassNotFoundException JavaDoc, org.netbeans.modules.j2ee.dd.api.common.NameAlreadyUsedException {
198         return webApp==null?null:webApp.addBean(beanName, propertyNames, propertyValues, keyProperty);
199     }
200
201     public org.netbeans.modules.j2ee.dd.api.common.CommonDDBean addBean(String JavaDoc beanName) throws ClassNotFoundException JavaDoc {
202         return webApp==null?null:webApp.addBean(beanName);
203     }
204
205     public org.netbeans.modules.j2ee.dd.api.common.CommonDDBean findBeanByName(String JavaDoc beanName, String JavaDoc propertyName, String JavaDoc value) {
206         return webApp==null?null:webApp.findBeanByName(beanName, propertyName, value);
207     }
208
209     public java.util.Map JavaDoc getAllDescriptions() {
210         return webApp==null?new java.util.HashMap JavaDoc():webApp.getAllDescriptions();
211     }
212
213     public java.util.Map JavaDoc getAllDisplayNames() {
214         return webApp==null?new java.util.HashMap JavaDoc():webApp.getAllDisplayNames();
215     }
216
217     public java.util.Map JavaDoc getAllIcons() {
218         return webApp==null?new java.util.HashMap JavaDoc():webApp.getAllIcons();
219     }
220
221     public org.netbeans.modules.j2ee.dd.api.common.InitParam[] getContextParam() {
222         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.InitParam[0]:webApp.getContextParam();
223     }
224
225     public org.netbeans.modules.j2ee.dd.api.common.InitParam getContextParam(int index) {
226         return webApp==null?null:webApp.getContextParam(index);
227     }
228
229     public String JavaDoc getDefaultDescription() {
230         return webApp==null?null:webApp.getDefaultDescription();
231     }
232
233     public String JavaDoc getDefaultDisplayName() {
234         return webApp==null?null:webApp.getDefaultDisplayName();
235     }
236
237     public org.netbeans.modules.j2ee.dd.api.common.Icon getDefaultIcon() {
238         return webApp==null?null:webApp.getDefaultIcon();
239     }
240
241     public String JavaDoc getDescription(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
242         return webApp==null?null:webApp.getDescription(locale);
243     }
244
245     public String JavaDoc getDisplayName(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
246         return webApp==null?null:webApp.getDisplayName(locale);
247     }
248
249     public org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef[] getEjbLocalRef() {
250         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef[0]:webApp.getEjbLocalRef();
251     }
252
253     public org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef getEjbLocalRef(int index) {
254         return webApp==null?null:webApp.getEjbLocalRef(index);
255     }
256
257     public org.netbeans.modules.j2ee.dd.api.common.EjbRef[] getEjbRef() {
258         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.EjbRef[0]:webApp.getEjbRef();
259     }
260
261     public org.netbeans.modules.j2ee.dd.api.common.EjbRef getEjbRef(int index) {
262         return webApp==null?null:webApp.getEjbRef(index);
263     }
264
265     public org.netbeans.modules.j2ee.dd.api.common.EnvEntry[] getEnvEntry() {
266         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.EnvEntry[0]:webApp.getEnvEntry();
267     }
268
269     public org.netbeans.modules.j2ee.dd.api.common.EnvEntry getEnvEntry(int index) {
270         return webApp==null?null:webApp.getEnvEntry(index);
271     }
272
273     public org.netbeans.modules.j2ee.dd.api.web.ErrorPage[] getErrorPage() {
274         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.ErrorPage[0]:webApp.getErrorPage();
275     }
276
277     public org.netbeans.modules.j2ee.dd.api.web.ErrorPage getErrorPage(int index) {
278         return webApp==null?null:webApp.getErrorPage(index);
279     }
280
281     public org.netbeans.modules.j2ee.dd.api.web.Filter[] getFilter() {
282         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.Filter[0]:webApp.getFilter();
283     }
284
285     public org.netbeans.modules.j2ee.dd.api.web.Filter getFilter(int index) {
286         return webApp==null?null:webApp.getFilter(index);
287     }
288
289     public org.netbeans.modules.j2ee.dd.api.web.FilterMapping[] getFilterMapping() {
290         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.FilterMapping[0]:webApp.getFilterMapping();
291     }
292
293     public org.netbeans.modules.j2ee.dd.api.web.FilterMapping getFilterMapping(int index) {
294         return webApp==null?null:webApp.getFilterMapping(index);
295     }
296
297     public java.lang.String JavaDoc getId() {
298         return webApp==null?null:webApp.getId();
299     }
300
301     public String JavaDoc getLargeIcon() {
302         return webApp==null?null:webApp.getLargeIcon();
303     }
304
305     public String JavaDoc getLargeIcon(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
306         return webApp==null?null:webApp.getLargeIcon(locale);
307     }
308
309     public org.netbeans.modules.j2ee.dd.api.web.Listener[] getListener() {
310         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.Listener[0]:webApp.getListener();
311     }
312
313     public org.netbeans.modules.j2ee.dd.api.web.Listener getListener(int index) {
314         return webApp==null?null:webApp.getListener(index);
315     }
316
317     public org.netbeans.modules.j2ee.dd.api.web.LocaleEncodingMappingList getSingleLocaleEncodingMappingList() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
318         return webApp==null?null:webApp.getSingleLocaleEncodingMappingList();
319     }
320
321     public org.netbeans.modules.j2ee.dd.api.common.MessageDestination[] getMessageDestination() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
322         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.MessageDestination[0]:webApp.getMessageDestination();
323     }
324
325     public org.netbeans.modules.j2ee.dd.api.common.MessageDestination getMessageDestination(int index) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
326         return webApp==null?null:webApp.getMessageDestination(index);
327     }
328
329     public org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef[] getMessageDestinationRef() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
330         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef[0]:webApp.getMessageDestinationRef();
331     }
332
333     public org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef getMessageDestinationRef(int index) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
334         return webApp==null?null:webApp.getMessageDestinationRef(index);
335     }
336
337     public org.netbeans.modules.j2ee.dd.api.web.MimeMapping[] getMimeMapping() {
338         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.MimeMapping[0]:webApp.getMimeMapping();
339     }
340
341     public org.netbeans.modules.j2ee.dd.api.web.MimeMapping getMimeMapping(int index) {
342         return webApp==null?null:webApp.getMimeMapping(index);
343     }
344
345     public org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef[] getResourceEnvRef() {
346         return webApp==null?null:webApp==null?new org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef[0]:webApp.getResourceEnvRef();
347     }
348
349     public org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef getResourceEnvRef(int index) {
350         return webApp==null?null:webApp.getResourceEnvRef(index);
351     }
352
353     public org.netbeans.modules.j2ee.dd.api.common.ResourceRef[] getResourceRef() {
354         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.ResourceRef[0]:webApp.getResourceRef();
355     }
356
357     public org.netbeans.modules.j2ee.dd.api.common.ResourceRef getResourceRef(int index) {
358         return webApp==null?null:webApp.getResourceRef(index);
359     }
360
361     public org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint[] getSecurityConstraint() {
362         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint[0]:webApp.getSecurityConstraint();
363     }
364
365     public org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint getSecurityConstraint(int index) {
366         return webApp==null?null:webApp.getSecurityConstraint(index);
367     }
368
369     public org.netbeans.modules.j2ee.dd.api.common.SecurityRole[] getSecurityRole() {
370         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.SecurityRole[0]:webApp.getSecurityRole();
371     }
372
373     public org.netbeans.modules.j2ee.dd.api.common.SecurityRole getSecurityRole(int index) {
374         return webApp==null?null:webApp.getSecurityRole(index);
375     }
376
377     public org.netbeans.modules.j2ee.dd.api.common.ServiceRef[] getServiceRef() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
378         return webApp==null?new org.netbeans.modules.j2ee.dd.api.common.ServiceRef[0]:webApp.getServiceRef();
379     }
380
381     public org.netbeans.modules.j2ee.dd.api.common.ServiceRef getServiceRef(int index) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
382         return webApp==null?null:webApp.getServiceRef(index);
383     }
384
385     public org.netbeans.modules.j2ee.dd.api.web.Servlet[] getServlet() {
386         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.Servlet[0]:webApp.getServlet();
387     }
388
389     public org.netbeans.modules.j2ee.dd.api.web.Servlet getServlet(int index) {
390         return webApp==null?null:webApp.getServlet(index);
391     }
392
393     public org.netbeans.modules.j2ee.dd.api.web.ServletMapping[] getServletMapping() {
394         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.ServletMapping[0]:webApp.getServletMapping();
395     }
396
397     public org.netbeans.modules.j2ee.dd.api.web.ServletMapping getServletMapping(int index) {
398         return webApp==null?null:webApp.getServletMapping(index);
399     }
400
401     public org.netbeans.modules.j2ee.dd.api.web.JspConfig getSingleJspConfig() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
402         return webApp==null?null:webApp.getSingleJspConfig();
403     }
404
405     public org.netbeans.modules.j2ee.dd.api.web.LoginConfig getSingleLoginConfig() {
406         return webApp==null?null:webApp.getSingleLoginConfig();
407     }
408
409     public org.netbeans.modules.j2ee.dd.api.web.SessionConfig getSingleSessionConfig() {
410         return webApp==null?null:webApp.getSingleSessionConfig();
411     }
412
413     public org.netbeans.modules.j2ee.dd.api.web.WelcomeFileList getSingleWelcomeFileList() {
414         return webApp==null?null:webApp.getSingleWelcomeFileList();
415     }
416
417     public String JavaDoc getSmallIcon() {
418         return webApp==null?null:webApp.getSmallIcon();
419     }
420
421     public String JavaDoc getSmallIcon(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
422         return webApp==null?null:webApp.getSmallIcon(locale);
423     }
424
425     public org.netbeans.modules.j2ee.dd.api.web.Taglib[] getTaglib() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
426         return webApp==null?new org.netbeans.modules.j2ee.dd.api.web.Taglib[0]:webApp.getTaglib();
427     }
428
429     public org.netbeans.modules.j2ee.dd.api.web.Taglib getTaglib(int index) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
430         return webApp==null?null:webApp.getTaglib(index);
431     }
432
433     public Object JavaDoc getValue(String JavaDoc name) {
434         return webApp==null?null:webApp.getValue(name);
435     }
436
437     public boolean isDistributable() {
438         return webApp==null?false:webApp.isDistributable();
439     }
440
441     public void merge(org.netbeans.modules.j2ee.dd.api.common.RootInterface bean, int mode) {
442         if (bean instanceof WebAppProxy) {
443             bean = ((WebAppProxy) bean).getOriginal();
444         }
445         if (webApp != bean && bean instanceof WebApp) {
446             WebApp newWebApp = (WebApp) bean;
447             if (webApp != null && webApp.getVersion().equals(newWebApp.getVersion())) {
448                 removePropertyChangeListener(reindentationListener);
449                 webApp.merge(newWebApp, mode);
450                 addPropertyChangeListener(reindentationListener);
451             } else {
452                 setOriginal((WebApp) newWebApp.clone());
453             }
454         }
455     }
456
457     public void removeAllDescriptions() {
458
459         if (webApp!=null) webApp.removeAllDescriptions();
460     }
461
462     public void removeAllDisplayNames() {
463         if (webApp!=null) webApp.removeAllDisplayNames();
464     }
465
466     public void removeAllIcons() {
467         if (webApp!=null) webApp.removeAllIcons();
468     }
469
470     public int removeContextParam(org.netbeans.modules.j2ee.dd.api.common.InitParam value) {
471         return webApp==null?-1:webApp.removeContextParam(value);
472     }
473
474     public void removeDescription() {
475         if (webApp!=null) webApp.removeDescription();
476     }
477
478     public void removeDescriptionForLocale(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
479         if (webApp!=null) webApp.removeDescriptionForLocale(locale);
480     }
481
482     public void removeDisplayName() {
483         if (webApp!=null) webApp.removeDisplayName();
484     }
485
486     public void removeDisplayNameForLocale(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
487         if (webApp!=null) webApp.removeDisplayNameForLocale(locale);
488     }
489
490     public int removeEjbLocalRef(org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef value) {
491         return webApp==null?-1:webApp.removeEjbLocalRef(value);
492     }
493
494     public int removeEjbRef(org.netbeans.modules.j2ee.dd.api.common.EjbRef value) {
495         return webApp==null?-1:webApp.removeEjbRef(value);
496     }
497
498     public int removeEnvEntry(org.netbeans.modules.j2ee.dd.api.common.EnvEntry value) {
499         return webApp==null?-1:webApp.removeEnvEntry(value);
500     }
501
502     public int removeErrorPage(org.netbeans.modules.j2ee.dd.api.web.ErrorPage value) {
503         return webApp==null?-1:webApp.removeErrorPage(value);
504     }
505
506     public int removeFilter(org.netbeans.modules.j2ee.dd.api.web.Filter value) {
507         return webApp==null?-1:webApp.removeFilter(value);
508     }
509
510     public int removeFilterMapping(org.netbeans.modules.j2ee.dd.api.web.FilterMapping value) {
511         return webApp==null?-1:webApp.removeFilterMapping(value);
512     }
513
514     public void removeIcon() {
515         if (webApp!=null) webApp.removeIcon();
516     }
517
518     public void removeIcon(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
519         if (webApp!=null) webApp.removeIcon(locale);
520     }
521
522     public void removeLargeIcon() {
523         if (webApp!=null) webApp.removeLargeIcon();
524     }
525
526     public void removeLargeIcon(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
527         if (webApp!=null) webApp.removeLargeIcon(locale);
528     }
529
530     public int removeListener(org.netbeans.modules.j2ee.dd.api.web.Listener value) {
531         return webApp==null?-1:webApp.removeListener(value);
532     }
533
534     public int removeMessageDestination(org.netbeans.modules.j2ee.dd.api.common.MessageDestination value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
535         return webApp==null?-1:webApp.removeMessageDestination(value);
536     }
537
538     public int removeMessageDestinationRef(org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
539         return webApp==null?-1:webApp.removeMessageDestinationRef(value);
540     }
541
542     public int removeMimeMapping(org.netbeans.modules.j2ee.dd.api.web.MimeMapping value) {
543         return webApp==null?-1:webApp.removeMimeMapping(value);
544     }
545
546     public int removeResourceEnvRef(org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef value) {
547         return webApp==null?-1:webApp.removeResourceEnvRef(value);
548     }
549
550     public int removeResourceRef(org.netbeans.modules.j2ee.dd.api.common.ResourceRef value) {
551         return webApp==null?-1:webApp.removeResourceRef(value);
552     }
553
554     public int removeSecurityConstraint(org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint value) {
555         return webApp==null?-1:webApp.removeSecurityConstraint(value);
556     }
557
558     public int removeSecurityRole(org.netbeans.modules.j2ee.dd.api.common.SecurityRole value) {
559         return webApp==null?-1:webApp.removeSecurityRole(value);
560     }
561
562     public int removeServiceRef(org.netbeans.modules.j2ee.dd.api.common.ServiceRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
563         return webApp==null?-1:webApp.removeServiceRef(value);
564     }
565
566     public int removeServlet(org.netbeans.modules.j2ee.dd.api.web.Servlet value) {
567         return webApp==null?-1:webApp.removeServlet(value);
568     }
569
570     public int removeServletMapping(org.netbeans.modules.j2ee.dd.api.web.ServletMapping value) {
571         return webApp==null?-1:webApp.removeServletMapping(value);
572     }
573
574     public void removeSmallIcon() {
575         if (webApp!=null) webApp.removeSmallIcon();
576     }
577
578     public void removeSmallIcon(String JavaDoc locale) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
579         if (webApp!=null) webApp.removeSmallIcon(locale);
580     }
581
582     public int removeTaglib(org.netbeans.modules.j2ee.dd.api.web.Taglib value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
583         return webApp==null?-1:webApp.removeTaglib(value);
584     }
585
586     public void setAllDescriptions(java.util.Map JavaDoc descriptions) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
587         if (webApp!=null) webApp.setAllDescriptions(descriptions);
588     }
589
590     public void setAllDisplayNames(java.util.Map JavaDoc displayNames) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
591         if (webApp!=null) webApp.setAllDisplayNames(displayNames);
592     }
593
594     public void setAllIcons(String JavaDoc[] locales, String JavaDoc[] smallIcons, String JavaDoc[] largeIcons) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
595         if (webApp!=null) webApp.setAllIcons(locales, smallIcons, largeIcons);
596     }
597
598     public void setContextParam(org.netbeans.modules.j2ee.dd.api.common.InitParam[] value) {
599         if (webApp!=null) webApp.setContextParam(value);
600     }
601
602     public void setContextParam(int index, org.netbeans.modules.j2ee.dd.api.common.InitParam value) {
603         if (webApp!=null) webApp.setContextParam(index, value);
604     }
605
606     public void setDescription(String JavaDoc description) {
607         if (webApp!=null) webApp.setDescription(description);
608     }
609
610     public void setDescription(String JavaDoc locale, String JavaDoc description) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
611         if (webApp!=null) webApp.setDescription(locale, description);
612     }
613
614     public void setDisplayName(String JavaDoc displayName) {
615         if (webApp!=null) webApp.setDisplayName(displayName);
616     }
617
618     public void setDisplayName(String JavaDoc locale, String JavaDoc displayName) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
619         if (webApp!=null) webApp.setDisplayName(locale, displayName);
620     }
621
622     public void setDistributable(boolean value) {
623         if (webApp!=null) webApp.setDistributable(value);
624     }
625
626     public void setEjbLocalRef(org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef[] value) {
627         if (webApp!=null) webApp.setEjbLocalRef(value);
628     }
629
630     public void setEjbLocalRef(int index, org.netbeans.modules.j2ee.dd.api.common.EjbLocalRef value) {
631         if (webApp!=null) webApp.setEjbLocalRef(index, value);
632     }
633
634     public void setEjbRef(org.netbeans.modules.j2ee.dd.api.common.EjbRef[] value) {
635         if (webApp!=null) webApp.setEjbRef(value);
636     }
637
638     public void setEjbRef(int index, org.netbeans.modules.j2ee.dd.api.common.EjbRef value) {
639         if (webApp!=null) webApp.setEjbRef(index, value);
640     }
641
642     public void setEnvEntry(org.netbeans.modules.j2ee.dd.api.common.EnvEntry[] value) {
643         if (webApp!=null) webApp.setEnvEntry(value);
644     }
645
646     public void setEnvEntry(int index, org.netbeans.modules.j2ee.dd.api.common.EnvEntry value) {
647         if (webApp!=null) webApp.setEnvEntry(index, value);
648     }
649
650     public void setErrorPage(org.netbeans.modules.j2ee.dd.api.web.ErrorPage[] value) {
651         if (webApp!=null) webApp.setErrorPage(value);
652     }
653
654     public void setErrorPage(int index, org.netbeans.modules.j2ee.dd.api.web.ErrorPage value) {
655         if (webApp!=null) webApp.setErrorPage(index, value);
656     }
657
658     public void setFilter(org.netbeans.modules.j2ee.dd.api.web.Filter[] value) {
659         if (webApp!=null) webApp.setFilter(value);
660     }
661
662     public void setFilter(int index, org.netbeans.modules.j2ee.dd.api.web.Filter value) {
663         if (webApp!=null) webApp.setFilter(index, value);
664     }
665
666     public void setFilterMapping(org.netbeans.modules.j2ee.dd.api.web.FilterMapping[] value) {
667         if (webApp!=null) {
668         org.netbeans.modules.j2ee.dd.api.web.FilterMapping[] oldMappings = getFilterMapping();
669         int lenOld = oldMappings.length;
670         int lenNew = (value==null?0:value.length);
671         if (lenOld<=lenNew) {
672             for (int i=0;i<lenOld;i++) {
673                 webApp.setFilterMapping(i,value[i]);
674             }
675             for (int i=lenOld;i<lenNew;i++) {
676                 webApp.addFilterMapping(value[i]);
677             }
678         } else {
679             for (int i=0;i<lenNew;i++) {
680                 webApp.setFilterMapping(i,value[i]);
681             }
682             for (int i=lenOld-1;i>=lenNew;i--) {
683                 webApp.removeFilterMapping(oldMappings[i]);
684             }
685         }
686         }
687     }
688
689     public void setFilterMapping(int index, org.netbeans.modules.j2ee.dd.api.web.FilterMapping value) {
690         if (webApp!=null) webApp.setFilterMapping(index, value);
691     }
692
693     public void setIcon(org.netbeans.modules.j2ee.dd.api.common.Icon icon) {
694         if (webApp!=null) webApp.setIcon(icon);
695     }
696
697     public void setId(java.lang.String JavaDoc value) {
698         if (webApp!=null) webApp.setId(value);
699     }
700
701     public void setJspConfig(org.netbeans.modules.j2ee.dd.api.web.JspConfig value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
702         if (webApp!=null) webApp.setJspConfig(value);
703     }
704
705     public void setLargeIcon(String JavaDoc icon) {
706         if (webApp!=null) webApp.setLargeIcon(icon);
707     }
708
709     public void setLargeIcon(String JavaDoc locale, String JavaDoc icon) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
710         if (webApp!=null) webApp.setLargeIcon(locale, icon);
711     }
712
713     public void setListener(org.netbeans.modules.j2ee.dd.api.web.Listener[] value) {
714         if (webApp!=null) {
715         org.netbeans.modules.j2ee.dd.api.web.Listener[] oldListeners = getListener();
716         int lenOld = oldListeners.length;
717         int lenNew = (value==null?0:value.length);
718         if (lenOld<=lenNew) {
719             for (int i=0;i<lenOld;i++) {
720                 webApp.setListener(i,value[i]);
721             }
722             for (int i=lenOld;i<lenNew;i++) {
723                 webApp.addListener(value[i]);
724             }
725         } else {
726             for (int i=0;i<lenNew;i++) {
727                 webApp.setListener(i,value[i]);
728             }
729             for (int i=lenOld-1;i>=lenNew;i--) {
730                 webApp.removeListener(oldListeners[i]);
731             }
732         }
733         }
734     }
735
736     public void setListener(int index, org.netbeans.modules.j2ee.dd.api.web.Listener value) {
737         if (webApp!=null) webApp.setListener(index, value);
738     }
739
740     public void setLocaleEncodingMappingList(org.netbeans.modules.j2ee.dd.api.web.LocaleEncodingMappingList value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
741         if (webApp!=null) webApp.setLocaleEncodingMappingList(value);
742     }
743
744     public void setLoginConfig(org.netbeans.modules.j2ee.dd.api.web.LoginConfig value) {
745         if (webApp!=null) webApp.setLoginConfig(value);
746     }
747
748     public void setMessageDestination(org.netbeans.modules.j2ee.dd.api.common.MessageDestination[] value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
749         if (webApp!=null) webApp.setMessageDestination(value);
750     }
751
752     public void setMessageDestination(int index, org.netbeans.modules.j2ee.dd.api.common.MessageDestination value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
753         if (webApp!=null) webApp.setMessageDestination(index, value);
754     }
755
756     public void setMessageDestinationRef(org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef[] value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
757         if (webApp!=null) webApp.setMessageDestinationRef(value);
758     }
759
760     public void setMessageDestinationRef(int index, org.netbeans.modules.j2ee.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
761         if (webApp!=null) webApp.setMessageDestinationRef(index, value);
762     }
763
764     public void setMimeMapping(org.netbeans.modules.j2ee.dd.api.web.MimeMapping[] value) {
765         if (webApp!=null) webApp.setMimeMapping(value);
766     }
767
768     public void setMimeMapping(int index, org.netbeans.modules.j2ee.dd.api.web.MimeMapping value) {
769         if (webApp!=null) webApp.setMimeMapping(index, value);
770     }
771
772     public void setResourceEnvRef(org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef[] value) {
773         if (webApp!=null) webApp.setResourceEnvRef(value);
774     }
775
776     public void setResourceEnvRef(int index, org.netbeans.modules.j2ee.dd.api.common.ResourceEnvRef value) {
777         if (webApp!=null) webApp.setResourceEnvRef(index, value);
778     }
779
780     public void setResourceRef(org.netbeans.modules.j2ee.dd.api.common.ResourceRef[] value) {
781         if (webApp!=null) webApp.setResourceRef(value);
782     }
783
784     public void setResourceRef(int index, org.netbeans.modules.j2ee.dd.api.common.ResourceRef value) {
785         if (webApp!=null) webApp.setResourceRef(index, value);
786     }
787
788     public void setSecurityConstraint(org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint[] value) {
789         if (webApp!=null) webApp.setSecurityConstraint(value);
790     }
791
792     public void setSecurityConstraint(int index, org.netbeans.modules.j2ee.dd.api.web.SecurityConstraint value) {
793         if (webApp!=null) webApp.setSecurityConstraint(index, value);
794     }
795
796     public void setSecurityRole(org.netbeans.modules.j2ee.dd.api.common.SecurityRole[] value) {
797         if (webApp!=null) webApp.setSecurityRole(value);
798     }
799
800     public void setSecurityRole(int index, org.netbeans.modules.j2ee.dd.api.common.SecurityRole value) {
801         if (webApp!=null) webApp.setSecurityRole(index, value);
802     }
803
804     public void setServiceRef(org.netbeans.modules.j2ee.dd.api.common.ServiceRef[] value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
805         if (webApp!=null) webApp.setServiceRef(value);
806     }
807
808     public void setServiceRef(int index, org.netbeans.modules.j2ee.dd.api.common.ServiceRef value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
809         if (webApp!=null) webApp.setServiceRef(index, value);
810     }
811
812     public void setServlet(org.netbeans.modules.j2ee.dd.api.web.Servlet[] value) {
813         if (webApp!=null) webApp.setServlet(value);
814     }
815
816     public void setServlet(int index, org.netbeans.modules.j2ee.dd.api.web.Servlet value) {
817         if (webApp!=null) webApp.setServlet(index, value);
818     }
819
820     public void setServletMapping(org.netbeans.modules.j2ee.dd.api.web.ServletMapping[] value) {
821         if (webApp!=null) webApp.setServletMapping(value);
822     }
823
824     public void setServletMapping(int index, org.netbeans.modules.j2ee.dd.api.web.ServletMapping value) {
825         if (webApp!=null) webApp.setServletMapping(index, value);
826     }
827
828     public void setSessionConfig(org.netbeans.modules.j2ee.dd.api.web.SessionConfig value) {
829         if (webApp!=null) webApp.setSessionConfig(value);
830     }
831
832     public void setSmallIcon(String JavaDoc icon) {
833         if (webApp!=null) webApp.setSmallIcon(icon);
834     }
835
836     public void setSmallIcon(String JavaDoc locale, String JavaDoc icon) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
837         if (webApp!=null) webApp.setSmallIcon(locale, icon);
838     }
839
840     public void setTaglib(org.netbeans.modules.j2ee.dd.api.web.Taglib[] value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
841         if (webApp!=null) webApp.setTaglib(value);
842     }
843
844     public void setTaglib(int index, org.netbeans.modules.j2ee.dd.api.web.Taglib value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
845         if (webApp!=null) webApp.setTaglib(index, value);
846     }
847
848     public void setWelcomeFileList(org.netbeans.modules.j2ee.dd.api.web.WelcomeFileList value) {
849         if (webApp!=null) webApp.setWelcomeFileList(value);
850     }
851
852     public int sizeContextParam() {
853         return webApp==null?0:webApp.sizeContextParam();
854     }
855
856     public int sizeEjbLocalRef() {
857         return webApp==null?0:webApp.sizeEjbLocalRef();
858     }
859
860     public int sizeEjbRef() {
861         return webApp==null?0:webApp.sizeEjbRef();
862     }
863
864     public int sizeEnvEntry() {
865         return webApp==null?0:webApp.sizeEnvEntry();
866     }
867
868     public int sizeErrorPage() {
869         return webApp==null?0:webApp.sizeErrorPage();
870     }
871
872     public int sizeFilter() {
873         return webApp==null?0:webApp.sizeFilter();
874     }
875
876     public int sizeFilterMapping() {
877         return webApp==null?0:webApp.sizeFilterMapping();
878     }
879
880     public int sizeListener() {
881         return webApp==null?0:webApp.sizeListener();
882     }
883
884     public int sizeMessageDestination() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
885         return webApp==null?0:webApp.sizeMessageDestination();
886     }
887
888     public int sizeMessageDestinationRef() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
889         return webApp==null?0:webApp.sizeMessageDestinationRef();
890     }
891
892     public int sizeMimeMapping() {
893         return webApp==null?0:webApp.sizeMimeMapping();
894     }
895
896     public int sizeResourceEnvRef() {
897         return webApp==null?0:webApp.sizeResourceEnvRef();
898     }
899
900     public int sizeResourceRef() {
901         return webApp==null?0:webApp.sizeResourceRef();
902     }
903
904     public int sizeSecurityConstraint() {
905         return webApp==null?0:webApp.sizeSecurityConstraint();
906     }
907
908     public int sizeSecurityRole() {
909         return webApp==null?0:webApp.sizeSecurityRole();
910     }
911
912     public int sizeServiceRef() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
913         return webApp==null?0:webApp.sizeServiceRef();
914     }
915
916     public int sizeServlet() {
917         return webApp==null?0:webApp.sizeServlet();
918     }
919
920     public int sizeServletMapping() {
921         return webApp==null?0:webApp.sizeServletMapping();
922     }
923
924     public int sizeTaglib() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
925         return webApp==null?0:webApp.sizeTaglib();
926     }
927
928     public void write(java.io.OutputStream JavaDoc os) throws java.io.IOException JavaDoc {
929         if (webApp!=null) {
930             writing=true;
931             Schema2BeansUtil.write((BaseBean) webApp, os);
932         }
933     }
934
935     public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException JavaDoc {
936         if (webApp!=null) {
937             DataObject dataObject = DataObject.find(fo);
938             if (dataObject instanceof DDProviderDataObject) {
939                 ((DDProviderDataObject) dataObject).writeModel(webApp);
940             } else {
941                 FileLock lock = fo.lock();
942                 try {
943                     OutputStream JavaDoc os = fo.getOutputStream(lock);
944                     try {
945                         writing = true;
946                         write(os);
947                     } finally {
948                         os.close();
949                     }
950                 } finally {
951                     lock.releaseLock();
952                 }
953             }
954         }
955     }
956
957     public Object JavaDoc clone() {
958         WebAppProxy proxy = null;
959         if (webApp==null)
960             proxy = new WebAppProxy(null,version);
961         else {
962             WebApp clonedWebApp=(WebApp)webApp.clone();
963             proxy = new WebAppProxy(clonedWebApp,version);
964             if (WebApp.VERSION_2_3.equals(version)) {
965                 ((org.netbeans.modules.schema2beans.BaseBean)clonedWebApp).changeDocType
966                     ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN","http://java.sun.com/dtd/web-app_2_3.dtd");
967             } else if (WebApp.VERSION_2_4.equals(version)) {
968                 ((org.netbeans.modules.j2ee.dd.impl.web.model_2_4.WebApp)clonedWebApp)._setSchemaLocation
969                     ("http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
970             } else /*if (WebApp.VERSION_2_5.equals(version))*/ {
971                 ((org.netbeans.modules.j2ee.dd.impl.web.model_2_5.WebApp)clonedWebApp)._setSchemaLocation
972                     ("http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd");
973             }
974         }
975         proxy.setError(error);
976         proxy.setStatus(ddStatus);
977         return proxy;
978     }
979
980     public boolean isWriting() {
981         return writing;
982     }
983
984     public void setWriting(boolean writing) {
985         this.writing=writing;
986     }
987     
988     public void setMetadataComplete(boolean value) throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException {
989         if (webApp!=null) webApp.setMetadataComplete(value);
990     }
991     
992     public boolean isMetadataComplete() throws org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException{
993         return webApp==null?false:webApp.isMetadataComplete();
994     }
995
996     public int addJspConfig(JspConfig valueInterface) throws VersionNotSupportedException {
997         return webApp == null ? 0 : webApp.addJspConfig(valueInterface);
998     }
999
1000    public int removeJspConfig(JspConfig valueInterface) throws VersionNotSupportedException {
1001        return webApp == null ? 0 : webApp.removeJspConfig(valueInterface);
1002    }
1003}
1004
Popular Tags