1 8 9 package org.uddi4j.util; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.w3c.dom.Element ; 16 import org.w3c.dom.NodeList ; 17 18 41 public class IdentifierBag extends UDDIElement { 42 public static final String UDDI_TAG = "identifierBag"; 43 44 protected Element base = null; 45 46 Vector keyedReference = new Vector (); 48 49 53 public IdentifierBag() { 54 } 55 56 66 public IdentifierBag(Element base) throws UDDIException { 67 super(base); 69 NodeList nl = null; 70 nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG); 71 for (int i=0; i < nl.getLength(); i++) { 72 keyedReference.addElement(new KeyedReference((Element)nl.item(i))); 73 } 74 } 75 76 81 public void setKeyedReferenceVector(Vector s) { 82 keyedReference = s; 83 } 84 85 90 public Vector getKeyedReferenceVector() { 91 return keyedReference; 92 } 93 94 99 public void add(KeyedReference kr) { 100 keyedReference.add(kr); 101 } 102 103 110 public boolean remove(KeyedReference kr) { 111 return keyedReference.remove(kr); 112 } 113 114 120 public KeyedReference get(int index) { 121 return (KeyedReference)keyedReference.get(index); 122 } 123 124 129 public int size() { 130 return keyedReference.size(); 131 } 132 133 134 143 public void saveToXML(Element parent) { 144 base = parent.getOwnerDocument().createElement(UDDI_TAG); 145 if (keyedReference!=null) { 147 for (int i=0; i < keyedReference.size(); i++) { 148 ((KeyedReference)(keyedReference.elementAt(i))).saveToXML(base); 149 } 150 } 151 parent.appendChild(base); 152 } 153 } 154 | Popular Tags |