KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > registry > jaxrpc > WsdlType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.registry.jaxrpc;
21
22
23 public class WsdlType {
24     private java.net.URL JavaDoc location;
25     private java.lang.String JavaDoc packageName;
26
27     /**
28      * Normal starting point constructor.
29      */

30     public WsdlType() {
31         packageName = "";
32     }
33
34     /**
35      * Required parameters constructor
36      */

37     public WsdlType(java.net.URL JavaDoc location, java.lang.String JavaDoc packageName) {
38         location = location;
39         packageName = packageName;
40     }
41
42
43     public void setLocation(java.net.URL JavaDoc value) {
44         location = value;
45     }
46     
47     public java.net.URL JavaDoc getLocation() {
48         return location;
49     }
50     
51     public void setPackageName(java.lang.String JavaDoc value) {
52         packageName = value;
53     }
54     
55     public java.lang.String JavaDoc getPackageName() {
56         return packageName;
57     }
58     
59     
60     
61     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
62         out.write(indent);
63         out.write("<");
64         out.write(nodeName);
65         // location is an attribute
66
if (location != null) {
67             out.write(" location"); // NOI18N
68
out.write("='"); // NOI18N
69
Configuration.writeXML(out, location.toString(), true);
70             out.write("'"); // NOI18N
71
}
72         // packageName is an attribute
73
if (packageName != null && packageName.length() > 0) {
74             out.write(" packageName"); // NOI18N
75
out.write("='"); // NOI18N
76
Configuration.writeXML(out, packageName, true);
77             out.write("'"); // NOI18N
78
}
79         out.write(">\n");
80         String JavaDoc nextIndent = indent + " ";
81         out.write(indent);
82         out.write("</"+nodeName+">\n");
83     }
84     
85     public void readNode(org.w3c.dom.Node JavaDoc node) {
86         if (node.hasAttributes()) {
87             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
88             org.w3c.dom.Attr JavaDoc attr;
89             java.lang.String JavaDoc attrValue;
90             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("location");
91             try {
92                 if (attr != null) {
93                     attrValue = attr.getValue();
94                 } else {
95                     attrValue = null;
96                 }
97                 location = new java.net.URL JavaDoc(attrValue);
98             }
99             catch (java.net.MalformedURLException JavaDoc e) {
100                 throw new java.lang.RuntimeException JavaDoc(e);
101             }
102             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("packageName");
103             if (attr != null) {
104                 attrValue = attr.getValue();
105             } else {
106                 attrValue = null;
107             }
108             packageName = attrValue;
109         }
110         org.w3c.dom.NodeList JavaDoc children = node.getChildNodes();
111         for (int i = 0, size = children.getLength(); i < size; ++i) {
112             org.w3c.dom.Node JavaDoc childNode = children.item(i);
113             String JavaDoc childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
114             String JavaDoc childNodeValue = "";
115             if (childNode.getFirstChild() != null) {
116                 childNodeValue = childNode.getFirstChild().getNodeValue();
117             }
118             else {
119                 // Found extra unrecognized childNode
120
}
121         }
122     }
123 }
124
125
126
Popular Tags