1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLModelImpl.java Thu Sep 26 10:43:28 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLModelImpl.java Fri Oct 04 16:21:34 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -27,21 +27,25 @@ 1.11 1.12 import com.sun.istack.internal.NotNull; 1.13 import com.sun.xml.internal.ws.api.model.ParameterBinding; 1.14 -import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType; 1.15 import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage; 1.16 import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel; 1.17 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation; 1.18 -import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; 1.19 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType; 1.20 -import com.sun.xml.internal.ws.api.model.wsdl.WSDLService; 1.21 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation; 1.22 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType; 1.23 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage; 1.24 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel; 1.25 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart; 1.26 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort; 1.27 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType; 1.28 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService; 1.29 import com.sun.xml.internal.ws.policy.PolicyMap; 1.30 1.31 import javax.jws.WebParam.Mode; 1.32 import javax.xml.namespace.QName; 1.33 -import java.net.URL; 1.34 + 1.35 import java.util.Collections; 1.36 import java.util.HashMap; 1.37 -import java.util.Iterator; 1.38 import java.util.LinkedHashMap; 1.39 import java.util.Map; 1.40 1.41 @@ -50,15 +54,15 @@ 1.42 * 1.43 * @author Vivek Pandey 1.44 */ 1.45 -public final class WSDLModelImpl extends AbstractExtensibleImpl implements WSDLModel { 1.46 - private final Map<QName, WSDLMessageImpl> messages = new HashMap<QName, WSDLMessageImpl>(); 1.47 - private final Map<QName, WSDLPortTypeImpl> portTypes = new HashMap<QName, WSDLPortTypeImpl>(); 1.48 - private final Map<QName, WSDLBoundPortTypeImpl> bindings = new HashMap<QName, WSDLBoundPortTypeImpl>(); 1.49 - private final Map<QName, WSDLServiceImpl> services = new LinkedHashMap<QName, WSDLServiceImpl>(); 1.50 +public final class WSDLModelImpl extends AbstractExtensibleImpl implements EditableWSDLModel { 1.51 + private final Map<QName, EditableWSDLMessage> messages = new HashMap<QName, EditableWSDLMessage>(); 1.52 + private final Map<QName, EditableWSDLPortType> portTypes = new HashMap<QName, EditableWSDLPortType>(); 1.53 + private final Map<QName, EditableWSDLBoundPortType> bindings = new HashMap<QName, EditableWSDLBoundPortType>(); 1.54 + private final Map<QName, EditableWSDLService> services = new LinkedHashMap<QName, EditableWSDLService>(); 1.55 1.56 private PolicyMap policyMap; 1.57 - private final Map<QName,WSDLBoundPortType> unmBindings 1.58 - = Collections.<QName,WSDLBoundPortType>unmodifiableMap(bindings); 1.59 + private final Map<QName, EditableWSDLBoundPortType> unmBindings 1.60 + = Collections.<QName, EditableWSDLBoundPortType>unmodifiableMap(bindings); 1.61 1.62 1.63 public WSDLModelImpl(@NotNull String systemId) { 1.64 @@ -72,52 +76,52 @@ 1.65 super(null,-1); 1.66 } 1.67 1.68 - public void addMessage(WSDLMessageImpl msg){ 1.69 + public void addMessage(EditableWSDLMessage msg){ 1.70 messages.put(msg.getName(), msg); 1.71 } 1.72 1.73 - public WSDLMessageImpl getMessage(QName name){ 1.74 + public EditableWSDLMessage getMessage(QName name){ 1.75 return messages.get(name); 1.76 } 1.77 1.78 - public void addPortType(WSDLPortTypeImpl pt){ 1.79 + public void addPortType(EditableWSDLPortType pt){ 1.80 portTypes.put(pt.getName(), pt); 1.81 } 1.82 1.83 - public WSDLPortTypeImpl getPortType(QName name){ 1.84 + public EditableWSDLPortType getPortType(QName name){ 1.85 return portTypes.get(name); 1.86 } 1.87 1.88 - public void addBinding(WSDLBoundPortTypeImpl boundPortType){ 1.89 + public void addBinding(EditableWSDLBoundPortType boundPortType){ 1.90 assert !bindings.containsValue(boundPortType); 1.91 bindings.put(boundPortType.getName(), boundPortType); 1.92 } 1.93 1.94 - public WSDLBoundPortTypeImpl getBinding(QName name){ 1.95 + public EditableWSDLBoundPortType getBinding(QName name){ 1.96 return bindings.get(name); 1.97 } 1.98 1.99 - public void addService(WSDLServiceImpl svc){ 1.100 + public void addService(EditableWSDLService svc){ 1.101 services.put(svc.getName(), svc); 1.102 } 1.103 1.104 - public WSDLServiceImpl getService(QName name){ 1.105 + public EditableWSDLService getService(QName name){ 1.106 return services.get(name); 1.107 } 1.108 1.109 - public Map<QName, WSDLMessageImpl> getMessages() { 1.110 + public Map<QName, EditableWSDLMessage> getMessages() { 1.111 return messages; 1.112 } 1.113 1.114 - public @NotNull Map<QName, WSDLPortTypeImpl> getPortTypes() { 1.115 + public @NotNull Map<QName, EditableWSDLPortType> getPortTypes() { 1.116 return portTypes; 1.117 } 1.118 1.119 - public @NotNull Map<QName, WSDLBoundPortType> getBindings() { 1.120 + public @NotNull Map<QName, ? extends EditableWSDLBoundPortType> getBindings() { 1.121 return unmBindings; 1.122 } 1.123 1.124 - public @NotNull Map<QName, WSDLServiceImpl> getServices(){ 1.125 + public @NotNull Map<QName, EditableWSDLService> getServices(){ 1.126 return services; 1.127 } 1.128 1.129 @@ -131,50 +135,23 @@ 1.130 } 1.131 1.132 /** 1.133 - * Returns first port QName from first service as per the insertion order 1.134 - */ 1.135 - public QName getFirstPortName(){ 1.136 - WSDLPort fp = getFirstPort(); 1.137 - if(fp==null) 1.138 - return null; 1.139 - else 1.140 - return fp.getName(); 1.141 - } 1.142 - 1.143 - private WSDLPort getFirstPort(){ 1.144 - if(services.isEmpty()) 1.145 - return null; 1.146 - WSDLService service = services.values().iterator().next(); 1.147 - Iterator<? extends WSDLPort> iter = service.getPorts().iterator(); 1.148 - WSDLPort port = iter.hasNext()?iter.next():null; 1.149 - return port; 1.150 - } 1.151 - 1.152 - /** 1.153 - * gets the first port in the wsdl which matches the serviceName and portType 1.154 - */ 1.155 - public WSDLPortImpl getMatchingPort(QName serviceName, QName portType){ 1.156 - return getService(serviceName).getMatchingPort(portType); 1.157 - } 1.158 - 1.159 - /** 1.160 * 1.161 * @param serviceName non-null service QName 1.162 * @param portName non-null port QName 1.163 * @return 1.164 * WSDLBoundOperation on success otherwise null. throws NPE if any of the parameters null 1.165 */ 1.166 - public WSDLBoundPortTypeImpl getBinding(QName serviceName, QName portName){ 1.167 - WSDLServiceImpl service = services.get(serviceName); 1.168 + public EditableWSDLBoundPortType getBinding(QName serviceName, QName portName){ 1.169 + EditableWSDLService service = services.get(serviceName); 1.170 if(service != null){ 1.171 - WSDLPortImpl port = service.get(portName); 1.172 + EditableWSDLPort port = service.get(portName); 1.173 if(port != null) 1.174 return port.getBinding(); 1.175 } 1.176 return null; 1.177 } 1.178 1.179 - void finalizeRpcLitBinding(WSDLBoundPortTypeImpl boundPortType){ 1.180 + public void finalizeRpcLitBinding(EditableWSDLBoundPortType boundPortType){ 1.181 assert(boundPortType != null); 1.182 QName portTypeName = boundPortType.getPortTypeName(); 1.183 if(portTypeName == null) 1.184 @@ -182,15 +159,15 @@ 1.185 WSDLPortType pt = portTypes.get(portTypeName); 1.186 if(pt == null) 1.187 return; 1.188 - for (WSDLBoundOperationImpl bop : boundPortType.getBindingOperations()) { 1.189 + for (EditableWSDLBoundOperation bop : boundPortType.getBindingOperations()) { 1.190 WSDLOperation pto = pt.get(bop.getName().getLocalPart()); 1.191 WSDLMessage inMsgName = pto.getInput().getMessage(); 1.192 if(inMsgName == null) 1.193 continue; 1.194 - WSDLMessageImpl inMsg = messages.get(inMsgName.getName()); 1.195 + EditableWSDLMessage inMsg = messages.get(inMsgName.getName()); 1.196 int bodyindex = 0; 1.197 if(inMsg != null){ 1.198 - for(WSDLPartImpl part:inMsg.parts()){ 1.199 + for(EditableWSDLPart part:inMsg.parts()){ 1.200 String name = part.getName(); 1.201 ParameterBinding pb = bop.getInputBinding(name); 1.202 if(pb.isBody()){ 1.203 @@ -206,9 +183,9 @@ 1.204 WSDLMessage outMsgName = pto.getOutput().getMessage(); 1.205 if(outMsgName == null) 1.206 continue; 1.207 - WSDLMessageImpl outMsg = messages.get(outMsgName.getName()); 1.208 + EditableWSDLMessage outMsg = messages.get(outMsgName.getName()); 1.209 if(outMsg!= null){ 1.210 - for(WSDLPartImpl part:outMsg.parts()){ 1.211 + for(EditableWSDLPart part:outMsg.parts()){ 1.212 String name = part.getName(); 1.213 ParameterBinding pb = bop.getOutputBinding(name); 1.214 if(pb.isBody()){ 1.215 @@ -242,14 +219,14 @@ 1.216 * Invoked at the end of the model construction to fix up references, etc. 1.217 */ 1.218 public void freeze() { 1.219 - for (WSDLServiceImpl service : services.values()) { 1.220 + for (EditableWSDLService service : services.values()) { 1.221 service.freeze(this); 1.222 } 1.223 - for (WSDLBoundPortTypeImpl bp : bindings.values()) { 1.224 + for (EditableWSDLBoundPortType bp : bindings.values()) { 1.225 bp.freeze(); 1.226 } 1.227 // Enforce freeze all the portTypes referenced by this endpoints, see Bug8966673 for detail 1.228 - for (WSDLPortTypeImpl pt : portTypes.values()) { 1.229 + for (EditableWSDLPortType pt : portTypes.values()) { 1.230 pt.freeze(); 1.231 } 1.232 }