KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > wsdl > codegen > extension > AxisBindingBuilder


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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 JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25 /**
26  * @author chathura@opensource.lk
27  *
28  */

29 public class AxisBindingBuilder extends AbstractCodeGenerationExtension implements CodeGenExtension {
30     
31     public static final String JavaDoc AXIS_NAMESPACE = "http://ws.apache.org/axis2/";
32     
33     public static final QName JavaDoc AXIS_BINDING_QNAME = new QName JavaDoc(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 JavaDoc elementIterator = binding.getExtensibilityElements().iterator();
57         while(elementIterator.hasNext()){
58             newBinding.addExtensibilityElement((WSDLExtensibilityElement)elementIterator.next());
59         }
60         
61         Iterator JavaDoc 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