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-2006 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: package org.netbeans.modules.websvc.registry.jaxrpc;
043:
044: public class WsdlType {
045: private java.net.URL location;
046: private java.lang.String packageName;
047:
048: /**
049: * Normal starting point constructor.
050: */
051: public WsdlType() {
052: packageName = "";
053: }
054:
055: /**
056: * Required parameters constructor
057: */
058: public WsdlType(java.net.URL location, java.lang.String packageName) {
059: location = location;
060: packageName = packageName;
061: }
062:
063: public void setLocation(java.net.URL value) {
064: location = value;
065: }
066:
067: public java.net.URL getLocation() {
068: return location;
069: }
070:
071: public void setPackageName(java.lang.String value) {
072: packageName = value;
073: }
074:
075: public java.lang.String getPackageName() {
076: return packageName;
077: }
078:
079: public void writeNode(java.io.Writer out, String nodeName,
080: String indent) throws java.io.IOException {
081: out.write(indent);
082: out.write("<");
083: out.write(nodeName);
084: // location is an attribute
085: if (location != null) {
086: out.write(" location"); // NOI18N
087: out.write("='"); // NOI18N
088: Configuration.writeXML(out, location.toString(), true);
089: out.write("'"); // NOI18N
090: }
091: // packageName is an attribute
092: if (packageName != null && packageName.length() > 0) {
093: out.write(" packageName"); // NOI18N
094: out.write("='"); // NOI18N
095: Configuration.writeXML(out, packageName, true);
096: out.write("'"); // NOI18N
097: }
098: out.write(">\n");
099: String nextIndent = indent + " ";
100: out.write(indent);
101: out.write("</" + nodeName + ">\n");
102: }
103:
104: public void readNode(org.w3c.dom.Node node) {
105: if (node.hasAttributes()) {
106: org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
107: org.w3c.dom.Attr attr;
108: java.lang.String attrValue;
109: attr = (org.w3c.dom.Attr) attrs.getNamedItem("location");
110: try {
111: if (attr != null) {
112: attrValue = attr.getValue();
113: } else {
114: attrValue = null;
115: }
116: location = new java.net.URL(attrValue);
117: } catch (java.net.MalformedURLException e) {
118: throw new java.lang.RuntimeException(e);
119: }
120: attr = (org.w3c.dom.Attr) attrs.getNamedItem("packageName");
121: if (attr != null) {
122: attrValue = attr.getValue();
123: } else {
124: attrValue = null;
125: }
126: packageName = attrValue;
127: }
128: org.w3c.dom.NodeList children = node.getChildNodes();
129: for (int i = 0, size = children.getLength(); i < size; ++i) {
130: org.w3c.dom.Node childNode = children.item(i);
131: String childNodeName = (childNode.getLocalName() == null ? childNode
132: .getNodeName().intern()
133: : childNode.getLocalName().intern());
134: String childNodeValue = "";
135: if (childNode.getFirstChild() != null) {
136: childNodeValue = childNode.getFirstChild()
137: .getNodeValue();
138: } else {
139: // Found extra unrecognized childNode
140: }
141: }
142: }
143: }
|