| /* |
| * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| * |
| * This code is free software; you can redistribute it and/or modify it |
| * under the terms of the GNU General Public License version 2 only, as |
| * published by the Free Software Foundation. Sun designates this |
| * particular file as subject to the "Classpath" exception as provided |
| * by Sun in the LICENSE file that accompanied this code. |
| * |
| * This code is distributed in the hope that it will be useful, but WITHOUT |
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| * version 2 for more details (a copy is included in the LICENSE file that |
| * accompanied this code). |
| * |
| * You should have received a copy of the GNU General Public License version |
| * 2 along with this work; if not, write to the Free Software Foundation, |
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| * |
| * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| * CA 95054 USA or visit www.sun.com if you need additional information or |
| * have any questions. |
| */ |
| |
| package com.sun.tools.internal.ws.processor.model; |
| |
| import java.util.ArrayList; |
| import java.util.HashMap; |
| import java.util.List; |
| import java.util.Map; |
| |
| import javax.xml.namespace.QName; |
| |
| import com.sun.tools.internal.ws.processor.config.HandlerChainInfo; |
| import com.sun.tools.internal.ws.processor.model.java.JavaInterface; |
| import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse; |
| import com.sun.xml.internal.ws.encoding.soap.SOAPVersion; |
| import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; |
| import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse; |
| |
| /** |
| * |
| * @author WS Development Team |
| */ |
| public class Port extends ModelObject { |
| |
| public Port() {} |
| |
| public Port(QName name) { |
| _name = name; |
| } |
| |
| public QName getName() { |
| return _name; |
| } |
| |
| public void setName(QName n) { |
| _name = n; |
| } |
| |
| public void addOperation(Operation operation) { |
| _operations.add(operation); |
| operationsByName.put(operation.getUniqueName(), operation); |
| } |
| |
| public Operation getOperationByUniqueName(String name) { |
| if (operationsByName.size() != _operations.size()) { |
| initializeOperationsByName(); |
| } |
| return (Operation)operationsByName.get(name); |
| } |
| |
| private void initializeOperationsByName() { |
| operationsByName = new HashMap(); |
| if (_operations != null) { |
| for (Operation operation : _operations) { |
| if (operation.getUniqueName() != null && |
| operationsByName.containsKey(operation.getUniqueName())) { |
| |
| throw new ModelException("model.uniqueness"); |
| } |
| operationsByName.put(operation.getUniqueName(), operation); |
| } |
| } |
| } |
| |
| /* serialization */ |
| public List<Operation> getOperations() { |
| return _operations; |
| } |
| |
| /* serialization */ |
| public void setOperations(List<Operation> l) { |
| _operations = l; |
| } |
| |
| public JavaInterface getJavaInterface() { |
| return _javaInterface; |
| } |
| |
| public void setJavaInterface(JavaInterface i) { |
| _javaInterface = i; |
| } |
| |
| public String getAddress() { |
| return _address; |
| } |
| |
| public void setAddress(String s) { |
| _address = s; |
| } |
| |
| public HandlerChainInfo getClientHandlerChainInfo() { |
| if (_clientHandlerChainInfo == null) { |
| _clientHandlerChainInfo = new HandlerChainInfo(); |
| } |
| return _clientHandlerChainInfo; |
| } |
| |
| public void setClientHandlerChainInfo(HandlerChainInfo i) { |
| _clientHandlerChainInfo = i; |
| } |
| |
| public HandlerChainInfo getServerHandlerChainInfo() { |
| if (_serverHandlerChainInfo == null) { |
| _serverHandlerChainInfo = new HandlerChainInfo(); |
| } |
| return _serverHandlerChainInfo; |
| } |
| |
| public void setServerHandlerChainInfo(HandlerChainInfo i) { |
| _serverHandlerChainInfo = i; |
| } |
| |
| public SOAPVersion getSOAPVersion() { |
| return _soapVersion; |
| } |
| |
| public void setSOAPVersion(SOAPVersion soapVersion) { |
| _soapVersion = soapVersion; |
| } |
| |
| public String getServiceImplName() { |
| return _serviceImplName; |
| } |
| |
| public void setServiceImplName(String name) { |
| _serviceImplName = name; |
| } |
| |
| public void accept(ModelVisitor visitor) throws Exception { |
| visitor.visit(this); |
| } |
| |
| public boolean isProvider() { |
| JavaInterface intf = getJavaInterface(); |
| if (intf != null) { |
| String sei = intf.getName(); |
| if (sei.equals(javax.xml.ws.Provider.class.getName())) { |
| return true; |
| } |
| } |
| return false; |
| } |
| |
| /** |
| * XYZ_Service.getABC() method name |
| * @return Returns the portGetterName. |
| */ |
| public String getPortGetter() { |
| return portGetter; |
| } |
| |
| /** |
| * @param portGetterName The portGetterName to set. |
| */ |
| public void setPortGetter(String portGetterName) { |
| this.portGetter = portGetterName; |
| } |
| |
| public SOAPStyle getStyle() { |
| return _style; |
| } |
| |
| public void setStyle(SOAPStyle s) { |
| _style = s; |
| } |
| |
| public boolean isWrapped() { |
| return _isWrapped; |
| } |
| |
| public void setWrapped(boolean isWrapped) { |
| _isWrapped = isWrapped; |
| } |
| |
| private SOAPStyle _style = null; |
| private boolean _isWrapped = true; |
| |
| private String portGetter; |
| private QName _name; |
| private List<Operation> _operations = new ArrayList(); |
| private JavaInterface _javaInterface; |
| private String _address; |
| private String _serviceImplName; |
| private Map operationsByName = new HashMap(); |
| private HandlerChainInfo _clientHandlerChainInfo; |
| private HandlerChainInfo _serverHandlerChainInfo; |
| private SOAPVersion _soapVersion = SOAPVersion.SOAP_11; |
| } |