1 16 17 package org.apache.axis2.wsdl.codegen.extension; 18 19 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; 20 import org.apache.wsdl.*; 21 22 import javax.xml.namespace.QName ; 23 import java.util.Iterator ; 24 25 29 public class AxisBindingBuilder extends AbstractCodeGenerationExtension implements CodeGenExtension { 30 31 public static final String AXIS_NAMESPACE = "http://ws.apache.org/axis2/"; 32 33 public static final QName AXIS_BINDING_QNAME = new QName (AXIS_NAMESPACE, "codeGenerationBinding", "axis"); 34 35 36 37 public AxisBindingBuilder() { 38 } 39 40 public void init(CodeGenConfiguration configuration){ 41 this.configuration = configuration; 42 } 43 44 public void engage(){ 45 WSDLDescription wom = this.configuration.getWom(); 46 WSDLBinding binding = wom.getFirstBinding(); 47 48 WSDLBinding newBinding = wom.createBinding(); 49 newBinding.setName(AXIS_BINDING_QNAME); 50 51 WSDLInterface boundInterface = binding.getBoundInterface(); 52 newBinding.setBoundInterface(boundInterface); 53 54 newBinding.setBindingFaults(binding.getBindingFaults()); 55 newBinding.setBindingOperations(binding.getBindingOperations()); 56 Iterator elementIterator = binding.getExtensibilityElements().iterator(); 57 while(elementIterator.hasNext()){ 58 newBinding.addExtensibilityElement((WSDLExtensibilityElement)elementIterator.next()); 59 } 60 61 Iterator attributeIterator = binding.getExtensibilityAttributes().iterator(); 62 while(attributeIterator.hasNext()){ 63 newBinding.addExtensibleAttributes((WSDLExtensibilityAttribute)attributeIterator.next()); 64 } 65 66 wom.addBinding(newBinding); 67 } 68 } 69 | Popular Tags |