KickJava   Java API By Example, From Geeks To Geeks.

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


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 bindingKey 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  * @author David Melgar (dmelgar@us.ibm.com)
33  */

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

47    public BindingKey() {
48    }
49
50    /**
51     * Construct the object with required fields.
52     *
53     * @param value String value
54     */

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

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

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