KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > datatype > binding > AccessPoint


1 /*
2  * The source code contained herein is licensed under the IBM Public License
3  * Version 1.0, which has been approved by the Open Source Initiative.
4  * Copyright (C) 2001, International Business Machines Corporation
5  * All Rights Reserved.
6  *
7  */

8
9 package org.uddi4j.datatype.binding;
10
11 import org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.w3c.dom.Element JavaDoc;
14
15 /**
16  * Represents the accessPoint element within the UDDI version 2.0 schema.
17  * This class contains the following types of methods:
18  *
19  * <ul>
20  * <li>Constructor passing required fields.
21  * <li>Constructor that will instantiate the object from an appropriate XML
22  * DOM element.
23  * <li>Get/set methods for each attribute that this element can contain.
24  * <li>A get/setVector method is provided for sets of attributes.
25  * <li>SaveToXML method. Serializes this class within a passed in element. *
26  * </ul>
27  *
28  * Typically this class is used to construct parameters for, or interpret
29  * responses from, methods in the UDDIProxy class.
30  *
31  * <p><b>Element description:</b>
32  * <p>Data: present when a service is directly accessible at a particular
33  * address (e.g., URL, etc). Mutually exclusive with hostingRedirector.
34  *
35  * @author David Melgar (dmelgar@us.ibm.com)
36  */

37 public class AccessPoint extends UDDIElement {
38    public static final String JavaDoc UDDI_TAG = "accessPoint";
39
40    protected Element base = null;
41
42    String JavaDoc text = null;
43    String JavaDoc URLType = null;
44
45    /**
46     * Default constructor.
47     * Avoid using the default constructor for validation. It does not validate
48     * required fields. Instead, use the required fields constructor to perform
49     * validation.
50     */

51    public AccessPoint() {
52    }
53
54    /**
55     * Construct the object using the required fields.
56     *
57     * @param value String value
58     * @param URLType String
59     */

60    public AccessPoint(String JavaDoc value,
61       String JavaDoc URLType) {
62       setText(value);
63       this.URLType = URLType;
64    }
65
66    /**
67     * Construct the object from a DOM tree. Used by
68     * UDDIProxy to construct an object from a received UDDI
69     * message.
70     *
71     * @param base Element with name appropriate for this class.
72     *
73     * @exception UDDIException Thrown if DOM tree contains a SOAP fault or
74     * disposition report indicating a UDDI error.
75     */

76    public AccessPoint(Element base) throws UDDIException {
77       // Checks for a fault. Throws exception if it is a fault. super(base);
78
text = getText(base);
79       URLType = base.getAttribute("URLType");
80    }
81
82    public void setText(String JavaDoc s) {
83       text = s;
84    }
85
86    public void setURLType(String JavaDoc s) {
87       URLType = s;
88    }
89
90    public String JavaDoc getText() {
91       return text;
92    }
93
94    public String JavaDoc getURLType() {
95       return URLType;
96    }
97
98
99    /**
100     * Save object to DOM tree. Used to serialize object
101     * to a DOM tree, usually to send a UDDI message.
102     *
103     * <BR>Used by UDDIProxy.
104     *
105     * @param parent Object will serialize as a child element under the
106     * passed in parent element.
107     */

108    public void saveToXML(Element parent) {
109       base = parent.getOwnerDocument().createElement(UDDI_TAG);
110       // Save attributes
111
if (text!=null) {
112          base.appendChild(parent.getOwnerDocument().createTextNode(text));
113       }
114       if (URLType!=null) {
115          base.setAttribute("URLType", URLType);
116       }
117       parent.appendChild(base);
118    }
119 }
120
Popular Tags