KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > convert > xml > WebAppImpl


1 /**
2  * This class was generated from a set of XML constraints
3  * by the Enhydra Zeus XML Data Binding Framework. All
4  * source code in this file is constructed specifically
5  * to work with other Zeus-generated classes. If you
6  * modify this file by hand, you run the risk of breaking
7  * this interoperation, as well as introducing errors in
8  * source code compilation.
9  *
10  * * * * * MODIFY THIS FILE AT YOUR OWN RISK * * * * *
11  *
12  * To find out more about the Enhydra Zeus framework, you
13  * can point your browser at <http://zeus.enhydra.org>
14  * where you can download releases, join and discuss Zeus
15  * on user and developer mailing lists, and access source
16  * code. Please report any bugs through that website.
17  */

18 package org.enhydra.convert.xml;
19
20 // Global Implementation Import Statements
21
import java.io.File JavaDoc;
22 import java.io.FileReader JavaDoc;
23 import java.io.FileWriter JavaDoc;
24 import java.io.InputStream JavaDoc;
25 import java.io.InputStreamReader JavaDoc;
26 import java.io.IOException JavaDoc;
27 import java.io.OutputStream JavaDoc;
28 import java.io.OutputStreamWriter JavaDoc;
29 import java.io.Reader JavaDoc;
30 import java.io.Writer JavaDoc;
31 import java.util.HashMap JavaDoc;
32 import java.util.Iterator JavaDoc;
33 import java.util.Map JavaDoc;
34 import org.xml.sax.EntityResolver JavaDoc;
35 import org.xml.sax.ErrorHandler JavaDoc;
36 import org.xml.sax.InputSource JavaDoc;
37 import org.xml.sax.Locator JavaDoc;
38 import org.xml.sax.SAXException JavaDoc;
39 import org.xml.sax.SAXParseException JavaDoc;
40 import org.xml.sax.XMLReader JavaDoc;
41 import org.xml.sax.ext.LexicalHandler JavaDoc;
42 import org.xml.sax.helpers.DefaultHandler JavaDoc;
43 import org.xml.sax.helpers.XMLReaderFactory JavaDoc;
44
45 // Local Implementation Import Statements
46
import java.util.Iterator JavaDoc;
47 import java.util.List JavaDoc;
48 import java.util.LinkedList JavaDoc;
49
50 public class WebAppImpl extends DefaultHandler JavaDoc implements Cloneable JavaDoc, Unmarshallable, LexicalHandler JavaDoc, WebApp {
51
52     private Icon icon;
53     private DisplayName displayName;
54     private Description description;
55     private Distributable distributable;
56     private List JavaDoc contextParamList;
57     private List JavaDoc filterList;
58     private List JavaDoc filterMappingList;
59     private List JavaDoc listenerList;
60     private List JavaDoc servletList;
61     private List JavaDoc servletMappingList;
62     private SessionConfig sessionConfig;
63     private List JavaDoc mimeMappingList;
64     private WelcomeFileList welcomeFileList;
65     private List JavaDoc errorPageList;
66     private List JavaDoc taglibList;
67     private List JavaDoc resourceEnvRefList;
68     private List JavaDoc resourceRefList;
69     private List JavaDoc securityConstraintList;
70     private LoginConfig loginConfig;
71     private List JavaDoc securityRoleList;
72     private List JavaDoc envEntryList;
73     private List JavaDoc ejbRefList;
74     private List JavaDoc ejbLocalRefList;
75     private String JavaDoc id;
76     private boolean zeus_IdSet;
77
78     /** Any DOCTYPE reference/statements. */
79     private String JavaDoc docTypeString;
80
81     /** The encoding for the output document */
82     private String JavaDoc outputEncoding;
83
84     /** The current node in unmarshalling */
85     private Unmarshallable zeus_currentUNode;
86
87     /** The parent node in unmarshalling */
88     private Unmarshallable zeus_parentUNode;
89
90     /** Whether this node has been handled */
91     private boolean zeus_thisNodeHandled = false;
92
93     /** Whether a DTD exists for an unmarshal call */
94     private boolean hasDTD;
95
96     /** Whether validation is occurring */
97     private boolean validate;
98
99     /** The namespace mappings on this element */
100     private Map JavaDoc namespaceMappings;
101
102     /** The EntityResolver for SAX parsing to use */
103     private static EntityResolver JavaDoc entityResolver;
104
105     /** The ErrorHandler for SAX parsing to use */
106     private static ErrorHandler JavaDoc errorHandler;
107
108     private static WebAppImpl prototype = null;
109
110     public static void setPrototype(WebAppImpl prototype) {
111         WebAppImpl.prototype = prototype;
112     }
113     public static WebAppImpl newInstance() {
114         try {
115             return (prototype!=null)?(WebAppImpl)prototype.clone(): new WebAppImpl();
116         } catch (CloneNotSupportedException JavaDoc e) {
117             return null; // never
118
}
119     }
120     public WebAppImpl() {
121         contextParamList = new LinkedList JavaDoc();
122         filterList = new LinkedList JavaDoc();
123         filterMappingList = new LinkedList JavaDoc();
124         listenerList = new LinkedList JavaDoc();
125         servletList = new LinkedList JavaDoc();
126         servletMappingList = new LinkedList JavaDoc();
127         mimeMappingList = new LinkedList JavaDoc();
128         errorPageList = new LinkedList JavaDoc();
129         taglibList = new LinkedList JavaDoc();
130         resourceEnvRefList = new LinkedList JavaDoc();
131         resourceRefList = new LinkedList JavaDoc();
132         securityConstraintList = new LinkedList JavaDoc();
133         securityRoleList = new LinkedList JavaDoc();
134         envEntryList = new LinkedList JavaDoc();
135         ejbRefList = new LinkedList JavaDoc();
136         ejbLocalRefList = new LinkedList JavaDoc();
137         zeus_IdSet = false;
138         docTypeString = "";
139         hasDTD = false;
140         validate = false;
141         namespaceMappings = new HashMap JavaDoc();
142     }
143
144     public Icon getIcon() {
145         return icon;
146     }
147
148     public void setIcon(Icon icon) {
149         this.icon = icon;
150     }
151
152     public DisplayName getDisplayName() {
153         return displayName;
154     }
155
156     public void setDisplayName(DisplayName displayName) {
157         this.displayName = displayName;
158     }
159
160     public Description getDescription() {
161         return description;
162     }
163
164     public void setDescription(Description description) {
165         this.description = description;
166     }
167
168     public Distributable getDistributable() {
169         return distributable;
170     }
171
172     public void setDistributable(Distributable distributable) {
173         this.distributable = distributable;
174     }
175
176     public List JavaDoc getContextParamList() {
177         return contextParamList;
178     }
179
180     public void setContextParamList(List JavaDoc contextParamList) {
181         this.contextParamList = contextParamList;
182     }
183
184     public void addContextParam(ContextParam contextParam) {
185         contextParamList.add(contextParam);
186     }
187
188     public void removeContextParam(ContextParam contextParam) {
189         contextParamList.remove(contextParam);
190     }
191
192     public List JavaDoc getFilterList() {
193         return filterList;
194     }
195
196     public void setFilterList(List JavaDoc filterList) {
197         this.filterList = filterList;
198     }
199
200     public void addFilter(Filter filter) {
201         filterList.add(filter);
202     }
203
204     public void removeFilter(Filter filter) {
205         filterList.remove(filter);
206     }
207
208     public List JavaDoc getFilterMappingList() {
209         return filterMappingList;
210     }
211
212     public void setFilterMappingList(List JavaDoc filterMappingList) {
213         this.filterMappingList = filterMappingList;
214     }
215
216     public void addFilterMapping(FilterMapping filterMapping) {
217         filterMappingList.add(filterMapping);
218     }
219
220     public void removeFilterMapping(FilterMapping filterMapping) {
221         filterMappingList.remove(filterMapping);
222     }
223
224     public List JavaDoc getListenerList() {
225         return listenerList;
226     }
227
228     public void setListenerList(List JavaDoc listenerList) {
229         this.listenerList = listenerList;
230     }
231
232     public void addListener(Listener listener) {
233         listenerList.add(listener);
234     }
235
236     public void removeListener(Listener listener) {
237         listenerList.remove(listener);
238     }
239
240     public List JavaDoc getServletList() {
241         return servletList;
242     }
243
244     public void setServletList(List JavaDoc servletList) {
245         this.servletList = servletList;
246     }
247
248     public void addServlet(Servlet servlet) {
249         servletList.add(servlet);
250     }
251
252     public void removeServlet(Servlet servlet) {
253         servletList.remove(servlet);
254     }
255
256     public List JavaDoc getServletMappingList() {
257         return servletMappingList;
258     }
259
260     public void setServletMappingList(List JavaDoc servletMappingList) {
261         this.servletMappingList = servletMappingList;
262     }
263
264     public void addServletMapping(ServletMapping servletMapping) {
265         servletMappingList.add(servletMapping);
266     }
267
268     public void removeServletMapping(ServletMapping servletMapping) {
269         servletMappingList.remove(servletMapping);
270     }
271
272     public SessionConfig getSessionConfig() {
273         return sessionConfig;
274     }
275
276     public void setSessionConfig(SessionConfig sessionConfig) {
277         this.sessionConfig = sessionConfig;
278     }
279
280     public List JavaDoc getMimeMappingList() {
281         return mimeMappingList;
282     }
283
284     public void setMimeMappingList(List JavaDoc mimeMappingList) {
285         this.mimeMappingList = mimeMappingList;
286     }
287
288     public void addMimeMapping(MimeMapping mimeMapping) {
289         mimeMappingList.add(mimeMapping);
290     }
291
292     public void removeMimeMapping(MimeMapping mimeMapping) {
293         mimeMappingList.remove(mimeMapping);
294     }
295
296     public WelcomeFileList getWelcomeFileList() {
297         return welcomeFileList;
298     }
299
300     public void setWelcomeFileList(WelcomeFileList welcomeFileList) {
301         this.welcomeFileList = welcomeFileList;
302     }
303
304     public List JavaDoc getErrorPageList() {
305         return errorPageList;
306     }
307
308     public void setErrorPageList(List JavaDoc errorPageList) {
309         this.errorPageList = errorPageList;
310     }
311
312     public void addErrorPage(ErrorPage errorPage) {
313         errorPageList.add(errorPage);
314     }
315
316     public void removeErrorPage(ErrorPage errorPage) {
317         errorPageList.remove(errorPage);
318     }
319
320     public List JavaDoc getTaglibList() {
321         return taglibList;
322     }
323
324     public void setTaglibList(List JavaDoc taglibList) {
325         this.taglibList = taglibList;
326     }
327
328     public void addTaglib(Taglib taglib) {
329         taglibList.add(taglib);
330     }
331
332     public void removeTaglib(Taglib taglib) {
333         taglibList.remove(taglib);
334     }
335
336     public List JavaDoc getResourceEnvRefList() {
337         return resourceEnvRefList;
338     }
339
340     public void setResourceEnvRefList(List JavaDoc resourceEnvRefList) {
341         this.resourceEnvRefList = resourceEnvRefList;
342     }
343
344     public void addResourceEnvRef(ResourceEnvRef resourceEnvRef) {
345         resourceEnvRefList.add(resourceEnvRef);
346     }
347
348     public void removeResourceEnvRef(ResourceEnvRef resourceEnvRef) {
349         resourceEnvRefList.remove(resourceEnvRef);
350     }
351
352     public List JavaDoc getResourceRefList() {
353         return resourceRefList;
354     }
355
356     public void setResourceRefList(List JavaDoc resourceRefList) {
357         this.resourceRefList = resourceRefList;
358     }
359
360     public void addResourceRef(ResourceRef resourceRef) {
361         resourceRefList.add(resourceRef);
362     }
363
364     public void removeResourceRef(ResourceRef resourceRef) {
365         resourceRefList.remove(resourceRef);
366     }
367
368     public List JavaDoc getSecurityConstraintList() {
369         return securityConstraintList;
370     }
371
372     public void setSecurityConstraintList(List JavaDoc securityConstraintList) {
373         this.securityConstraintList = securityConstraintList;
374     }
375
376     public void addSecurityConstraint(SecurityConstraint securityConstraint) {
377         securityConstraintList.add(securityConstraint);
378     }
379
380     public void removeSecurityConstraint(SecurityConstraint securityConstraint) {
381         securityConstraintList.remove(securityConstraint);
382     }
383
384     public LoginConfig getLoginConfig() {
385         return loginConfig;
386     }
387
388     public void setLoginConfig(LoginConfig loginConfig) {
389         this.loginConfig = loginConfig;
390     }
391
392     public List JavaDoc getSecurityRoleList() {
393         return securityRoleList;
394     }
395
396     public void setSecurityRoleList(List JavaDoc securityRoleList) {
397         this.securityRoleList = securityRoleList;
398     }
399
400     public void addSecurityRole(SecurityRole securityRole) {
401         securityRoleList.add(securityRole);
402     }
403
404     public void removeSecurityRole(SecurityRole securityRole) {
405         securityRoleList.remove(securityRole);
406     }
407
408     public List JavaDoc getEnvEntryList() {
409         return envEntryList;
410     }
411
412     public void setEnvEntryList(List JavaDoc envEntryList) {
413         this.envEntryList = envEntryList;
414     }
415
416     public void addEnvEntry(EnvEntry envEntry) {
417         envEntryList.add(envEntry);
418     }
419
420     public void removeEnvEntry(EnvEntry envEntry) {
421         envEntryList.remove(envEntry);
422     }
423
424     public List JavaDoc getEjbRefList() {
425         return ejbRefList;
426     }
427
428     public void setEjbRefList(List JavaDoc ejbRefList) {
429         this.ejbRefList = ejbRefList;
430     }
431
432     public void addEjbRef(EjbRef ejbRef) {
433         ejbRefList.add(ejbRef);
434     }
435
436     public void removeEjbRef(EjbRef ejbRef) {
437         ejbRefList.remove(ejbRef);
438     }
439
440     public List JavaDoc getEjbLocalRefList() {
441         return ejbLocalRefList;
442     }
443
444     public void setEjbLocalRefList(List JavaDoc ejbLocalRefList) {
445         this.ejbLocalRefList = ejbLocalRefList;
446     }
447
448     public void addEjbLocalRef(EjbLocalRef ejbLocalRef) {
449         ejbLocalRefList.add(ejbLocalRef);
450     }
451
452     public void removeEjbLocalRef(EjbLocalRef ejbLocalRef) {
453         ejbLocalRefList.remove(ejbLocalRef);
454     }
455
456     public String JavaDoc getId() {
457         return id;
458     }
459
460     public void setId(String JavaDoc id) {
461         this.id = id;
462         zeus_IdSet = true;
463     }
464
465     public void setDocType(String JavaDoc name, String JavaDoc publicID, String JavaDoc systemID) {
466         try {
467             startDTD(name, publicID, systemID);
468         } catch (SAXException JavaDoc neverHappens) { }
469     }
470
471     public void setOutputEncoding(String JavaDoc outputEncoding) {
472         this.outputEncoding = outputEncoding;
473     }
474
475     public void marshal(File JavaDoc file) throws IOException JavaDoc {
476         // Delegate to the marshal(Writer) method
477
marshal(new FileWriter JavaDoc(file));
478     }
479
480     public void marshal(OutputStream JavaDoc outputStream) throws IOException JavaDoc {
481         // Delegate to the marshal(Writer) method
482
marshal(new OutputStreamWriter JavaDoc(outputStream));
483     }
484
485     public void marshal(Writer JavaDoc writer) throws IOException JavaDoc {
486         // Write out the XML declaration
487
writer.write("<?xml version=\"1.0\" ");
488         if (outputEncoding != null) {
489             writer.write("encoding=\"");
490             writer.write(outputEncoding);
491             writer.write("\"?>\n\n");
492
493         } else {
494             writer.write("encoding=\"UTF-8\"?>\n\n");
495
496         }
497         // Handle DOCTYPE declaration
498
writer.write(docTypeString);
499         writer.write("\n");
500         // Now start the recursive writing
501
writeXMLRepresentation(writer, "");
502
503         // Close up
504
writer.flush();
505         writer.close();
506     }
507
508     protected void writeXMLRepresentation(Writer JavaDoc writer,
509                                           String JavaDoc indent)
510         throws IOException JavaDoc {
511
512         writer.write(indent);
513         writer.write("<web-app");
514
515         // Handle namespace mappings (if needed)
516
for (Iterator JavaDoc i = namespaceMappings.keySet().iterator(); i.hasNext(); ) {
517             String JavaDoc prefix = (String JavaDoc)i.next();
518             String JavaDoc uri = (String JavaDoc)namespaceMappings.get(prefix);
519             writer.write(" xmlns");
520             if (!prefix.trim().equals("")) {
521                 writer.write(":");
522                 writer.write(prefix);
523             }
524             writer.write("=\"");
525             writer.write(uri);
526             writer.write("\"\n ");
527         }
528
529         // Handle attributes (if needed)
530
if (zeus_IdSet) {
531             writer.write(" id=\"");
532             writer.write(escapeAttributeValue(id));
533             writer.write("\"");
534         }
535         writer.write(">");
536         writer.write("\n");
537
538         // Handle child elements
539
if (icon != null) {
540             ((IconImpl)icon).writeXMLRepresentation(writer,
541                 new StringBuffer JavaDoc(indent).append(" ").toString());
542         }
543
544         if (displayName != null) {
545             ((DisplayNameImpl)displayName).writeXMLRepresentation(writer,
546                 new StringBuffer JavaDoc(indent).append(" ").toString());
547         }
548
549         if (description != null) {
550             ((DescriptionImpl)description).writeXMLRepresentation(writer,
551                 new StringBuffer JavaDoc(indent).append(" ").toString());
552         }
553
554         if (distributable != null) {
555             ((DistributableImpl)distributable).writeXMLRepresentation(writer,
556                 new StringBuffer JavaDoc(indent).append(" ").toString());
557         }
558
559         for (Iterator JavaDoc i=contextParamList.iterator(); i.hasNext(); ) {
560             ContextParamImpl contextParam = (ContextParamImpl)i.next();
561             contextParam.writeXMLRepresentation(writer,
562                 new StringBuffer JavaDoc(indent).append(" ").toString());
563         }
564         for (Iterator JavaDoc i=filterList.iterator(); i.hasNext(); ) {
565             FilterImpl filter = (FilterImpl)i.next();
566             filter.writeXMLRepresentation(writer,
567                 new StringBuffer JavaDoc(indent).append(" ").toString());
568         }
569         for (Iterator JavaDoc i=filterMappingList.iterator(); i.hasNext(); ) {
570             FilterMappingImpl filterMapping = (FilterMappingImpl)i.next();
571             filterMapping.writeXMLRepresentation(writer,
572                 new StringBuffer JavaDoc(indent).append(" ").toString());
573         }
574         for (Iterator JavaDoc i=listenerList.iterator(); i.hasNext(); ) {
575             ListenerImpl listener = (ListenerImpl)i.next();
576             listener.writeXMLRepresentation(writer,
577                 new StringBuffer JavaDoc(indent).append(" ").toString());
578         }
579         for (Iterator JavaDoc i=servletList.iterator(); i.hasNext(); ) {
580             ServletImpl servlet = (ServletImpl)i.next();
581             servlet.writeXMLRepresentation(writer,
582                 new StringBuffer JavaDoc(indent).append(" ").toString());
583         }
584         for (Iterator JavaDoc i=servletMappingList.iterator(); i.hasNext(); ) {
585             ServletMappingImpl servletMapping = (ServletMappingImpl)i.next();
586             servletMapping.writeXMLRepresentation(writer,
587                 new StringBuffer JavaDoc(indent).append(" ").toString());
588         }
589         if (sessionConfig != null) {
590             ((SessionConfigImpl)sessionConfig).writeXMLRepresentation(writer,
591                 new StringBuffer JavaDoc(indent).append(" ").toString());
592         }
593
594         for (Iterator JavaDoc i=mimeMappingList.iterator(); i.hasNext(); ) {
595             MimeMappingImpl mimeMapping = (MimeMappingImpl)i.next();
596             mimeMapping.writeXMLRepresentation(writer,
597                 new StringBuffer JavaDoc(indent).append(" ").toString());
598         }
599         if (welcomeFileList != null) {
600             ((WelcomeFileListImpl)welcomeFileList).writeXMLRepresentation(writer,
601                 new StringBuffer JavaDoc(indent).append(" ").toString());
602         }
603
604         for (Iterator JavaDoc i=errorPageList.iterator(); i.hasNext(); ) {
605             ErrorPageImpl errorPage = (ErrorPageImpl)i.next();
606             errorPage.writeXMLRepresentation(writer,
607                 new StringBuffer JavaDoc(indent).append(" ").toString());
608         }
609         for (Iterator JavaDoc i=taglibList.iterator(); i.hasNext(); ) {
610             TaglibImpl taglib = (TaglibImpl)i.next();
611             taglib.writeXMLRepresentation(writer,
612                 new StringBuffer JavaDoc(indent).append(" ").toString());
613         }
614         for (Iterator JavaDoc i=resourceEnvRefList.iterator(); i.hasNext(); ) {
615             ResourceEnvRefImpl resourceEnvRef = (ResourceEnvRefImpl)i.next();
616             resourceEnvRef.writeXMLRepresentation(writer,
617                 new StringBuffer JavaDoc(indent).append(" ").toString());
618         }
619         for (Iterator JavaDoc i=resourceRefList.iterator(); i.hasNext(); ) {
620             ResourceRefImpl resourceRef = (ResourceRefImpl)i.next();
621             resourceRef.writeXMLRepresentation(writer,
622                 new StringBuffer JavaDoc(indent).append(" ").toString());
623         }
624         for (Iterator JavaDoc i=securityConstraintList.iterator(); i.hasNext(); ) {
625             SecurityConstraintImpl securityConstraint = (SecurityConstraintImpl)i.next();
626             securityConstraint.writeXMLRepresentation(writer,
627                 new StringBuffer JavaDoc(indent).append(" ").toString());
628         }
629         if (loginConfig != null) {
630             ((LoginConfigImpl)loginConfig).writeXMLRepresentation(writer,
631                 new StringBuffer JavaDoc(indent).append(" ").toString());
632         }
633
634         for (Iterator JavaDoc i=securityRoleList.iterator(); i.hasNext(); ) {
635             SecurityRoleImpl securityRole = (SecurityRoleImpl)i.next();
636             securityRole.writeXMLRepresentation(writer,
637                 new StringBuffer JavaDoc(indent).append(" ").toString());
638         }
639         for (Iterator JavaDoc i=envEntryList.iterator(); i.hasNext(); ) {
640             EnvEntryImpl envEntry = (EnvEntryImpl)i.next();
641             envEntry.writeXMLRepresentation(writer,
642                 new StringBuffer JavaDoc(indent).append(" ").toString());
643         }
644         for (Iterator JavaDoc i=ejbRefList.iterator(); i.hasNext(); ) {
645             EjbRefImpl ejbRef = (EjbRefImpl)i.next();
646             ejbRef.writeXMLRepresentation(writer,
647                 new StringBuffer JavaDoc(indent).append(" ").toString());
648         }
649         for (Iterator JavaDoc i=ejbLocalRefList.iterator(); i.hasNext(); ) {
650             EjbLocalRefImpl ejbLocalRef = (EjbLocalRefImpl)i.next();
651             ejbLocalRef.writeXMLRepresentation(writer,
652                 new StringBuffer JavaDoc(indent).append(" ").toString());
653         }
654         writer.write(indent);
655         writer.write("</web-app>\n");
656     }
657
658     private String JavaDoc escapeAttributeValue(String JavaDoc attributeValue) {
659         String JavaDoc returnValue = attributeValue;
660         for (int i = 0; i < returnValue.length(); i++) {
661             char ch = returnValue.charAt(i);
662             if (ch == '"') {
663                 returnValue = new StringBuffer JavaDoc()
664                     .append(returnValue.substring(0, i))
665                     .append("&quot;")
666                     .append(returnValue.substring(i+1))
667                     .toString();
668             }
669         }
670         return returnValue;
671     }
672
673     private String JavaDoc escapeTextValue(String JavaDoc textValue) {
674         String JavaDoc returnValue = textValue;
675         for (int i = 0; i < returnValue.length(); i++) {
676             char ch = returnValue.charAt(i);
677             if (ch == '<') {
678                 returnValue = new StringBuffer JavaDoc()
679                     .append(returnValue.substring(0, i))
680                     .append("&lt;")
681                     .append(returnValue.substring(i+1))
682                     .toString();
683             } else if (ch == '>') {
684                 returnValue = new StringBuffer JavaDoc()
685                     .append(returnValue.substring(0, i))
686                     .append("&gt;")
687                     .append(returnValue.substring(i+1))
688                     .toString();
689             }
690         }
691         return returnValue;
692     }
693
694     /**
695      * <p>
696      * This sets a SAX <code>EntityResolver</code> for this unmarshalling process.
697      * </p>
698      *
699      * @param resolver the entity resolver to use.
700      */

701     public static void setEntityResolver(EntityResolver JavaDoc resolver) {
702         entityResolver = resolver;
703     }
704
705     /**
706      * <p>
707      * This sets a SAX <code>ErrorHandler</code> for this unmarshalling process.
708      * </p>
709      *
710      * @param handler the entity resolver to use.
711      */

712     public static void setErrorHandler(ErrorHandler JavaDoc handler) {
713         errorHandler = handler;
714     }
715
716     public static WebApp unmarshal(File JavaDoc file) throws IOException JavaDoc {
717         // Delegate to the unmarshal(Reader) method
718
return unmarshal(new FileReader JavaDoc(file));
719     }
720
721     public static WebApp unmarshal(File JavaDoc file, boolean validate) throws IOException JavaDoc {
722         // Delegate to the unmarshal(Reader) method
723
return unmarshal(new FileReader JavaDoc(file), validate);
724     }
725
726     public static WebApp unmarshal(InputStream JavaDoc inputStream) throws IOException JavaDoc {
727         // Delegate to the unmarshal(Reader) method
728
return unmarshal(new InputStreamReader JavaDoc(inputStream));
729     }
730
731     public static WebApp unmarshal(InputStream JavaDoc inputStream, boolean validate) throws IOException JavaDoc {
732         // Delegate to the unmarshal(Reader) method
733
return unmarshal(new InputStreamReader JavaDoc(inputStream), validate);
734     }
735
736     public static WebApp unmarshal(Reader JavaDoc reader) throws IOException JavaDoc {
737         // Delegate with default validation value
738
return unmarshal(reader, false);
739     }
740
741     public