KickJava   Java API By Example, From Geeks To Geeks.

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


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 instanceParms 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  * <p>This is a URL pointing to the settings, or settings file, needed to invoke
33  * a registered service (for getting fixed parm values prior to call).
34  *
35  * @author David Melgar (dmelgar@us.ibm.com)
36  */

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

50    public InstanceParms() {
51    }
52
53    /**
54     * Construct the object with required fields.
55     *
56     * @param value String value
57     */

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

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

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