1 16 package org.apache.axis2.saaj; 17 18 import org.apache.axis2.om.OMAbstractFactory; 19 import org.apache.axis2.om.OMFactory; 20 import org.apache.axis2.om.OMNamespace; 21 22 import javax.xml.soap.Name ; 23 import javax.xml.soap.SOAPException ; 24 import javax.xml.soap.SOAPHeader ; 25 import javax.xml.soap.SOAPHeaderElement ; 26 import java.util.ArrayList ; 27 import java.util.Iterator ; 28 29 35 public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader { 36 37 40 private org.apache.axis2.soap.SOAPHeader omHeader; 41 42 46 public SOAPHeaderImpl(org.apache.axis2.soap.SOAPHeader header){ 47 super(header); 48 this.omHeader = header; 49 } 50 51 59 public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException { 60 String localName = name.getLocalName(); 63 OMFactory omFactory = OMAbstractFactory.getOMFactory(); 64 OMNamespace ns = omFactory.createOMNamespace(name.getURI(), name.getPrefix()); 65 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = omHeader.addHeaderBlock(localName, ns); 66 return (new SOAPHeaderElementImpl(headerBlock)); 67 } 68 69 76 public Iterator examineHeaderElements(String actor) { 77 Iterator headerElementsIter = omHeader.examineHeaderBlocks(actor); 80 ArrayList aList = new ArrayList (); 81 while(headerElementsIter.hasNext()){ 82 Object o = headerElementsIter.next(); 83 if(o instanceof org.apache.axis2.soap.SOAPHeaderBlock){ 84 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock)o; 85 SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 86 aList.add(element); 87 } 88 } 89 return aList.iterator(); 90 } 91 92 99 public Iterator extractHeaderElements(String actor) { 100 Iterator headerElementsIter = omHeader.extractHeaderBlocks(actor); 103 ArrayList aList = new ArrayList (); 104 while(headerElementsIter.hasNext()){ 105 Object o = headerElementsIter.next(); 106 if(o instanceof org.apache.axis2.soap.SOAPHeaderBlock){ 107 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock)o; 108 SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 109 aList.add(element); 110 } 111 } 112 return aList.iterator(); 113 } 114 115 122 public Iterator examineMustUnderstandHeaderElements(String actor) { 123 Iterator headerElementsIter = omHeader.examineMustUnderstandHeaderBlocks(actor); 126 ArrayList aList = new ArrayList (); 127 while(headerElementsIter.hasNext()){ 128 Object o = headerElementsIter.next(); 129 if(o instanceof org.apache.axis2.soap.SOAPHeaderBlock){ 130 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock)o; 131 SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 132 aList.add(element); 133 } 134 } 135 return aList.iterator(); 136 } 137 138 144 public Iterator examineAllHeaderElements() { 145 Iterator headerElementsIter = omHeader.examineAllHeaderBlocks(); 148 ArrayList aList = new ArrayList (); 149 while(headerElementsIter.hasNext()){ 150 Object o = headerElementsIter.next(); 151 if(o instanceof org.apache.axis2.soap.SOAPHeaderBlock){ 152 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock)o; 153 SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 154 aList.add(element); 155 } 156 } 157 return aList.iterator(); 158 } 159 160 166 public Iterator extractAllHeaderElements() { 167 Iterator headerElementsIter = omHeader.extractAllHeaderBlocks(); 170 ArrayList aList = new ArrayList (); 171 while(headerElementsIter.hasNext()){ 172 Object o = headerElementsIter.next(); 173 if(o instanceof org.apache.axis2.soap.SOAPHeaderBlock){ 174 org.apache.axis2.soap.SOAPHeaderBlock headerBlock = (org.apache.axis2.soap.SOAPHeaderBlock)o; 175 SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 176 aList.add(element); 177 } 178 } 179 return aList.iterator(); 180 } 181 182 189 190 } 191 | Popular Tags |