1 8 9 package org.uddi4j.response; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.AuthInfo; 14 import org.w3c.dom.Element ; 15 import org.w3c.dom.NodeList ; 16 17 41 public class AuthToken extends UDDIElement { 42 public static final String UDDI_TAG = "authToken"; 43 44 protected Element base = null; 45 46 String operator = null; 47 AuthInfo authInfo = null; 48 49 55 56 public AuthToken() { 57 } 58 59 65 public AuthToken(String operator, 66 String authInfo) { 67 this.operator = operator; 68 this.authInfo = new AuthInfo( authInfo ); 69 } 70 71 81 82 public AuthToken(Element base) throws UDDIException { 83 super(base); 85 operator = base.getAttribute("operator"); 86 NodeList nl = null; 87 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 88 if (nl.getLength() > 0) { 89 authInfo = new AuthInfo((Element)nl.item(0)); 90 } 91 } 92 93 public void setOperator(String s) { 94 operator = s; 95 } 96 97 public void setAuthInfo(AuthInfo s) { 98 authInfo = s; 99 } 100 public void setAuthInfo(String s) { 101 authInfo = new AuthInfo(); 102 authInfo.setText(s); 103 } 104 105 public String getOperator() { 106 return operator; 107 } 108 109 110 public AuthInfo getAuthInfo() { 111 return authInfo; 112 } 113 114 public String getAuthInfoString() { 115 if(authInfo!=null) 116 return authInfo.getText(); 117 else 118 return null; 119 } 120 121 130 131 public void saveToXML(Element parent) { 132 base = parent.getOwnerDocument().createElement(UDDI_TAG); 133 base.setAttribute("generic", UDDIElement.GENERIC); 135 base.setAttribute("xmlns", UDDIElement.XMLNS); 136 if (operator!=null) { 137 base.setAttribute("operator", operator); 138 } 139 if (authInfo!=null) { 140 authInfo.saveToXML(base); 141 } 142 parent.appendChild(base); 143 } 144 } 145 | Popular Tags |