1 16 package org.apache.wsdl.impl; 17 18 import org.apache.wsdl.*; 19 import org.apache.wsdl.extensions.ExtensionFactory; 20 import org.apache.wsdl.extensions.impl.ExtensionFactoryImpl; 21 22 import javax.xml.namespace.QName ; 23 import java.util.ArrayList ; 24 import java.util.HashMap ; 25 import java.util.Iterator ; 26 import java.util.Map ; 27 28 31 public class WSDLDescriptionImpl extends ComponentImpl 32 implements WSDLDescription { 33 36 private QName wsdl1DefinitionName; 37 38 42 45 private String targetNameSpace; 46 47 50 53 private WSDLTypes types; 54 55 58 private Map wsdlInterfaces = new HashMap (); 59 60 63 private Map bindings = new HashMap (); 64 65 69 private Map services = new HashMap (); 70 71 74 private ArrayList imports = new ArrayList (); 75 76 79 private ArrayList includes = new ArrayList (); 80 81 85 private Map namespaces = new HashMap (); 86 87 93 public Map getBindings() { 94 return bindings; 95 } 96 97 102 public void setBindings(Map bindings) { 103 104 this.bindings = bindings; 107 } 108 109 117 public void addBinding(WSDLBinding binding) { 118 if (null == binding) { 119 return; 120 } 121 if (null == binding.getName()) { 122 throw new WSDLProcessingException( 123 "The WSDLBinding name cannot be null(Required)"); 124 } 125 this.bindings.put(binding.getName(), binding); 126 } 127 128 135 public WSDLBinding getBinding(QName qName) { 136 return (WSDLBinding) this.bindings.get(qName); 137 } 138 139 146 public void addInterface(WSDLInterface interfaceComponent) { 147 if (null == interfaceComponent) { 148 return; 149 } 150 if (null == interfaceComponent.getName()) { 151 throw new WSDLProcessingException( 152 "PortType/Interface name cannot be null(Required) "); 153 } 154 this.wsdlInterfaces.put(interfaceComponent.getName(), 155 interfaceComponent); 156 } 157 158 165 public WSDLInterface getInterface(QName qName) { 166 return (WSDLInterface) this.wsdlInterfaces.get(qName); 167 } 168 169 174 public Map getServices() { 175 return services; 176 } 177 178 183 public void setServices(Map services) { 184 this.services = services; 185 } 186 187 193 public WSDLService getService(QName qName) { 194 return (WSDLService) this.services.get(qName); 195 } 196 197 205 public void addService(WSDLService service) { 206 if (null == service) { 207 return; 208 } 209 if (null == service.getName()) { 210 throw new WSDLProcessingException( 211 "The WSDLService name cannot be null (Required)"); 212 } 213 this.services.put(service.getName(), service); 214 } 215 216 221 public String getTargetNameSpace() { 222 return targetNameSpace; 223 } 224 225 230 public void setTargetNameSpace(String targetNameSpace) { 231 this.targetNameSpace = targetNameSpace; 232 } 233 234 239 public Map getWsdlInterfaces() { 240 return wsdlInterfaces; 241 } 242 243 248 public void setWsdlInterfaces(Map wsdlInterfaces) { 249 this.wsdlInterfaces = wsdlInterfaces; 250 } 251 252 257 public WSDLTypes getTypes() { 258 return types; 259 } 260 261 266 public void setTypes(WSDLTypes types) { 267 this.types = types; 268 } 269 270 275 public QName getWSDL1DefinitionName() { 276 return wsdl1DefinitionName; 277 } 278 279 284 public void setWSDL1DefinitionName(QName wsdl1DefinitionName) { 285 this.wsdl1DefinitionName = wsdl1DefinitionName; 286 } 287 288 294 public Map getNamespaces() { 295 return namespaces; 296 } 297 298 304 public void setNamespaces(Map namespaces) { 305 this.namespaces = namespaces; 306 } 307 308 316 public String getNamespace(String prefix) { 317 if (null == prefix) { 318 return null; 319 } 320 return (String ) this.namespaces.get(prefix); 321 } 322 323 328 public ArrayList getImports() { 329 return imports; 330 } 331 332 337 public void setImports(ArrayList imports) { 338 this.imports = imports; 339 } 340 341 346 public void addImports(WSDLImport wsdlImport) { 347 this.imports.add(wsdlImport); 348 } 349 350 355 public ArrayList getIncludes() { 356 return includes; 357 } 358 359 364 public void setIncludes(ArrayList includes) { 365 this.includes = includes; 366 } 367 368 373 public void addInclude(WSDLInclude wsdlInclude) { 374 this.includes.add(wsdlInclude); 375 } 376 377 380 public WSDLDescription createDescription() { 381 return new WSDLDescriptionImpl(); 382 } 383 384 387 public WSDLService createService() { 388 return new WSDLServiceImpl(); 389 } 390 391 394 public WSDLInterface createInterface() { 395 return new WSDLInterfaceImpl(); 396 } 397 398 401 public WSDLTypes createTypes() { 402 return new WSDLTypesImpl(); 403 } 404 405 408 public WSDLBinding createBinding() { 409 return new WSDLBindingImpl(); 410 } 411 412 415 public WSDLOperation createOperation() { 416 return new WSDLOperationImpl(); 417 } 418 419 422 public WSDLEndpoint createEndpoint() { 423 return new WSDLEndpointImpl(); 424 } 425 426 427 430 public WSDLFeature createFeature() { 431 return new WSDLFeatureImpl(); 432 } 433 434 437 public WSDLImport createImport() { 438 return new WSDLImportImpl(); 439 } 440 441 444 public WSDLInclude createInclude() { 445 return new WSDLIncludeImpl(); 446 } 447 448 453 public WSDLProperty createProperty() { 454 return new WSDLPropertyImpl(); 455 } 456 457 public MessageReference createMessageReference(){ 458 return new MessageReferenceImpl(); 459 } 460 461 public WSDLBindingMessageReference createWSDLBindingMessageReference(){ 462 return new WSDLBindingMessageReferenceImpl(); 463 } 464 465 public WSDLBindingOperation createWSDLBindingOperation(){ 466 return new WSDLBindingOperationImpl(); 467 } 468 469 475 public ExtensionFactory createExtensionFactory(){ 476 return new ExtensionFactoryImpl(); 477 } 478 479 480 public WSDLBinding getFirstBinding(){ 481 Iterator bindingIterator = this.bindings.values().iterator(); 482 if(bindingIterator.hasNext()){ 483 return (WSDLBinding)bindingIterator.next(); 484 } 485 throw new WSDLProcessingException("No Binding Components are available"); 486 } 487 488 public WSDLExtensibilityAttribute createWSDLExtensibilityAttribute(){ 489 return new WSDLExtensibilityAttributeImpl(); 490 } 491 492 public WSDLFaultReference createFaultReference(){ 493 return new WSDLFaultReferenceImpl(); 494 } 495 496 public WSDLBindingFault createBindingFault(){ 497 return new WSDLBindingFaultImpl(); 498 } 499 } 500 | Popular Tags |