Source Code Cross Referenced for TemplateGroup.java in  » IDE-Netbeans » xml » org » netbeans » modules » xml » wsdl » bindingsupport » template » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » xml » org.netbeans.modules.xml.wsdl.bindingsupport.template 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        /**
043:         *	This generated bean class TemplateGroup
044:         *	matches the schema element 'templateGroup'.
045:         *
046:         *	Generated on Thu Sep 14 11:59:06 PDT 2006
047:         *
048:         *	This class matches the root element of the XML Schema,
049:         *	and is the root of the bean graph.
050:         *
051:         * 	templateGroup <templateGroup> : TemplateGroup
052:         * 		[attr: namespace CDATA #IMPLIED  : java.lang.String]
053:         * 		[attr: prefix CDATA #IMPLIED  : java.lang.String]
054:         * 		template <template> : TemplateType[1,n]
055:         * 			[attr: name CDATA #IMPLIED  : java.lang.String]
056:         * 			[attr: default CDATA #IMPLIED  : boolean]
057:         * 			wsdlElement <wsdlElement> : WsdlElementType[1,n]
058:         * 				[attr: name CDATA #IMPLIED  : java.lang.String]
059:         * 				extensionElement <extensionElement> : ExtensionElementType[1,n]
060:         * 					[attr: name CDATA #IMPLIED  : java.lang.String]
061:         * 					extensionAttr <extensionAttr> : ExtensionAttrType[1,n]
062:         * 						[attr: name CDATA #IMPLIED  : java.lang.String]
063:         * 						[attr: defaultValue CDATA #IMPLIED  : java.lang.String]
064:         *
065:         * @Generated
066:         */package org.netbeans.modules.xml.wsdl.bindingsupport.template;
067:
068:        public class TemplateGroup {
069:            public static final String NAMESPACE = "Namespace"; // NOI18N
070:            public static final String PREFIX = "Prefix"; // NOI18N
071:            public static final String TEMPLATE = "Template"; // NOI18N
072:
073:            private java.lang.String _Namespace;
074:            private java.lang.String _Prefix;
075:            private java.util.List _Template = new java.util.ArrayList(); // List<TemplateType>
076:            private java.lang.String schemaLocation;
077:
078:            /**
079:             * Normal starting point constructor.
080:             */
081:            public TemplateGroup() {
082:            }
083:
084:            /**
085:             * Required parameters constructor
086:             */
087:            public TemplateGroup(
088:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType[] template) {
089:                if (template != null) {
090:                    ((java.util.ArrayList) _Template)
091:                            .ensureCapacity(template.length);
092:                    for (int i = 0; i < template.length; ++i) {
093:                        _Template.add(template[i]);
094:                    }
095:                }
096:            }
097:
098:            /**
099:             * Deep copy
100:             */
101:            public TemplateGroup(
102:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup source) {
103:                this (source, false);
104:            }
105:
106:            /**
107:             * Deep copy
108:             * @param justData just copy the XML relevant data
109:             */
110:            public TemplateGroup(
111:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup source,
112:                    boolean justData) {
113:                _Namespace = source._Namespace;
114:                _Prefix = source._Prefix;
115:                for (java.util.Iterator it = source._Template.iterator(); it
116:                        .hasNext();) {
117:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType srcElement = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it
118:                            .next();
119:                    _Template.add((srcElement == null) ? null
120:                            : newTemplateType(srcElement, justData));
121:                }
122:                schemaLocation = source.schemaLocation;
123:            }
124:
125:            // This attribute is optional
126:            public void setNamespace(java.lang.String value) {
127:                _Namespace = value;
128:            }
129:
130:            public java.lang.String getNamespace() {
131:                return _Namespace;
132:            }
133:
134:            // This attribute is optional
135:            public void setPrefix(java.lang.String value) {
136:                _Prefix = value;
137:            }
138:
139:            public java.lang.String getPrefix() {
140:                return _Prefix;
141:            }
142:
143:            // This attribute is an array containing at least one element
144:            public void setTemplate(
145:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType[] value) {
146:                if (value == null)
147:                    value = new TemplateType[0];
148:                _Template.clear();
149:                ((java.util.ArrayList) _Template).ensureCapacity(value.length);
150:                for (int i = 0; i < value.length; ++i) {
151:                    _Template.add(value[i]);
152:                }
153:            }
154:
155:            public void setTemplate(
156:                    int index,
157:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType value) {
158:                _Template.set(index, value);
159:            }
160:
161:            public org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType[] getTemplate() {
162:                TemplateType[] arr = new TemplateType[_Template.size()];
163:                return (TemplateType[]) _Template.toArray(arr);
164:            }
165:
166:            public java.util.List fetchTemplateList() {
167:                return _Template;
168:            }
169:
170:            public org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType getTemplate(
171:                    int index) {
172:                return (TemplateType) _Template.get(index);
173:            }
174:
175:            // Return the number of template
176:            public int sizeTemplate() {
177:                return _Template.size();
178:            }
179:
180:            public int addTemplate(
181:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType value) {
182:                _Template.add(value);
183:                int positionOfNewItem = _Template.size() - 1;
184:                return positionOfNewItem;
185:            }
186:
187:            /**
188:             * Search from the end looking for @param value, and then remove it.
189:             */
190:            public int removeTemplate(
191:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType value) {
192:                int pos = _Template.indexOf(value);
193:                if (pos >= 0) {
194:                    _Template.remove(pos);
195:                }
196:                return pos;
197:            }
198:
199:            public void _setSchemaLocation(String location) {
200:                schemaLocation = location;
201:            }
202:
203:            public String _getSchemaLocation() {
204:                return schemaLocation;
205:            }
206:
207:            /**
208:             * Create a new bean using it's default constructor.
209:             * This does not add it to any bean graph.
210:             */
211:            public org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType newTemplateType() {
212:                return new org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType();
213:            }
214:
215:            /**
216:             * Create a new bean, copying from another one.
217:             * This does not add it to any bean graph.
218:             */
219:            public org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType newTemplateType(
220:                    TemplateType source, boolean justData) {
221:                return new org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType(
222:                        source, justData);
223:            }
224:
225:            public void write(org.openide.filesystems.FileObject fo)
226:                    throws java.io.IOException {
227:                org.openide.filesystems.FileLock lock = fo.lock();
228:                try {
229:                    java.io.OutputStream out = fo.getOutputStream(lock);
230:                    write(out);
231:                    out.close();
232:                } finally {
233:                    lock.releaseLock();
234:                }
235:            }
236:
237:            public void write(org.openide.filesystems.FileObject dir,
238:                    String filename) throws java.io.IOException {
239:                org.openide.filesystems.FileObject file = dir
240:                        .getFileObject(filename);
241:                if (file == null) {
242:                    file = dir.createData(filename);
243:                }
244:                write(file);
245:            }
246:
247:            public void write(java.io.File f) throws java.io.IOException {
248:                java.io.OutputStream out = new java.io.FileOutputStream(f);
249:                try {
250:                    write(out);
251:                } finally {
252:                    out.close();
253:                }
254:            }
255:
256:            public void write(java.io.OutputStream out)
257:                    throws java.io.IOException {
258:                write(out, null);
259:            }
260:
261:            public void write(java.io.OutputStream out, String encoding)
262:                    throws java.io.IOException {
263:                java.io.Writer w;
264:                if (encoding == null) {
265:                    encoding = "UTF-8"; // NOI18N
266:                }
267:                w = new java.io.BufferedWriter(new java.io.OutputStreamWriter(
268:                        out, encoding));
269:                write(w, encoding);
270:                w.flush();
271:            }
272:
273:            /**
274:             * Print this Java Bean to @param out including an XML header.
275:             * @param encoding is the encoding style that @param out was opened with.
276:             */
277:            public void write(java.io.Writer out, String encoding)
278:                    throws java.io.IOException {
279:                out.write("<?xml version='1.0'"); // NOI18N
280:                if (encoding != null)
281:                    out.write(" encoding='" + encoding + "'"); // NOI18N
282:                out.write(" ?>\n"); // NOI18N
283:                writeNode(out, "templateGroup", ""); // NOI18N
284:            }
285:
286:            public void writeNode(java.io.Writer out)
287:                    throws java.io.IOException {
288:                String myName;
289:                myName = "templateGroup";
290:                writeNode(out, myName, ""); // NOI18N
291:            }
292:
293:            public void writeNode(java.io.Writer out, String nodeName,
294:                    String indent) throws java.io.IOException {
295:                writeNode(out, nodeName, null, indent, new java.util.HashMap());
296:            }
297:
298:            /**
299:             * It's not recommended to call this method directly.
300:             */
301:            public void writeNode(java.io.Writer out, String nodeName,
302:                    String namespace, String indent, java.util.Map namespaceMap)
303:                    throws java.io.IOException {
304:                out.write(indent);
305:                out.write("<");
306:                if (namespace != null) {
307:                    out.write((String) namespaceMap.get(namespace));
308:                    out.write(":");
309:                }
310:                out.write(nodeName);
311:                out.write(" xmlns='"); // NOI18N
312:                out.write("http://xml.netbeans.org/schema/templates"); // NOI18N
313:                out.write("'"); // NOI18N
314:                if (schemaLocation != null) {
315:                    namespaceMap.put(
316:                            "http://www.w3.org/2001/XMLSchema-instance", "xsi");
317:                    out
318:                            .write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
319:                    out.write(schemaLocation);
320:                    out.write("'"); // NOI18N
321:                }
322:                writeNodeAttributes(out, nodeName, namespace, indent,
323:                        namespaceMap);
324:                out.write(">\n");
325:                writeNodeChildren(out, nodeName, namespace, indent,
326:                        namespaceMap);
327:                out.write(indent);
328:                out.write("</");
329:                if (namespace != null) {
330:                    out.write((String) namespaceMap.get(namespace));
331:                    out.write(":");
332:                }
333:                out.write(nodeName);
334:                out.write(">\n");
335:            }
336:
337:            protected void writeNodeAttributes(java.io.Writer out,
338:                    String nodeName, String namespace, String indent,
339:                    java.util.Map namespaceMap) throws java.io.IOException {
340:                // namespace is an attribute with namespace http://xml.netbeans.org/schema/templates
341:                if (_Namespace != null) {
342:                    out.write(" namespace='");
343:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup
344:                            .writeXML(out, _Namespace, true);
345:                    out.write("'"); // NOI18N
346:                }
347:                // prefix is an attribute with namespace http://xml.netbeans.org/schema/templates
348:                if (_Prefix != null) {
349:                    out.write(" prefix='");
350:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup
351:                            .writeXML(out, _Prefix, true);
352:                    out.write("'"); // NOI18N
353:                }
354:            }
355:
356:            protected void writeNodeChildren(java.io.Writer out,
357:                    String nodeName, String namespace, String indent,
358:                    java.util.Map namespaceMap) throws java.io.IOException {
359:                String nextIndent = indent + "	";
360:                for (java.util.Iterator it = _Template.iterator(); it.hasNext();) {
361:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType element = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it
362:                            .next();
363:                    if (element != null) {
364:                        element.writeNode(out, "template", null, nextIndent,
365:                                namespaceMap);
366:                    }
367:                }
368:            }
369:
370:            public static TemplateGroup read(
371:                    org.openide.filesystems.FileObject fo)
372:                    throws javax.xml.parsers.ParserConfigurationException,
373:                    org.xml.sax.SAXException, java.io.IOException {
374:                java.io.InputStream in = fo.getInputStream();
375:                try {
376:                    return read(in);
377:                } finally {
378:                    in.close();
379:                }
380:            }
381:
382:            public static TemplateGroup read(java.io.File f)
383:                    throws javax.xml.parsers.ParserConfigurationException,
384:                    org.xml.sax.SAXException, java.io.IOException {
385:                java.io.InputStream in = new java.io.FileInputStream(f);
386:                try {
387:                    return read(in);
388:                } finally {
389:                    in.close();
390:                }
391:            }
392:
393:            public static TemplateGroup read(java.io.InputStream in)
394:                    throws javax.xml.parsers.ParserConfigurationException,
395:                    org.xml.sax.SAXException, java.io.IOException {
396:                return read(new org.xml.sax.InputSource(in), false, null, null);
397:            }
398:
399:            /**
400:             * Warning: in readNoEntityResolver character and entity references will
401:             * not be read from any DTD in the XML source.
402:             * However, this way is faster since no DTDs are looked up
403:             * (possibly skipping network access) or parsed.
404:             */
405:            public static TemplateGroup readNoEntityResolver(
406:                    java.io.InputStream in)
407:                    throws javax.xml.parsers.ParserConfigurationException,
408:                    org.xml.sax.SAXException, java.io.IOException {
409:                return read(new org.xml.sax.InputSource(in), false,
410:                        new org.xml.sax.EntityResolver() {
411:                            public org.xml.sax.InputSource resolveEntity(
412:                                    String publicId, String systemId) {
413:                                java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(
414:                                        new byte[0]);
415:                                return new org.xml.sax.InputSource(bin);
416:                            }
417:                        }, null);
418:            }
419:
420:            public static TemplateGroup read(org.xml.sax.InputSource in,
421:                    boolean validate, org.xml.sax.EntityResolver er,
422:                    org.xml.sax.ErrorHandler eh)
423:                    throws javax.xml.parsers.ParserConfigurationException,
424:                    org.xml.sax.SAXException, java.io.IOException {
425:                javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory
426:                        .newInstance();
427:                dbf.setValidating(validate);
428:                dbf.setNamespaceAware(true);
429:                javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
430:                if (er != null)
431:                    db.setEntityResolver(er);
432:                if (eh != null)
433:                    db.setErrorHandler(eh);
434:                org.w3c.dom.Document doc = db.parse(in);
435:                return read(doc);
436:            }
437:
438:            public static TemplateGroup read(org.w3c.dom.Document document) {
439:                TemplateGroup aTemplateGroup = new TemplateGroup();
440:                aTemplateGroup.readFromDocument(document);
441:                return aTemplateGroup;
442:            }
443:
444:            protected void readFromDocument(org.w3c.dom.Document document) {
445:                readNode(document.getDocumentElement());
446:            }
447:
448:            public void readNode(org.w3c.dom.Node node) {
449:                readNode(node, new java.util.HashMap());
450:            }
451:
452:            public void readNode(org.w3c.dom.Node node,
453:                    java.util.Map namespacePrefixes) {
454:                if (node.hasAttributes()) {
455:                    org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
456:                    org.w3c.dom.Attr attr;
457:                    java.lang.String attrValue;
458:                    boolean firstNamespaceDef = true;
459:                    for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
460:                        attr = (org.w3c.dom.Attr) attrs.item(attrNum);
461:                        String attrName = attr.getName();
462:                        if (attrName.startsWith("xmlns:")) {
463:                            if (firstNamespaceDef) {
464:                                firstNamespaceDef = false;
465:                                // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
466:                                namespacePrefixes = new java.util.HashMap(
467:                                        namespacePrefixes);
468:                            }
469:                            String attrNSPrefix = attrName.substring(6,
470:                                    attrName.length());
471:                            namespacePrefixes
472:                                    .put(attrNSPrefix, attr.getValue());
473:                        }
474:                    }
475:                    String xsiPrefix = "xsi";
476:                    for (java.util.Iterator it = namespacePrefixes.keySet()
477:                            .iterator(); it.hasNext();) {
478:                        String prefix = (String) it.next();
479:                        String ns = (String) namespacePrefixes.get(prefix);
480:                        if ("http://www.w3.org/2001/XMLSchema-instance"
481:                                .equals(ns)) {
482:                            xsiPrefix = prefix;
483:                            break;
484:                        }
485:                    }
486:                    attr = (org.w3c.dom.Attr) attrs.getNamedItem("" + xsiPrefix
487:                            + ":schemaLocation");
488:                    if (attr != null) {
489:                        attrValue = attr.getValue();
490:                        schemaLocation = attrValue;
491:                    }
492:                    readNodeAttributes(node, namespacePrefixes, attrs);
493:                }
494:                readNodeChildren(node, namespacePrefixes);
495:            }
496:
497:            protected void readNodeAttributes(org.w3c.dom.Node node,
498:                    java.util.Map namespacePrefixes,
499:                    org.w3c.dom.NamedNodeMap attrs) {
500:                org.w3c.dom.Attr attr;
501:                java.lang.String attrValue;
502:                attr = (org.w3c.dom.Attr) attrs.getNamedItem("namespace");
503:                if (attr != null) {
504:                    attrValue = attr.getValue();
505:                    _Namespace = attrValue;
506:                }
507:                attr = (org.w3c.dom.Attr) attrs.getNamedItem("prefix");
508:                if (attr != null) {
509:                    attrValue = attr.getValue();
510:                    _Prefix = attrValue;
511:                }
512:            }
513:
514:            protected void readNodeChildren(org.w3c.dom.Node node,
515:                    java.util.Map namespacePrefixes) {
516:                org.w3c.dom.NodeList children = node.getChildNodes();
517:                for (int i = 0, size = children.getLength(); i < size; ++i) {
518:                    org.w3c.dom.Node childNode = children.item(i);
519:                    String childNodeName = (childNode.getLocalName() == null ? childNode
520:                            .getNodeName().intern()
521:                            : childNode.getLocalName().intern());
522:                    String childNodeValue = "";
523:                    if (childNode.getFirstChild() != null) {
524:                        childNodeValue = childNode.getFirstChild()
525:                                .getNodeValue();
526:                    }
527:                    if (childNodeName == "template") {
528:                        TemplateType aTemplate = newTemplateType();
529:                        aTemplate.readNode(childNode, namespacePrefixes);
530:                        _Template.add(aTemplate);
531:                    } else {
532:                        // Found extra unrecognized childNode
533:                    }
534:                }
535:            }
536:
537:            /**
538:             * Takes some text to be printed into an XML stream and escapes any
539:             * characters that might make it invalid XML (like '<').
540:             */
541:            public static void writeXML(java.io.Writer out, String msg)
542:                    throws java.io.IOException {
543:                writeXML(out, msg, true);
544:            }
545:
546:            public static void writeXML(java.io.Writer out, String msg,
547:                    boolean attribute) throws java.io.IOException {
548:                if (msg == null)
549:                    return;
550:                int msgLength = msg.length();
551:                for (int i = 0; i < msgLength; ++i) {
552:                    char c = msg.charAt(i);
553:                    writeXML(out, c, attribute);
554:                }
555:            }
556:
557:            public static void writeXML(java.io.Writer out, char msg,
558:                    boolean attribute) throws java.io.IOException {
559:                if (msg == '&')
560:                    out.write("&amp;");
561:                else if (msg == '<')
562:                    out.write("&lt;");
563:                else if (msg == '>')
564:                    out.write("&gt;");
565:                else if (attribute) {
566:                    if (msg == '"')
567:                        out.write("&quot;");
568:                    else if (msg == '\'')
569:                        out.write("&apos;");
570:                    else if (msg == '\n')
571:                        out.write("&#xA;");
572:                    else if (msg == '\t')
573:                        out.write("&#x9;");
574:                    else
575:                        out.write(msg);
576:                } else
577:                    out.write(msg);
578:            }
579:
580:            public void changePropertyByName(String name, Object value) {
581:                if (name == null)
582:                    return;
583:                name = name.intern();
584:                if (name == "namespace")
585:                    setNamespace((java.lang.String) value);
586:                else if (name == "prefix")
587:                    setPrefix((java.lang.String) value);
588:                else if (name == "template")
589:                    addTemplate((TemplateType) value);
590:                else if (name == "template[]")
591:                    setTemplate((TemplateType[]) value);
592:                else
593:                    throw new IllegalArgumentException(name
594:                            + " is not a valid property name for TemplateGroup");
595:            }
596:
597:            public Object fetchPropertyByName(String name) {
598:                if (name == "namespace")
599:                    return getNamespace();
600:                if (name == "prefix")
601:                    return getPrefix();
602:                if (name == "template[]")
603:                    return getTemplate();
604:                throw new IllegalArgumentException(name
605:                        + " is not a valid property name for TemplateGroup");
606:            }
607:
608:            public String nameSelf() {
609:                return "/TemplateGroup";
610:            }
611:
612:            public String nameChild(Object childObj) {
613:                return nameChild(childObj, false, false);
614:            }
615:
616:            /**
617:             * @param childObj  The child object to search for
618:             * @param returnSchemaName  Whether or not the schema name should be returned or the property name
619:             * @return null if not found
620:             */
621:            public String nameChild(Object childObj, boolean returnConstName,
622:                    boolean returnSchemaName) {
623:                return nameChild(childObj, returnConstName, returnSchemaName,
624:                        false);
625:            }
626:
627:            /**
628:             * @param childObj  The child object to search for
629:             * @param returnSchemaName  Whether or not the schema name should be returned or the property name
630:             * @return null if not found
631:             */
632:            public String nameChild(Object childObj, boolean returnConstName,
633:                    boolean returnSchemaName, boolean returnXPathName) {
634:                if (childObj instanceof  java.lang.String) {
635:                    java.lang.String child = (java.lang.String) childObj;
636:                    if (child == _Namespace) {
637:                        if (returnConstName) {
638:                            return NAMESPACE;
639:                        } else if (returnSchemaName) {
640:                            return "namespace";
641:                        } else if (returnXPathName) {
642:                            return "@namespace";
643:                        } else {
644:                            return "Namespace";
645:                        }
646:                    }
647:                    if (child == _Prefix) {
648:                        if (returnConstName) {
649:                            return PREFIX;
650:                        } else if (returnSchemaName) {
651:                            return "prefix";
652:                        } else if (returnXPathName) {
653:                            return "@prefix";
654:                        } else {
655:                            return "Prefix";
656:                        }
657:                    }
658:                }
659:                if (childObj instanceof  TemplateType) {
660:                    TemplateType child = (TemplateType) childObj;
661:                    int index = 0;
662:                    for (java.util.Iterator it = _Template.iterator(); it
663:                            .hasNext();) {
664:                        org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType element = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it
665:                                .next();
666:                        if (child == element) {
667:                            if (returnConstName) {
668:                                return TEMPLATE;
669:                            } else if (returnSchemaName) {
670:                                return "template";
671:                            } else if (returnXPathName) {
672:                                return "template[position()=" + index + "]";
673:                            } else {
674:                                return "Template." + Integer.toHexString(index);
675:                            }
676:                        }
677:                        ++index;
678:                    }
679:                }
680:                return null;
681:            }
682:
683:            /**
684:             * Return an array of all of the properties that are beans and are set.
685:             */
686:            public java.lang.Object[] childBeans(boolean recursive) {
687:                java.util.List children = new java.util.LinkedList();
688:                childBeans(recursive, children);
689:                java.lang.Object[] result = new java.lang.Object[children
690:                        .size()];
691:                return (java.lang.Object[]) children.toArray(result);
692:            }
693:
694:            /**
695:             * Put all child beans into the beans list.
696:             */
697:            public void childBeans(boolean recursive, java.util.List beans) {
698:                for (java.util.Iterator it = _Template.iterator(); it.hasNext();) {
699:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType element = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it
700:                            .next();
701:                    if (element != null) {
702:                        if (recursive) {
703:                            element.childBeans(true, beans);
704:                        }
705:                        beans.add(element);
706:                    }
707:                }
708:            }
709:
710:            public boolean equals(Object o) {
711:                return o instanceof  org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup
712:                        && equals((org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup) o);
713:            }
714:
715:            public boolean equals(
716:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup inst) {
717:                if (inst == this ) {
718:                    return true;
719:                }
720:                if (inst == null) {
721:                    return false;
722:                }
723:                if (!(_Namespace == null ? inst._Namespace == null : _Namespace
724:                        .equals(inst._Namespace))) {
725:                    return false;
726:                }
727:                if (!(_Prefix == null ? inst._Prefix == null : _Prefix
728:                        .equals(inst._Prefix))) {
729:                    return false;
730:                }
731:                if (sizeTemplate() != inst.sizeTemplate())
732:                    return false;
733:                // Compare every element.
734:                for (java.util.Iterator it = _Template.iterator(), it2 = inst._Template
735:                        .iterator(); it.hasNext() && it2.hasNext();) {
736:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType element = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it
737:                            .next();
738:                    org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType element2 = (org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateType) it2
739:                            .next();
740:                    if (!(element == null ? element2 == null : element
741:                            .equals(element2))) {
742:                        return false;
743:                    }
744:                }
745:                return true;
746:            }
747:
748:            public int hashCode() {
749:                int result = 17;
750:                result = 37 * result
751:                        + (_Namespace == null ? 0 : _Namespace.hashCode());
752:                result = 37 * result
753:                        + (_Prefix == null ? 0 : _Prefix.hashCode());
754:                result = 37 * result
755:                        + (_Template == null ? 0 : _Template.hashCode());
756:                return result;
757:            }
758:
759:        }
760:
761:        /*
762:         The following schema file has been used for generation:
763:
764:         <?xml version="1.0" encoding="UTF-8"?>
765:
766:         <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
767:         targetNamespace="http://xml.netbeans.org/schema/templates"
768:         xmlns:tns="http://xml.netbeans.org/schema/templates"
769:         elementFormDefault="qualified">
770:         <xsd:element name="templateGroup">
771:         <xsd:complexType>
772:         <xsd:sequence>
773:         <xsd:element name="template" type="tns:templateType" maxOccurs="unbounded"/>
774:         </xsd:sequence>
775:         <xsd:attribute name="namespace" type="xsd:string"/>
776:         <xsd:attribute name="prefix" type="xsd:string"/>
777:         </xsd:complexType>
778:         </xsd:element>
779:         <xsd:complexType name="templateType">
780:         <xsd:sequence>
781:         <xsd:element name="wsdlElement" type="tns:wsdlElementType" maxOccurs="unbounded"/>
782:         </xsd:sequence>
783:         <xsd:attribute name="name" type="xsd:string"/>
784:         <xsd:attribute name="default" type="xsd:boolean"/>
785:         </xsd:complexType>
786:         <xsd:complexType name="wsdlElementType">
787:         <xsd:sequence>
788:         <xsd:element name="extensionElement" type="tns:extensionElementType" maxOccurs="unbounded"/>
789:         </xsd:sequence>
790:         <xsd:attribute name="name" type="xsd:string"/>
791:         </xsd:complexType>
792:         <xsd:complexType name="extensionElementType">
793:         <xsd:sequence>
794:         <xsd:element name="extensionAttr" type="tns:extensionAttrType" maxOccurs="unbounded"/>
795:         </xsd:sequence>
796:         <xsd:attribute name="name" type="xsd:string"/>
797:         </xsd:complexType>
798:         <xsd:complexType name="extensionAttrType">
799:         <xsd:attribute name="name" type="xsd:string"/>
800:         <xsd:attribute name="defaultValue" type="xsd:string"/>
801:         </xsd:complexType>
802:         </xsd:schema>
803:
804:
805:         */
w__w__w.__ja_va2_s__.__c___om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.