KickJava   Java API By Example, From Geeks To Geeks.

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


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 hostingRedirector 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  *
33  * <p>Data: present only when the service is provisioned via remote hosting,
34  * load balancing, etc. Mutually exclusive with accessPoint.
35  *
36  * @author David Melgar (dmelgar@us.ibm.com)
37  */

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

59    public HostingRedirector(String JavaDoc bindingKey) {
60       this.bindingKey = bindingKey;
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 name appropriate for this class.
69     *
70     * @exception UDDIException Thrown if DOM tree contains a SOAP fault or
71     * disposition report indicating a UDDI error.
72     */

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

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