KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > api > jaxws > wsdlmodel > WsdlPort


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.api.jaxws.wsdlmodel;
21
22 import com.sun.tools.ws.processor.model.Operation;
23 import com.sun.tools.ws.processor.model.Port;
24 import com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
25 import java.util.ArrayList JavaDoc;
26 import java.util.List JavaDoc;
27
28 /**
29  *
30  * @author mkuchtiak
31  */

32 public class WsdlPort {
33     public static final String JavaDoc STYLE_DOCUMENT="document"; //NOI18N
34
public static final String JavaDoc STYLE_RPC="rpc"; //NOI18N
35
public static final String JavaDoc SOAP_VERSION_11="http://schemas.xmlsoap.org/wsdl/soap/http"; //NOI18N
36
public static final String JavaDoc SOAP_VERSION_12="http://www.w3.org/2003/05/soap/bindings/HTTP/"; //NOI18N
37

38     private Port port;
39     private String JavaDoc soapVersion = SOAP_VERSION_11;
40     
41     /** Creates a new instance of WsdlPort */
42     WsdlPort(Port port) {
43         this.port=port;
44     }
45     
46     public Object JavaDoc /*com.sun.tools.ws.processor.model.Port*/ getInternalJAXWSPort() {
47         return port;
48     }
49     
50     public List JavaDoc<WsdlOperation> getOperations() {
51         List JavaDoc<WsdlOperation> wsdlOperations = new ArrayList JavaDoc<WsdlOperation> ();
52         if (port==null) return wsdlOperations;
53         List JavaDoc<Operation> operations = port.getOperations();
54         for (Operation op:operations)
55             wsdlOperations.add(new WsdlOperation(op));
56         return wsdlOperations;
57     }
58     
59     public String JavaDoc getName() {
60         if (port==null) return null;
61         return port.getName().getLocalPart();
62     }
63     
64     public String JavaDoc getNamespaceURI() {
65         return port.getName().getNamespaceURI();
66     }
67     
68     public String JavaDoc getJavaName() {
69         if (port==null) return null;
70         return port.getJavaInterface().getName();
71     }
72     
73     public String JavaDoc getPortGetter() {
74         if (port==null) return null;
75         return port.getPortGetter();
76     }
77     
78     public String JavaDoc getSOAPVersion() {
79         return soapVersion;
80     }
81     
82     public void setSOAPVersion(String JavaDoc soapVersion) {
83         this.soapVersion=soapVersion;
84     }
85     
86     public String JavaDoc getStyle() {
87         SOAPStyle style = port.getStyle();
88         if (SOAPStyle.DOCUMENT.equals(style)) return STYLE_DOCUMENT;
89         else if (SOAPStyle.RPC.equals(style)) return STYLE_RPC;
90         return null;
91     }
92     
93     public boolean isProvider(){
94         return port.isProvider();
95     }
96 }
97
Popular Tags