1 8 9 package org.uddi4j.request; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.uddi4j.datatype.binding.BindingTemplate; 16 import org.uddi4j.util.AuthInfo; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 44 public class SaveBinding extends UDDIElement 45 { 46 public static final String UDDI_TAG = "save_binding"; 47 48 protected Element base = null; 49 50 AuthInfo authInfo = null; 51 Vector bindingTemplate = new Vector (); 53 54 60 public SaveBinding() 61 { 62 } 63 64 70 public SaveBinding(String authInfo, Vector bindingTemplate) 71 { 72 this.authInfo = new AuthInfo(authInfo); 73 this.bindingTemplate = bindingTemplate; 74 } 75 76 86 public SaveBinding(Element base) throws UDDIException 87 { 88 super(base); 90 NodeList nl = null; 91 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 92 if (nl.getLength() > 0) 93 { 94 authInfo = new AuthInfo((Element)nl.item(0)); 95 } 96 nl = getChildElementsByTagName(base, BindingTemplate.UDDI_TAG); 97 for (int i = 0; i < nl.getLength(); i++) 98 { 99 bindingTemplate.addElement(new BindingTemplate((Element)nl.item(i))); 100 } 101 } 102 103 public void setAuthInfo(AuthInfo s) 104 { 105 authInfo = s; 106 } 107 public void setAuthInfo(String s) 108 { 109 authInfo = new AuthInfo(); 110 authInfo.setText(s); 111 } 112 113 118 public void setBindingTemplateVector(Vector s) 119 { 120 bindingTemplate = s; 121 } 122 123 public AuthInfo getAuthInfo() 124 { 125 return authInfo; 126 } 127 128 public String getAuthInfoString() 129 { 130 if (authInfo != null) 131 return authInfo.getText(); 132 else 133 return null; 134 } 135 136 141 public Vector getBindingTemplateVector() 142 { 143 return bindingTemplate; 144 } 145 146 155 public void saveToXML(Element parent) 156 { 157 base = parent.getOwnerDocument().createElement(UDDI_TAG); 158 base.setAttribute("generic", UDDIElement.GENERIC); 160 base.setAttribute("xmlns", UDDIElement.XMLNS); 161 if (authInfo != null) 162 { 163 authInfo.saveToXML(base); 164 } 165 if (bindingTemplate != null) 166 { 167 for (int i = 0; i < bindingTemplate.size(); i++) 168 { 169 ((BindingTemplate) (bindingTemplate.elementAt(i))).saveToXML(base); 170 } 171 } 172 parent.appendChild(base); 173 } 174 } 175 | Popular Tags |