001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.websvc.api.jaxws.wsdlmodel;
043:
044: import com.sun.tools.ws.processor.model.Operation;
045: import com.sun.tools.ws.processor.model.Port;
046: import com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
047: import java.util.ArrayList;
048: import java.util.List;
049:
050: /**
051: *
052: * @author mkuchtiak
053: */
054: public class WsdlPort {
055: public static final String STYLE_DOCUMENT = "document"; //NOI18N
056: public static final String STYLE_RPC = "rpc"; //NOI18N
057: public static final String SOAP_VERSION_11 = "http://schemas.xmlsoap.org/wsdl/soap/http"; //NOI18N
058: public static final String SOAP_VERSION_12 = "http://www.w3.org/2003/05/soap/bindings/HTTP/"; //NOI18N
059:
060: private Port port;
061: private String soapVersion = SOAP_VERSION_11;
062:
063: /** Creates a new instance of WsdlPort */
064: WsdlPort(Port port) {
065: this .port = port;
066: }
067:
068: public Object /*com.sun.tools.ws.processor.model.Port*/getInternalJAXWSPort() {
069: return port;
070: }
071:
072: public List<WsdlOperation> getOperations() {
073: List<WsdlOperation> wsdlOperations = new ArrayList<WsdlOperation>();
074: if (port == null)
075: return wsdlOperations;
076: List<Operation> operations = port.getOperations();
077: for (Operation op : operations)
078: wsdlOperations.add(new WsdlOperation(op));
079: return wsdlOperations;
080: }
081:
082: public String getName() {
083: if (port == null)
084: return null;
085: return port.getName().getLocalPart();
086: }
087:
088: public String getNamespaceURI() {
089: return port.getName().getNamespaceURI();
090: }
091:
092: public String getJavaName() {
093: if (port == null)
094: return null;
095: return port.getJavaInterface().getName();
096: }
097:
098: public String getPortGetter() {
099: if (port == null)
100: return null;
101: return port.getPortGetter();
102: }
103:
104: public String getSOAPVersion() {
105: return soapVersion;
106: }
107:
108: public void setSOAPVersion(String soapVersion) {
109: this .soapVersion = soapVersion;
110: }
111:
112: public String getStyle() {
113: SOAPStyle style = port.getStyle();
114: if (SOAPStyle.DOCUMENT.equals(style))
115: return STYLE_DOCUMENT;
116: else if (SOAPStyle.RPC.equals(style))
117: return STYLE_RPC;
118: return null;
119: }
120:
121: public boolean isProvider() {
122: return port.isProvider();
123: }
124:
125: public String getAddress() {
126: return port.getAddress();
127: }
128: }
|