KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > request > GetRegisteredInfo


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.request;
10
11 import org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.uddi4j.util.AuthInfo;
14 import org.w3c.dom.Element JavaDoc;
15 import org.w3c.dom.NodeList JavaDoc;
16
17 /**
18  * Represents the get_registeredInfo element within the UDDI version 2.0 schema.
19  * This class contains the following types of methods:
20  *
21  * <ul>
22  * <li>A constructor that passes the required fields.
23  * <li>A Constructor that will instantiate the object from an appropriate XML
24  * DOM element.
25  * <li>Get/set methods for each attribute that this element can contain.
26  * <li>A get/setVector method is provided for sets of attributes.
27  * <li>A SaveToXML method that serializes this class within a passed in
28  * element.
29  * </ul>
30  *
31  * Typically, this class is used to construct parameters for, or interpret
32  * responses from, methods in the UDDIProxy class.
33  *
34  * <p><b>Element description:</b>
35  * <p>This message is used to support tool resynch by allowing a
36  * query to acquire summarized information about registered businessEntity
37  * and tModels for a given userID. This API is intended to let
38  * publishers describe what they have published. Authentication
39  * is required for publishers. The response is a registeredInfo message.
40  *
41  * @author David Melgar (dmelgar@us.ibm.com)
42  * @author Ozzy (ozzy@hursley.ibm.com)
43  */

44 public class GetRegisteredInfo extends UDDIElement {
45    public static final String JavaDoc UDDI_TAG = "get_registeredInfo";
46
47    protected Element base = null;
48
49    AuthInfo authInfo = null;
50
51    /**
52     * Default constructor.
53     * Avoid using the default constructor for validation. It does not validate
54     * required fields. Instead, use the required fields constructor to perform
55     * validation.
56     */

57    public GetRegisteredInfo() {
58    }
59
60    /**
61     * Construct the object with required fields.
62     *
63     * @param authInfo String
64     */

65    public GetRegisteredInfo(String JavaDoc authInfo) {
66       this.authInfo = new AuthInfo( authInfo );
67    }
68
69    /**
70     * Construct the object from a DOM tree. Used by
71     * UDDIProxy to construct an object from a received UDDI
72     * message.
73     *
74     * @param base Element with the name appropriate for this class.
75     *
76     * @exception UDDIException Thrown if DOM tree contains a SOAP fault
77     * or a disposition report indicating a UDDI error.
78     */

79    public GetRegisteredInfo(Element base) throws UDDIException {
80       // Check if it is a fault. Throws an exception if it is.
81
super(base);
82       NodeList JavaDoc nl = null;
83       nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG);
84       if (nl.getLength() > 0) {
85          authInfo = new AuthInfo((Element)nl.item(0));
86       }
87    }
88
89    public void setAuthInfo(AuthInfo s) {
90       authInfo = s;
91    }
92    public void setAuthInfo(String JavaDoc s) {
93       authInfo = new AuthInfo();
94       authInfo.setText(s);
95    }
96
97    public AuthInfo getAuthInfo() {
98       return authInfo;
99    }
100
101    public String JavaDoc getAuthInfoString() {
102       if(authInfo!=null)
103         return authInfo.getText();
104       else
105         return null;
106    }
107
108    /**
109     * Save an object to the DOM tree. Used to serialize an object
110     * to a DOM tree, usually to send a UDDI message.
111     *
112     * <BR>Used by UDDIProxy.
113     *
114     * @param parent Object will serialize as a child element under the
115     * passed in parent element.
116     */

117    public void saveToXML(Element parent) {
118       base = parent.getOwnerDocument().createElement(UDDI_TAG);
119       // Save attributes.
120
base.setAttribute("generic", UDDIElement.GENERIC);
121       base.setAttribute("xmlns", UDDIElement.XMLNS);
122       if (authInfo!=null) {
123          authInfo.saveToXML(base);
124       }
125       parent.appendChild(base);
126    }
127 }
128
Popular Tags