KickJava   Java API By Example, From Geeks To Geeks.

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


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  * SunWebAppProxy.java
21  *
22  * Created on February 7, 2005, 7:33 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.dd.impl.web;
26
27 import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
28 import org.netbeans.modules.j2ee.sun.dd.api.DDException;
29 import org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp;
30
31 import org.netbeans.modules.j2ee.sun.dd.impl.DTDRegistry;
32 import org.netbeans.modules.j2ee.sun.dd.impl.DDTreeWalker;
33
34 import org.w3c.dom.*;
35 import java.io.*;
36 import org.w3c.dom.Document JavaDoc;
37
38 /**
39  *
40  * @author Nitya Doraisamy
41  */

42 public class SunWebAppProxy implements SunWebApp {
43     
44     private SunWebApp webRoot;
45     private String JavaDoc version;
46     private OutputProvider outputProvider;
47     private int ddStatus;
48     private org.xml.sax.SAXParseException JavaDoc error;
49     private java.util.List JavaDoc listeners;
50         
51     
52     /** Creates a new instance of SunWebAppProxy */
53     public SunWebAppProxy(SunWebApp webRoot, String JavaDoc version) {
54         this.webRoot = webRoot;
55         this.version = version;
56     }
57
58     public int addEjbRef(org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef ejbRef) {
59         return webRoot==null?-1:webRoot.addEjbRef(ejbRef);
60     }
61
62     public int addIdempotentUrlPattern(boolean param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
63         return webRoot==null?-1:webRoot.addIdempotentUrlPattern(param);
64     }
65
66     public int addMessageDestination(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination messageDestination) {
67         return webRoot==null?-1:webRoot.addMessageDestination(messageDestination);
68     }
69
70     public int addWebProperty(org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty webProperty) {
71         return webRoot==null?-1:webRoot.addWebProperty(webProperty);
72     }
73
74     public int addResourceEnvRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef resourceEnvRef) {
75         return webRoot==null?-1:webRoot.addResourceEnvRef(resourceEnvRef);
76     }
77
78     public int addResourceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef resourceRef) {
79         return webRoot==null?-1:webRoot.addResourceRef(resourceRef);
80     }
81
82     public int addSecurityRoleMapping(org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping securityRoleMapping) {
83         return webRoot==null?-1:webRoot.addSecurityRoleMapping(securityRoleMapping);
84     }
85
86     public int addServiceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef serviceRef) {
87         return webRoot==null?-1:webRoot.addServiceRef(serviceRef);
88     }
89
90     public int addServlet(org.netbeans.modules.j2ee.sun.dd.api.web.Servlet servlet) {
91         return webRoot==null?-1:webRoot.addServlet(servlet);
92     }
93
94     public int addWebserviceDescription(org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription webserviceDescription) {
95         return webRoot==null?-1:webRoot.addWebserviceDescription(webserviceDescription);
96     }
97
98     public org.netbeans.modules.j2ee.sun.dd.api.web.Cache getCache() {
99         return webRoot==null?null:webRoot.getCache();
100     }
101
102     public String JavaDoc getContextRoot() {
103         return webRoot==null?null:webRoot.getContextRoot();
104     }
105
106     public org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef[] getEjbRef() {
107         return webRoot==null?null:webRoot.getEjbRef();
108     }
109
110     public org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef getEjbRef(int param) {
111         return webRoot==null?null:webRoot.getEjbRef(param);
112     }
113
114     public String JavaDoc getErrorUrl() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
115         return webRoot==null?null:webRoot.getErrorUrl();
116     }
117
118     public String JavaDoc getHttpservletSecurityProvider() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
119         return webRoot==null?null:webRoot.getHttpservletSecurityProvider();
120     }
121     
122     public boolean[] getIdempotentUrlPattern() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
123         return webRoot==null?null:webRoot.getIdempotentUrlPattern();
124     }
125
126     public String JavaDoc getIdempotentUrlPatternNumOfRetries(int param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
127         return webRoot==null?null:webRoot.getIdempotentUrlPatternNumOfRetries(param);
128     }
129
130     public String JavaDoc getIdempotentUrlPatternUrlPattern(int param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
131         return webRoot==null?null:webRoot.getIdempotentUrlPatternUrlPattern(param);
132     }
133
134     public org.netbeans.modules.j2ee.sun.dd.api.web.JspConfig getJspConfig() {
135         return webRoot==null?null:webRoot.getJspConfig();
136     }
137
138     public org.netbeans.modules.j2ee.sun.dd.api.web.LocaleCharsetInfo getLocaleCharsetInfo() {
139         return webRoot==null?null:webRoot.getLocaleCharsetInfo();
140     }
141
142     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination[] getMessageDestination() {
143         return webRoot==null?null:webRoot.getMessageDestination();
144     }
145
146     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination getMessageDestination(int param) {
147         return webRoot==null?null:webRoot.getMessageDestination(param);
148     }
149
150     public org.netbeans.modules.j2ee.sun.dd.api.web.MyClassLoader getMyClassLoader() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
151         return webRoot==null?null:webRoot.getMyClassLoader();
152     }
153
154     public String JavaDoc getParameterEncodingDefaultCharset() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
155         return webRoot==null?null:webRoot.getParameterEncodingDefaultCharset();
156     }
157
158     public String JavaDoc getParameterEncodingFormHintField() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
159         return webRoot==null?null:webRoot.getParameterEncodingFormHintField();
160     }
161
162     public org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty[] getWebProperty() {
163         return webRoot==null?null:webRoot.getWebProperty();
164     }
165
166     public org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty getWebProperty(int param) {
167         return webRoot==null?null:webRoot.getWebProperty(param);
168     }
169
170     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef[] getResourceEnvRef() {
171         return webRoot==null?null:webRoot.getResourceEnvRef();
172     }
173
174     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef getResourceEnvRef(int param) {
175         return webRoot==null?null:webRoot.getResourceEnvRef(param);
176     }
177
178     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef[] getResourceRef() {
179         return webRoot==null?null:webRoot.getResourceRef();
180     }
181
182     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef getResourceRef(int param) {
183         return webRoot==null?null:webRoot.getResourceRef(param);
184     }
185
186     public org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping[] getSecurityRoleMapping() {
187         return webRoot==null?null:webRoot.getSecurityRoleMapping();
188     }
189
190     public org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping getSecurityRoleMapping(int param) {
191         return webRoot==null?null:webRoot.getSecurityRoleMapping(param);
192     }
193
194     public org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef[] getServiceRef() {
195         return webRoot==null?null:webRoot.getServiceRef();
196     }
197
198     public org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef getServiceRef(int param) {
199         return webRoot==null?null:webRoot.getServiceRef(param);
200     }
201
202     public org.netbeans.modules.j2ee.sun.dd.api.web.Servlet[] getServlet() {
203         return webRoot==null?null:webRoot.getServlet();
204     }
205
206     public org.netbeans.modules.j2ee.sun.dd.api.web.Servlet getServlet(int param) {
207         return webRoot==null?null:webRoot.getServlet(param);
208     }
209
210     public org.netbeans.modules.j2ee.sun.dd.api.web.SessionConfig getSessionConfig() {
211         return webRoot==null?null:webRoot.getSessionConfig();
212     }
213
214     public org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription[] getWebserviceDescription() {
215         return webRoot==null?null:webRoot.getWebserviceDescription();
216     }
217
218     public org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription getWebserviceDescription(int param) {
219         return webRoot==null?null:webRoot.getWebserviceDescription(param);
220     }
221
222     public boolean isIdempotentUrlPattern(int param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
223         return webRoot==null?false:webRoot.isIdempotentUrlPattern(param);
224     }
225
226     public boolean isMyClassLoader() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
227         return webRoot==null?false:webRoot.isMyClassLoader();
228     }
229
230     public boolean isParameterEncoding() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
231         return webRoot==null?false:webRoot.isParameterEncoding();
232     }
233
234     public org.netbeans.modules.j2ee.sun.dd.api.web.Cache newCache() {
235         return webRoot==null?null:webRoot.newCache();
236     }
237
238     public org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef newEjbRef() {
239         return webRoot==null?null:webRoot.newEjbRef();
240     }
241
242     public org.netbeans.modules.j2ee.sun.dd.api.web.JspConfig newJspConfig() {
243         return webRoot==null?null:webRoot.newJspConfig();
244     }
245
246     public org.netbeans.modules.j2ee.sun.dd.api.web.LocaleCharsetInfo newLocaleCharsetInfo() {
247         return webRoot==null?null:webRoot.newLocaleCharsetInfo();
248     }
249
250     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination newMessageDestination() {
251         return webRoot==null?null:webRoot.newMessageDestination();
252     }
253
254     public org.netbeans.modules.j2ee.sun.dd.api.web.MyClassLoader newMyClassLoader() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
255         return webRoot==null?null:webRoot.newMyClassLoader();
256     }
257
258     public org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty newWebProperty() {
259         return webRoot==null?null:webRoot.newWebProperty();
260     }
261
262     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef newResourceEnvRef() {
263         return webRoot==null?null:webRoot.newResourceEnvRef();
264     }
265
266     public org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef newResourceRef() {
267         return webRoot==null?null:webRoot.newResourceRef();
268     }
269
270     public org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping newSecurityRoleMapping() {
271         return webRoot==null?null:webRoot.newSecurityRoleMapping();
272     }
273
274     public org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef newServiceRef() {
275         return webRoot==null?null:webRoot.newServiceRef();
276     }
277
278     public org.netbeans.modules.j2ee.sun.dd.api.web.Servlet newServlet() {
279         return webRoot==null?null:webRoot.newServlet();
280     }
281
282     public org.netbeans.modules.j2ee.sun.dd.api.web.SessionConfig newSessionConfig() {
283         return webRoot==null?null:webRoot.newSessionConfig();
284     }
285
286     public org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription newWebserviceDescription() {
287         return webRoot==null?null:webRoot.newWebserviceDescription();
288     }
289
290     public int removeEjbRef(org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef ejbRef) {
291         return webRoot==null?-1:webRoot.removeEjbRef(ejbRef);
292     }
293
294     public int removeIdempotentUrlPattern(boolean param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
295         return webRoot==null?-1:webRoot.removeIdempotentUrlPattern(param);
296     }
297
298     public void removeIdempotentUrlPattern(int param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
299         if (webRoot!=null) webRoot.removeIdempotentUrlPattern(param);
300     }
301
302     public int removeMessageDestination(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination messageDestination) {
303         return webRoot==null?-1:webRoot.removeMessageDestination(messageDestination);
304     }
305
306     public int removeWebProperty(org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty webProperty) {
307         return webRoot==null?-1:webRoot.removeWebProperty(webProperty);
308     }
309
310     public int removeResourceEnvRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef resourceEnvRef) {
311         return webRoot==null?-1:webRoot.removeResourceEnvRef(resourceEnvRef);
312     }
313
314     public int removeResourceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef resourceRef) {
315         return webRoot==null?-1:webRoot.removeResourceRef(resourceRef);
316     }
317
318     public int removeSecurityRoleMapping(org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping securityRoleMapping) {
319         return webRoot==null?-1:webRoot.removeSecurityRoleMapping(securityRoleMapping);
320     }
321
322     public int removeServiceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef serviceRef) {
323         return webRoot==null?-1:webRoot.removeServiceRef(serviceRef);
324     }
325
326     public int removeServlet(org.netbeans.modules.j2ee.sun.dd.api.web.Servlet servlet) {
327         return webRoot==null?-1:webRoot.removeServlet(servlet);
328     }
329
330     public int removeWebserviceDescription(org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription webserviceDescription) {
331         return webRoot==null?-1:webRoot.removeWebserviceDescription(webserviceDescription);
332     }
333
334     public void setCache(org.netbeans.modules.j2ee.sun.dd.api.web.Cache cache) {
335         if (webRoot!=null) webRoot.setCache(cache);
336     }
337
338     public void setContextRoot(String JavaDoc str) {
339         if (webRoot!=null) webRoot.setContextRoot(str);
340     }
341
342     public void setEjbRef(org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef[] ejbRef) {
343         if (webRoot!=null) webRoot.setEjbRef(ejbRef);
344     }
345
346     public void setEjbRef(int param, org.netbeans.modules.j2ee.sun.dd.api.common.EjbRef ejbRef) {
347         if (webRoot!=null) webRoot.setEjbRef(param, ejbRef);
348     }
349
350     public void setErrorUrl(String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
351         if (webRoot!=null) webRoot.setErrorUrl(str);
352     }
353
354     public void setHttpservletSecurityProvider(String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
355         if (webRoot!=null) webRoot.setHttpservletSecurityProvider(str);
356     }
357     
358     public void setIdempotentUrlPattern(boolean[] values) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
359         if (webRoot!=null) webRoot.setIdempotentUrlPattern(values);
360     }
361
362     public void setIdempotentUrlPattern(int param, boolean param1) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
363         if (webRoot!=null) webRoot.setIdempotentUrlPattern(param, param1);
364     }
365
366     public void setIdempotentUrlPatternNumOfRetries(int param, String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
367         if (webRoot!=null) webRoot.setIdempotentUrlPatternNumOfRetries(param, str);
368     }
369
370     public void setIdempotentUrlPatternUrlPattern(int param, String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
371         if (webRoot!=null) webRoot.setIdempotentUrlPatternUrlPattern(param, str);
372     }
373
374     public void setJspConfig(org.netbeans.modules.j2ee.sun.dd.api.web.JspConfig jspConfig) {
375         if (webRoot!=null) webRoot.setJspConfig(jspConfig);
376     }
377
378     public void setLocaleCharsetInfo(org.netbeans.modules.j2ee.sun.dd.api.web.LocaleCharsetInfo localeCharsetInfo) {
379         if (webRoot!=null) webRoot.setLocaleCharsetInfo(localeCharsetInfo);
380     }
381
382     public void setMessageDestination(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination[] messageDestination) {
383         if (webRoot!=null) webRoot.setMessageDestination(messageDestination);
384     }
385
386     public void setMessageDestination(int param, org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestination messageDestination) {
387         if (webRoot!=null) webRoot.setMessageDestination(param, messageDestination);
388     }
389
390     public void setMyClassLoader(boolean param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
391         if (webRoot!=null) webRoot.setMyClassLoader(param);
392     }
393
394     public void setMyClassLoader(org.netbeans.modules.j2ee.sun.dd.api.web.MyClassLoader myClassLoader) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
395         if (webRoot!=null) webRoot.setMyClassLoader(myClassLoader);
396     }
397
398     public void setParameterEncoding(boolean param) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
399         if (webRoot!=null) webRoot.setParameterEncoding(param);
400     }
401
402     public void setParameterEncodingDefaultCharset(String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
403         if (webRoot!=null) webRoot.setParameterEncodingDefaultCharset(str);
404     }
405
406     public void setParameterEncodingFormHintField(String JavaDoc str) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
407         if (webRoot!=null) webRoot.setParameterEncodingFormHintField(str);
408     }
409
410     public void setWebProperty(org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty[] webProperty) {
411         if (webRoot!=null) webRoot.setWebProperty(webProperty);
412     }
413
414     public void setWebProperty(int param, org.netbeans.modules.j2ee.sun.dd.api.web.WebProperty webProperty) {
415         if (webRoot!=null) webRoot.setWebProperty(param, webProperty);
416     }
417
418     public void setResourceEnvRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef[] resourceEnvRef) {
419         if (webRoot!=null) webRoot.setResourceEnvRef(resourceEnvRef);
420     }
421
422     public void setResourceEnvRef(int param, org.netbeans.modules.j2ee.sun.dd.api.common.ResourceEnvRef resourceEnvRef) {
423         if (webRoot!=null) webRoot.setResourceEnvRef(param, resourceEnvRef);
424     }
425
426     public void setResourceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef[] resourceRef) {
427         if (webRoot!=null) webRoot.setResourceRef(resourceRef);
428     }
429
430     public void setResourceRef(int param, org.netbeans.modules.j2ee.sun.dd.api.common.ResourceRef resourceRef) {
431         if (webRoot!=null) webRoot.setResourceRef(param, resourceRef);
432     }
433
434     public void setSecurityRoleMapping(org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping[] securityRoleMapping) {
435         if (webRoot!=null) webRoot.setSecurityRoleMapping(securityRoleMapping);
436     }
437
438     public void setSecurityRoleMapping(int param, org.netbeans.modules.j2ee.sun.dd.api.common.SecurityRoleMapping securityRoleMapping) {
439         if (webRoot!=null) webRoot.setSecurityRoleMapping(param, securityRoleMapping);
440     }
441
442     public void setServiceRef(org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef[] serviceRef) {
443         if (webRoot!=null) webRoot.setServiceRef(serviceRef);
444     }
445
446     public void setServiceRef(int param, org.netbeans.modules.j2ee.sun.dd.api.common.ServiceRef serviceRef) {
447         if (webRoot!=null) webRoot.setServiceRef(param, serviceRef);
448     }
449
450     public void setServlet(org.netbeans.modules.j2ee.sun.dd.api.web.Servlet[] servlet) {
451         if (webRoot!=null) webRoot.setServlet(servlet);
452     }
453
454     public void setServlet(int param, org.netbeans.modules.j2ee.sun.dd.api.web.Servlet servlet) {
455         if (webRoot!=null) webRoot.setServlet(param, servlet);
456     }
457
458     public void setSessionConfig(org.netbeans.modules.j2ee.sun.dd.api.web.SessionConfig sessionConfig) {
459         if (webRoot!=null) webRoot.setSessionConfig(sessionConfig);
460     }
461
462     public void setWebserviceDescription(org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription[] webserviceDescription) {
463         if (webRoot!=null) webRoot.setWebserviceDescription(webserviceDescription);
464     }
465
466     public void setWebserviceDescription(int param, org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceDescription webserviceDescription) {
467         if (webRoot!=null) webRoot.setWebserviceDescription(param, webserviceDescription);
468     }
469
470     public int sizeEjbRef() {
471         return webRoot==null?-1:webRoot.sizeEjbRef();
472     }
473
474     public int sizeIdempotentUrlPattern() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
475         return webRoot==null?-1:webRoot.sizeIdempotentUrlPattern();
476     }
477
478     public int sizeIdempotentUrlPatternNumOfRetries() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
479         return webRoot==null?-1:webRoot.sizeIdempotentUrlPatternNumOfRetries();
480     }
481
482     public int sizeIdempotentUrlPatternUrlPattern() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
483         return webRoot==null?-1:webRoot.sizeIdempotentUrlPatternUrlPattern();
484     }
485
486     public int sizeMessageDestination() {
487         return webRoot==null?-1:webRoot.sizeMessageDestination();
488     }
489
490     public int sizeWebProperty() {
491         return webRoot==null?-1:webRoot.sizeWebProperty();
492     }
493
494     public int sizeResourceEnvRef() {
495         return webRoot==null?-1:webRoot. sizeResourceEnvRef();
496     }
497
498     public int sizeResourceRef() {
499         return webRoot==null?-1:webRoot.sizeResourceRef();
500     }
501
502     public int sizeSecurityRoleMapping() {
503         return webRoot==null?-1:webRoot.sizeSecurityRoleMapping();
504     }
505
506     public int sizeServiceRef() {
507         return webRoot==null?-1:webRoot.sizeServiceRef();
508     }
509
510     public int sizeServlet() {
511         return webRoot==null?-1:webRoot.sizeServlet();
512     }
513
514     public int sizeWebserviceDescription() {
515         return webRoot==null?-1:webRoot.sizeWebserviceDescription();
516     }
517     
518     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
519         if (webRoot != null)
520             webRoot.removePropertyChangeListener(pcl);
521         listeners.remove(pcl);
522     }
523
524     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl) {
525          if (webRoot != null)
526             webRoot.addPropertyChangeListener(pcl);
527         listeners.add(pcl);
528     }
529
530     public SunWebApp getOriginal() {
531         return webRoot;
532     }
533     
534     public org.xml.sax.SAXParseException JavaDoc getError() {
535         return error;
536     }
537     public void setError(org.xml.sax.SAXParseException JavaDoc error) {
538         this.error = error;
539     }
540     
541     public void setVersion(java.math.BigDecimal JavaDoc version) {
542         String JavaDoc newVersion = version.toString();
543         String JavaDoc currentVersion = null;
544         if (this.version.equals(newVersion))
545             return;
546         if (webRoot != null) {
547             Document JavaDoc document = null;
548             if (webRoot instanceof org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp) {
549                 document =
550                         ((org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp)webRoot).graphManager().getXmlDocument();
551                 currentVersion = SunWebApp.VERSION_2_3_0;
552             }else if (webRoot instanceof org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp) {
553                 document =
554                         ((org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp)webRoot).graphManager().getXmlDocument();
555                 currentVersion = SunWebApp.VERSION_2_4_0;
556             }else if (webRoot instanceof org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp) {
557                 document =
558                         ((org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp)webRoot).graphManager().getXmlDocument();
559                 currentVersion = SunWebApp.VERSION_2_4_1;
560             }else if (webRoot instanceof org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp) {
561                 document =
562                         ((org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp)webRoot).graphManager().getXmlDocument();
563                 currentVersion = SunWebApp.VERSION_2_5_0;
564             }
565             
566             //remove the doctype
567
document = removeDocType(document);
568             
569             if(newVersion.equals(SunWebApp.VERSION_2_5_0)){
570                 //This will always be an upgrade
571
generate2_50Graph(document);
572             }
573             if(newVersion.equals(SunWebApp.VERSION_2_4_1)){
574                 if(currentVersion.equals(SunWebApp.VERSION_2_4_0) || currentVersion.equals(SunWebApp.VERSION_2_3_0))
575                     generate2_41Graph(document);
576                 else
577                     downgradeWebGraph(document, newVersion, currentVersion);
578             }
579             if(newVersion.equals(SunWebApp.VERSION_2_4_0)){
580                 if(currentVersion.equals(SunWebApp.VERSION_2_3_0))
581                     generate2_40Graph(document);
582                 else
583                     downgradeWebGraph(document, newVersion, currentVersion);
584             }
585             if(newVersion.equals(SunWebApp.VERSION_2_3_0)){
586                 ////This will always be a downgrade
587
downgradeWebGraph(document, newVersion, currentVersion);
588             }
589         }
590     }
591
592     private void downgradeWebGraph(Document JavaDoc document, String JavaDoc downgradeVersion, String JavaDoc currentVersion){
593             DDTreeWalker downgradeScanner = new DDTreeWalker(document, downgradeVersion, currentVersion);
594             downgradeScanner.downgradeSunWebAppDocument();
595             if(downgradeVersion.equals(SunWebApp.VERSION_2_4_1)){
596                 generate2_41Graph(document);
597             }else if(downgradeVersion.equals(SunWebApp.VERSION_2_4_0)){
598                 generate2_40Graph(document);
599             }else if(downgradeVersion.equals(SunWebApp.VERSION_2_3_0)){
600                 generate2_30Graph(document);
601             }
602     }
603         
604     private Document JavaDoc removeDocType(Document JavaDoc document){
605         if (document != null) {
606             org.w3c.dom.Element JavaDoc docElement = document.getDocumentElement();
607             if (docElement != null) {
608                 org.w3c.dom.DocumentType JavaDoc docType = document.getDoctype();
609                 if (docType != null) {
610                     document.removeChild(docType); //NOI18N
611
}
612             }
613         }
614         return document;
615     }
616     
617     private void generate2_50Graph(Document JavaDoc document){
618         org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp webGraph =
619                 org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_5_0.SunWebApp.createGraph(document);
620         webGraph.changeDocType(DTDRegistry.SUN_WEBAPP_250_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_250_DTD_SYSTEM_ID);
621         this.webRoot = webGraph;
622     }
623     
624     private void generate2_41Graph(Document JavaDoc document){
625         org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp webGraph =
626                 org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_1.SunWebApp.createGraph(document);
627         webGraph.changeDocType(DTDRegistry.SUN_WEBAPP_241_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_241_DTD_SYSTEM_ID);
628         this.webRoot = webGraph;
629     }
630     
631     private void generate2_40Graph(Document JavaDoc document){
632         org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp webGraph =
633                 org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_4_0.SunWebApp.createGraph(document);
634         webGraph.changeDocType(DTDRegistry.SUN_WEBAPP_240_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_240_DTD_SYSTEM_ID);
635         this.webRoot = webGraph;
636     }
637     
638     private void generate2_30Graph(Document JavaDoc document){
639         org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp webGraph =
640                 org.netbeans.modules.j2ee.sun.dd.impl.web.model_2_3_0.SunWebApp.createGraph(document);
641         webGraph.changeDocType(DTDRegistry.SUN_WEBAPP_230_DTD_PUBLIC_ID, DTDRegistry.SUN_WEBAPP_230_DTD_SYSTEM_ID);
642         this.webRoot = webGraph;
643     }
644     
645     public java.math.BigDecimal JavaDoc getVersion() {
646         return new java.math.BigDecimal JavaDoc(version);
647     }
648     
649     public Object JavaDoc getValue(String JavaDoc name) {
650         return webRoot==null?null:webRoot.getValue(name);
651     }
652     
653     public void write(java.io.OutputStream JavaDoc os) throws java.io.IOException JavaDoc {
654         if (webRoot != null) {
655             webRoot.write(os);
656         }
657     }
658     
659     public String JavaDoc dumpBeanNode() {
660         if (webRoot != null)
661             return webRoot.dumpBeanNode();
662         else
663             return null;
664     }
665
666     public void setValue(String JavaDoc name, Object JavaDoc[] value) {
667         if (webRoot!=null) webRoot.setValue(name, value);
668     }
669
670     public Object JavaDoc[] getValues(String JavaDoc name) {
671         return webRoot==null?null:webRoot.getValues(name);
672     }
673
674     public void setValue(String JavaDoc name, int index, Object JavaDoc value) {
675         if (webRoot!=null) webRoot.setValue(name, index, value);
676     }
677
678     public void setValue(String JavaDoc name, Object JavaDoc value) {
679         if (webRoot!=null) webRoot.setValue(name, value);
680     }
681
682     public Object JavaDoc getValue(String JavaDoc name, int index) {
683         return webRoot==null?null:webRoot.getValue(name, index);
684     }
685
686     public String JavaDoc getAttributeValue(String JavaDoc name) {
687          return webRoot==null?null:webRoot.getAttributeValue(name);
688     }
689
690     public int size(String JavaDoc name) {
691          return webRoot==null?-1:webRoot.size(name);
692     }
693
694     public int addValue(String JavaDoc name, Object JavaDoc value) {
695         return webRoot==null?-1:webRoot.addValue(name, value);
696     }
697
698     public String JavaDoc[] findPropertyValue(String JavaDoc propName, Object JavaDoc value) {
699         return webRoot==null?null:webRoot.findPropertyValue(propName, value);
700     }
701
702     public int removeValue(String JavaDoc name, Object JavaDoc value) {
703         return webRoot==null?-1:webRoot.removeValue(name, value);
704     }
705
706     public void write(java.io.Writer JavaDoc w) throws java.io.IOException JavaDoc, DDException {
707         if (webRoot!=null) webRoot.write(w);
708     }
709
710     public void removeValue(String JavaDoc name, int index) {
711         if (webRoot!=null) webRoot.removeValue(name, index);
712     }
713
714     public Object JavaDoc clone() {
715         SunWebAppProxy proxy = null;
716         if (webRoot==null)
717             proxy = new SunWebAppProxy(null, version);
718         else {
719             SunWebApp clonedSunWeb=(SunWebApp)webRoot.clone();
720             proxy = new SunWebAppProxy(clonedSunWeb, version);
721         }
722         proxy.setError(error);
723         return proxy;
724     }
725
726     public String JavaDoc getAttributeValue(String JavaDoc propName, String JavaDoc name) {
727         return webRoot==null?null:webRoot.getAttributeValue(propName, name);
728     }
729
730     public String JavaDoc getAttributeValue(String JavaDoc propName, int index, String JavaDoc name) {
731         return webRoot==null?null:webRoot.getAttributeValue(propName, index, name);
732     }
733
734     public void setAttributeValue(String JavaDoc name, String JavaDoc value) {
735         if (webRoot!=null) webRoot.setAttributeValue(name, value);
736     }
737
738     public void setAttributeValue(String JavaDoc propName, String JavaDoc name, String JavaDoc value) {
739         if (webRoot!=null) webRoot.setAttributeValue(propName, name, value);
740     }
741
742     public void setAttributeValue(String JavaDoc propName, int index, String JavaDoc name, String JavaDoc value) {
743         if (webRoot!=null) webRoot.setAttributeValue(propName, index, name, value);
744     }
745     
746     public CommonDDBean getPropertyParent(String JavaDoc name) {
747         return webRoot.getPropertyParent(name);
748     }
749
750     public void merge(CommonDDBean root, int mode) {
751         if (webRoot != null) {
752             if (root instanceof SunWebAppProxy)
753                 webRoot.merge(((SunWebAppProxy)root).getOriginal(), mode);
754             else webRoot.merge(root, mode);
755         }
756     }
757
758     public CommonDDBean cloneVersion(String JavaDoc version) {
759         return webRoot == null ? null : webRoot.cloneVersion(version);
760     }
761    
762     public int removeMessageDestinationRef(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
763         return webRoot==null?-1:webRoot.removeMessageDestinationRef(value);
764     }
765
766     public int addMessageDestinationRef(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
767         return webRoot==null?-1:webRoot.addMessageDestinationRef(value);
768     }
769
770     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef getMessageDestinationRef(int index) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
771         return webRoot==null?null:webRoot.getMessageDestinationRef(index);
772     }
773
774     public void setMessageDestinationRef(int index, org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
775         if (webRoot!=null) webRoot.setMessageDestinationRef(index, value);
776     }
777
778     public void setMessageDestinationRef(org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef[] value) throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
779         if (webRoot!=null) webRoot.setMessageDestinationRef(value);
780     }
781
782     public int sizeMessageDestinationRef() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
783         return webRoot==null?-1:webRoot.sizeMessageDestinationRef();
784     }
785
786     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef newMessageDestinationRef() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
787         return webRoot==null?null:webRoot.newMessageDestinationRef();
788     }
789
790     public org.netbeans.modules.j2ee.sun.dd.api.common.MessageDestinationRef[] getMessageDestinationRef() throws org.netbeans.modules.j2ee.sun.dd.api.VersionNotSupportedException {
791         return webRoot==null?null:webRoot.getMessageDestinationRef();
792     }
793
794     /** Contract between friend modules that enables
795     * a specific handling of write(FileObject) method for targeted FileObject
796     */

797     public static interface OutputProvider {
798         public void write(SunWebApp webApp) throws java.io.IOException JavaDoc;
799     }
800     
801 }
802
Popular Tags