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.util.AuthInfo; 16 import org.uddi4j.util.ServiceKey; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 44 public class DeleteService extends UDDIElement { 45 public static final String UDDI_TAG = "delete_service"; 46 47 protected Element base = null; 48 49 AuthInfo authInfo = null; 50 Vector serviceKey = new Vector (); 52 53 59 public DeleteService() { 60 } 61 62 68 public DeleteService(String authInfo, 69 Vector serviceKeyStrings) { 70 this.authInfo = new AuthInfo( authInfo ); 71 Vector objects; 72 objects = new Vector (); 73 for (int i = 0; i < serviceKeyStrings.size(); i++) { 74 objects.addElement( new ServiceKey((String )serviceKeyStrings.elementAt(i)) ); 75 } 76 77 this.serviceKey = objects; 78 } 79 80 90 public DeleteService(Element base) throws UDDIException { 91 super(base); 93 NodeList nl = null; 94 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 95 if (nl.getLength() > 0) { 96 authInfo = new AuthInfo((Element)nl.item(0)); 97 } 98 nl = getChildElementsByTagName(base, ServiceKey.UDDI_TAG); 99 for (int i=0; i < nl.getLength(); i++) { 100 serviceKey.addElement(new ServiceKey((Element)nl.item(i))); 101 } 102 } 103 104 public void setAuthInfo(AuthInfo s) { 105 authInfo = s; 106 } 107 public void setAuthInfo(String s) { 108 authInfo = new AuthInfo(); 109 authInfo.setText(s); 110 } 111 112 117 public void setServiceKeyVector(Vector s) { 118 serviceKey = s; 119 } 120 121 126 public void setServiceKeyStrings(Vector s) { 127 serviceKey = new Vector (); 128 for (int i = 0; i < s.size(); i++) { 129 serviceKey.addElement( new ServiceKey((String )s.elementAt(i)) ); 130 } 131 } 132 133 public AuthInfo getAuthInfo() { 134 return authInfo; 135 } 136 137 public String getAuthInfoString() { 138 if(authInfo!=null) 139 return authInfo.getText(); 140 else 141 return null; 142 } 143 144 149 public Vector getServiceKeyVector() { 150 return serviceKey; 151 } 152 153 158 public Vector getServiceKeyStrings() { 159 Vector strings = new Vector (); 160 for (int i = 0; i < serviceKey.size(); i++) { 161 strings.addElement( ((ServiceKey)serviceKey.elementAt(i)).getText()); 162 } 163 return strings; 164 } 165 166 175 public void saveToXML(Element parent) { 176 base = parent.getOwnerDocument().createElement(UDDI_TAG); 177 base.setAttribute("generic", UDDIElement.GENERIC); 179 base.setAttribute("xmlns", UDDIElement.XMLNS); 180 if (authInfo!=null) { 181 authInfo.saveToXML(base); 182 } 183 if (serviceKey!=null) { 184 for (int i=0; i < serviceKey.size(); i++) { 185 ((ServiceKey)(serviceKey.elementAt(i))).saveToXML(base); 186 } 187 } 188 parent.appendChild(base); 189 } 190 } 191 | Popular Tags |