1 16 package org.apache.wsdl.impl; 17 18 import org.apache.wsdl.WSDLInterface; 19 import org.apache.wsdl.WSDLOperation; 20 21 import javax.xml.namespace.QName ; 22 import java.util.HashMap ; 23 import java.util.Iterator ; 24 import java.util.LinkedList ; 25 import java.util.List ; 26 27 30 public class WSDLInterfaceImpl extends ExtensibleComponentImpl 31 implements WSDLInterface { 32 35 private QName name; 36 37 40 private HashMap superInterfaces = new HashMap (); 41 42 45 private List faults = new LinkedList (); 46 47 50 private HashMap operations = new HashMap (); 51 52 55 private String styleDefault; 56 57 62 public HashMap getDefinedOperations() { 63 return this.operations; 64 } 65 66 72 public HashMap getAllOperations() { 73 HashMap all = this.operations; 74 if (this.superInterfaces.size() == 0) { 75 return all; 76 } else { 77 Iterator superIterator = 78 this.superInterfaces.values().iterator(); 79 Iterator operationIterator; 80 WSDLInterface superInterface; 81 WSDLOperation superInterfaceOperation; 82 Iterator thisIterator = all.values().iterator(); 83 WSDLOperation thisOperation; 84 boolean tobeAdded = false; 85 while (superIterator.hasNext()) { 86 superInterface = (WSDLInterface) superIterator.next(); 87 operationIterator = 88 superInterface.getAllOperations().values().iterator(); 89 while (operationIterator.hasNext()) { 90 superInterfaceOperation = 91 (WSDLOperation) operationIterator.next(); 92 tobeAdded = true; 93 while (thisIterator.hasNext()) { 94 thisOperation = (WSDLOperation) thisIterator.next(); 95 if ((thisOperation.getName() == superInterfaceOperation.getName()) 96 && !tobeAdded) { 97 if (thisOperation.getTargetnamespace().equals( 98 superInterfaceOperation.getTargetnamespace())) { 99 100 tobeAdded = false; 103 } else { 104 105 throw new WSDLProcessingException( 108 "The Interface " + this.getName() 109 + " has more than one Operation that has the same name but not the same interface "); 110 } 111 } 112 } 113 if (tobeAdded) { 114 115 all.put(superInterfaceOperation.getName().getLocalPart(), 117 superInterfaceOperation); 118 } 119 } 120 } 121 return all; 122 } 123 } 124 125 128 public List getFaults() { 129 return faults; 130 } 131 132 135 public QName getName() { 136 return name; 137 } 138 139 142 public HashMap getOperations() { 143 return operations; 144 } 145 146 152 public WSDLOperation getOperation(String nCName) { 153 return (WSDLOperation)this.operations.get(nCName); 154 155 } 156 157 160 public HashMap getSuperInterfaces() { 161 return superInterfaces; 162 } 163 164 170 public WSDLInterface getSuperInterface(QName qName) { 171 return (WSDLInterface) this.superInterfaces.get(qName); 172 } 173 174 180 public String getTargetnamespace() { 181 if (null == this.name) { 182 return null; 183 } 184 return this.name.getNamespaceURI(); 185 } 186 187 190 public void setFaults(List list) { 191 faults = list; 192 } 193 194 197 public void setName(QName qName) { 198 name = qName; 199 } 200 201 204 public void setOperations(HashMap list) { 205 operations = list; 206 } 207 208 215 public void setOperation(WSDLOperation operation) { 216 if (null == operation) { 217 return; 218 } 219 if (null == operation.getName()) { 220 throw new WSDLProcessingException( 221 "The Operation name cannot be null (required)"); 222 } 223 this.operations.put(operation.getName().getLocalPart(), operation); 224 } 225 226 229 public void setSuperInterfaces(HashMap list) { 230 superInterfaces = list; 231 } 232 233 239 public void addSuperInterface(WSDLInterface interfaceComponent) { 240 this.superInterfaces.put(interfaceComponent.getName(), 241 interfaceComponent); 242 } 243 244 249 public String getStyleDefault() { 250 return styleDefault; 251 } 252 253 258 public void setStyleDefault(String styleDefault) { 259 this.styleDefault = styleDefault; 260 } 261 } 262 | Popular Tags |