KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > dd > impl > 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.web.dd.impl;
21
22 import org.netbeans.api.web.dd.WebApp;
23
24 /**
25  * @author mk115033
26  */

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

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

979     public static interface OutputProvider {
980         public void write(WebApp webApp) throws java.io.IOException JavaDoc;
981         public org.openide.filesystems.FileObject getTarget();
982     }
983     
984 }
985
Popular Tags