KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > util > AuthInfo


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.util;
10
11 import org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.w3c.dom.Element JavaDoc;
14
15 /**
16  * Represents the authInfo element within the UDDI version 2.0 schema.
17  * This class contains the following types of methods:
18  *
19  * <ul>
20  * <li>A constructor that passes the required fields.
21  * <li>A 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>A SaveToXML method that serializes this class within a passed in
26  * element.
27  * </ul>
28  *
29  * Typically, this class is used to construct parameters for, or interpret
30  * responses from, methods in the UDDIProxy class.
31  *
32  * <p><b>Element description:</b>
33  * <p>This structure is used in all messages that update data on
34  * behalf of a user initiated request.
35  *
36  * @author David Melgar (dmelgar@us.ibm.com)
37  */

38 public class AuthInfo extends UDDIElement {
39    public static final String JavaDoc UDDI_TAG = "authInfo";
40
41    protected Element base = null;
42
43    String JavaDoc text = 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 AuthInfo() {
52    }
53
54    /**
55     * Construct the object with required fields.
56     *
57     * @param value String value
58     */

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

73    public AuthInfo(Element base) throws UDDIException {
74       // Check if it is a fault. Throws an exception if it is.
75
super(base);
76       text = getText(base);
77    }
78
79    public void setText(String JavaDoc s) {
80       text = s;
81    }
82
83    public String JavaDoc getText() {
84       return text;
85    }
86
87    /**
88     * Save an object to the DOM tree. Used to serialize an object
89     * to a DOM tree, usually to send a UDDI message.
90     *
91     * <BR>Used by UDDIProxy.
92     *
93     * @param parent Object will serialize as a child element under the
94     * passed in parent element.
95     */

96    public void saveToXML(Element parent) {
97       base = parent.getOwnerDocument().createElement(UDDI_TAG);
98       // Save attributes.
99
if (text!=null) {
100          base.appendChild(parent.getOwnerDocument().createTextNode(text));
101       }
102       parent.appendChild(base);
103    }
104 }
105
Popular Tags