001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.internal.ws.processor.model;
027:
028: import java.util.ArrayList;
029: import java.util.HashMap;
030: import java.util.List;
031: import java.util.Map;
032:
033: import javax.xml.namespace.QName;
034:
035: import com.sun.tools.internal.ws.processor.config.HandlerChainInfo;
036: import com.sun.tools.internal.ws.processor.model.java.JavaInterface;
037: import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse;
038: import com.sun.xml.internal.ws.encoding.soap.SOAPVersion;
039: import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle;
040: import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse;
041:
042: /**
043: *
044: * @author WS Development Team
045: */
046: public class Port extends ModelObject {
047:
048: public Port() {
049: }
050:
051: public Port(QName name) {
052: _name = name;
053: }
054:
055: public QName getName() {
056: return _name;
057: }
058:
059: public void setName(QName n) {
060: _name = n;
061: }
062:
063: public void addOperation(Operation operation) {
064: _operations.add(operation);
065: operationsByName.put(operation.getUniqueName(), operation);
066: }
067:
068: public Operation getOperationByUniqueName(String name) {
069: if (operationsByName.size() != _operations.size()) {
070: initializeOperationsByName();
071: }
072: return (Operation) operationsByName.get(name);
073: }
074:
075: private void initializeOperationsByName() {
076: operationsByName = new HashMap();
077: if (_operations != null) {
078: for (Operation operation : _operations) {
079: if (operation.getUniqueName() != null
080: && operationsByName.containsKey(operation
081: .getUniqueName())) {
082:
083: throw new ModelException("model.uniqueness");
084: }
085: operationsByName.put(operation.getUniqueName(),
086: operation);
087: }
088: }
089: }
090:
091: /* serialization */
092: public List<Operation> getOperations() {
093: return _operations;
094: }
095:
096: /* serialization */
097: public void setOperations(List<Operation> l) {
098: _operations = l;
099: }
100:
101: public JavaInterface getJavaInterface() {
102: return _javaInterface;
103: }
104:
105: public void setJavaInterface(JavaInterface i) {
106: _javaInterface = i;
107: }
108:
109: public String getAddress() {
110: return _address;
111: }
112:
113: public void setAddress(String s) {
114: _address = s;
115: }
116:
117: public HandlerChainInfo getClientHandlerChainInfo() {
118: if (_clientHandlerChainInfo == null) {
119: _clientHandlerChainInfo = new HandlerChainInfo();
120: }
121: return _clientHandlerChainInfo;
122: }
123:
124: public void setClientHandlerChainInfo(HandlerChainInfo i) {
125: _clientHandlerChainInfo = i;
126: }
127:
128: public HandlerChainInfo getServerHandlerChainInfo() {
129: if (_serverHandlerChainInfo == null) {
130: _serverHandlerChainInfo = new HandlerChainInfo();
131: }
132: return _serverHandlerChainInfo;
133: }
134:
135: public void setServerHandlerChainInfo(HandlerChainInfo i) {
136: _serverHandlerChainInfo = i;
137: }
138:
139: public SOAPVersion getSOAPVersion() {
140: return _soapVersion;
141: }
142:
143: public void setSOAPVersion(SOAPVersion soapVersion) {
144: _soapVersion = soapVersion;
145: }
146:
147: public String getServiceImplName() {
148: return _serviceImplName;
149: }
150:
151: public void setServiceImplName(String name) {
152: _serviceImplName = name;
153: }
154:
155: public void accept(ModelVisitor visitor) throws Exception {
156: visitor.visit(this );
157: }
158:
159: public boolean isProvider() {
160: JavaInterface intf = getJavaInterface();
161: if (intf != null) {
162: String sei = intf.getName();
163: if (sei.equals(javax.xml.ws.Provider.class.getName())) {
164: return true;
165: }
166: }
167: return false;
168: }
169:
170: /**
171: * XYZ_Service.getABC() method name
172: * @return Returns the portGetterName.
173: */
174: public String getPortGetter() {
175: return portGetter;
176: }
177:
178: /**
179: * @param portGetterName The portGetterName to set.
180: */
181: public void setPortGetter(String portGetterName) {
182: this .portGetter = portGetterName;
183: }
184:
185: public SOAPStyle getStyle() {
186: return _style;
187: }
188:
189: public void setStyle(SOAPStyle s) {
190: _style = s;
191: }
192:
193: public boolean isWrapped() {
194: return _isWrapped;
195: }
196:
197: public void setWrapped(boolean isWrapped) {
198: _isWrapped = isWrapped;
199: }
200:
201: private SOAPStyle _style = null;
202: private boolean _isWrapped = true;
203:
204: private String portGetter;
205: private QName _name;
206: private List<Operation> _operations = new ArrayList();
207: private JavaInterface _javaInterface;
208: private String _address;
209: private String _serviceImplName;
210: private Map operationsByName = new HashMap();
211: private HandlerChainInfo _clientHandlerChainInfo;
212: private HandlerChainInfo _serverHandlerChainInfo;
213: private SOAPVersion _soapVersion = SOAPVersion.SOAP_11;
214: }
|