KickJava   Java API By Example, From Geeks To Geeks.

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


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, Hewlett-Packard Company
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_publisherAssertions 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 API call is used to obtain the full set of publisher assertions that is
36  * associated with an individual publisher account.
37  *
38  * @author Mahesh C S (csmahesh@india.hp.com)
39  * @author Ozzy (ozzy@hursley.ibm.com)
40  */

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

55    public GetPublisherAssertions() {
56    }
57
58    /**
59     * Construct the object from a DOM tree. Used by
60     * UDDIProxy to construct an object from a received UDDI
61     * message.
62     *
63     * @param base Element with the name appropriate for this class.
64     *
65     * @exception UDDIException Thrown if DOM tree contains a SOAP fault
66     * or a disposition report indicating a UDDI error.
67     */

68    public GetPublisherAssertions(Element base) throws UDDIException {
69        // Check if it is a fault. Throws an exception if it is.
70
super(base);
71        NodeList JavaDoc nl = null;
72        nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG);
73        if (nl.getLength() > 0) {
74           authInfo = new AuthInfo((Element)nl.item(0));
75        }
76    }
77
78    /**
79     * Construct the object with required fields.
80     *
81     * @param authInfo String
82     */

83    public GetPublisherAssertions(String JavaDoc authInfo) {
84        this.authInfo = new AuthInfo(authInfo);
85    }
86
87    public AuthInfo getAuthInfo() {
88        return authInfo;
89    }
90
91    public void setAuthInfo(AuthInfo s) {
92        authInfo = s;
93    }
94
95    public String JavaDoc getAuthInfoString() {
96        if(authInfo!=null)
97          return authInfo.getText();
98        else
99          return null;
100    }
101
102    public void setAuthInfo(String JavaDoc s) {
103        authInfo = new AuthInfo();
104        authInfo.setText(s);
105    }
106
107    /**
108     * Save an object to the DOM tree. Used to serialize an object
109     * to a DOM tree, usually to send a UDDI message.
110     *
111     * <BR>Used by UDDIProxy.
112     *
113     * @param parent Object will serialize as a child element under the
114     * passed in parent element.
115     */

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