1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java Thu Sep 26 10:43:28 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java Fri Oct 04 16:21:34 2013 +0100 1.3 @@ -42,6 +42,20 @@ 1.4 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; 1.5 import com.sun.xml.internal.ws.api.model.ParameterBinding; 1.6 import com.sun.xml.internal.ws.api.model.wsdl.WSDLDescriptorKind; 1.7 +import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel; 1.8 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault; 1.9 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation; 1.10 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType; 1.11 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault; 1.12 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput; 1.13 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage; 1.14 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel; 1.15 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation; 1.16 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput; 1.17 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart; 1.18 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort; 1.19 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType; 1.20 +import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService; 1.21 import com.sun.xml.internal.ws.api.server.Container; 1.22 import com.sun.xml.internal.ws.api.server.ContainerResolver; 1.23 import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; 1.24 @@ -60,6 +74,7 @@ 1.25 import com.sun.xml.internal.ws.util.ServiceFinder; 1.26 import com.sun.xml.internal.ws.util.xml.XmlUtil; 1.27 import com.sun.xml.internal.ws.policy.jaxws.PolicyWSDLParserExtension; 1.28 + 1.29 import org.xml.sax.EntityResolver; 1.30 import org.xml.sax.SAXException; 1.31 1.32 @@ -70,6 +85,7 @@ 1.33 import javax.xml.transform.stream.StreamSource; 1.34 import javax.xml.ws.Service; 1.35 import javax.xml.ws.WebServiceException; 1.36 + 1.37 import java.io.IOException; 1.38 import java.io.InputStream; 1.39 import java.io.FilterInputStream; 1.40 @@ -86,7 +102,7 @@ 1.41 */ 1.42 public class RuntimeWSDLParser { 1.43 1.44 - private final WSDLModelImpl wsdlDoc; 1.45 + private final EditableWSDLModel wsdlDoc; 1.46 /** 1.47 * Target namespace URI of the WSDL that we are currently parsing. 1.48 */ 1.49 @@ -126,7 +142,7 @@ 1.50 * Either this or <tt>wsdl</tt> parameter must be given. 1.51 * Null location means the system won't be able to resolve relative references in the WSDL, 1.52 */ 1.53 - public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.54 + public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.55 boolean isClientSide, Container container, 1.56 WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.57 return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, PolicyResolverFactory.create(),extensions); 1.58 @@ -141,7 +157,7 @@ 1.59 * Either this or <tt>wsdl</tt> parameter must be given. 1.60 * Null location means the system won't be able to resolve relative references in the WSDL, 1.61 */ 1.62 - public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.63 + public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.64 boolean isClientSide, Container container, Class serviceClass, 1.65 WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.66 return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, PolicyResolverFactory.create(),extensions); 1.67 @@ -156,7 +172,7 @@ 1.68 * Either this or <tt>wsdl</tt> parameter must be given. 1.69 * Null location means the system won't be able to resolve relative references in the WSDL, 1.70 */ 1.71 - public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.72 + public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.73 boolean isClientSide, Container container, @NotNull PolicyResolver policyResolver, 1.74 WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.75 return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, policyResolver, extensions); 1.76 @@ -171,7 +187,7 @@ 1.77 * Either this or <tt>wsdl</tt> parameter must be given. 1.78 * Null location means the system won't be able to resolve relative references in the WSDL, 1.79 */ 1.80 - public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.81 + public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.82 boolean isClientSide, Container container, Class serviceClass, 1.83 @NotNull PolicyResolver policyResolver, 1.84 WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.85 @@ -187,7 +203,7 @@ 1.86 * Either this or <tt>wsdl</tt> parameter must be given. 1.87 * Null location means the system won't be able to resolve relative references in the WSDL, 1.88 */ 1.89 - public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.90 + public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver, 1.91 boolean isClientSide, Container container, Class serviceClass, 1.92 @NotNull PolicyResolver policyResolver, 1.93 boolean isUseStreamFromEntityResolverWrapper, 1.94 @@ -226,10 +242,10 @@ 1.95 return wsdlParser.wsdlDoc; 1.96 } 1.97 1.98 - private static WSDLModelImpl tryWithMex(@NotNull RuntimeWSDLParser wsdlParser, @NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Throwable e, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws SAXException, XMLStreamException { 1.99 + private static WSDLModel tryWithMex(@NotNull RuntimeWSDLParser wsdlParser, @NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Throwable e, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws SAXException, XMLStreamException { 1.100 ArrayList<Throwable> exceptions = new ArrayList<Throwable>(); 1.101 try { 1.102 - WSDLModelImpl wsdlModel = wsdlParser.parseUsingMex(wsdlLoc, resolver, isClientSide, container, serviceClass, policyResolver,extensions); 1.103 + WSDLModel wsdlModel = wsdlParser.parseUsingMex(wsdlLoc, resolver, isClientSide, container, serviceClass, policyResolver,extensions); 1.104 if(wsdlModel == null){ 1.105 throw new WebServiceException(ClientMessages.FAILED_TO_PARSE(wsdlLoc.toExternalForm(), e.getMessage()), e); 1.106 } 1.107 @@ -244,7 +260,7 @@ 1.108 throw new InaccessibleWSDLException(exceptions); 1.109 } 1.110 1.111 - private WSDLModelImpl parseUsingMex(@NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension[] extensions) throws IOException, SAXException, XMLStreamException, URISyntaxException { 1.112 + private WSDLModel parseUsingMex(@NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension[] extensions) throws IOException, SAXException, XMLStreamException, URISyntaxException { 1.113 //try MEX 1.114 MetaDataResolver mdResolver = null; 1.115 ServiceDescriptor serviceDescriptor = null; 1.116 @@ -295,7 +311,7 @@ 1.117 return reader.getName().equals(WSDLConstants.QNAME_DEFINITIONS); 1.118 } 1.119 1.120 - public static WSDLModelImpl parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.121 + public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.122 assert resolver != null; 1.123 RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions); 1.124 parser.extensionFacade.start(parser.context); 1.125 @@ -306,7 +322,7 @@ 1.126 return parser.wsdlDoc; 1.127 } 1.128 1.129 - public static WSDLModelImpl parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.130 + public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { 1.131 assert resolver != null; 1.132 RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, PolicyResolverFactory.create(), extensions); 1.133 parser.extensionFacade.start(parser.context); 1.134 @@ -460,7 +476,7 @@ 1.135 readNSDecl(service_nsdecl,reader); 1.136 1.137 String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME); 1.138 - WSDLServiceImpl service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName)); 1.139 + EditableWSDLService service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName)); 1.140 extensionFacade.serviceAttributes(service, reader); 1.141 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.142 QName name = reader.getName(); 1.143 @@ -477,7 +493,7 @@ 1.144 service_nsdecl = new HashMap<String, String>(); 1.145 } 1.146 1.147 - private void parsePort(XMLStreamReader reader, WSDLServiceImpl service) { 1.148 + private void parsePort(XMLStreamReader reader, EditableWSDLService service) { 1.149 port_nsdecl.putAll(service_nsdecl); 1.150 readNSDecl(port_nsdecl,reader); 1.151 1.152 @@ -486,7 +502,7 @@ 1.153 1.154 QName bindingName = ParserUtil.getQName(reader, binding); 1.155 QName portQName = new QName(service.getName().getNamespaceURI(), portName); 1.156 - WSDLPortImpl port = new WSDLPortImpl(reader,service, portQName, bindingName); 1.157 + EditableWSDLPort port = new WSDLPortImpl(reader,service, portQName, bindingName); 1.158 1.159 extensionFacade.portAttributes(port, reader); 1.160 1.161 @@ -551,7 +567,7 @@ 1.162 XMLStreamReaderUtil.skipElement(reader); 1.163 return; 1.164 } 1.165 - WSDLBoundPortTypeImpl binding = new WSDLBoundPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, bindingName), 1.166 + EditableWSDLBoundPortType binding = new WSDLBoundPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, bindingName), 1.167 ParserUtil.getQName(reader, portTypeName)); 1.168 extensionFacade.bindingAttributes(binding, reader); 1.169 1.170 @@ -601,7 +617,7 @@ 1.171 } 1.172 1.173 1.174 - private void parseBindingOperation(XMLStreamReader reader, WSDLBoundPortTypeImpl binding) { 1.175 + private void parseBindingOperation(XMLStreamReader reader, EditableWSDLBoundPortType binding) { 1.176 String bindingOpName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name"); 1.177 if (bindingOpName == null) { 1.178 //TODO: throw exception? 1.179 @@ -611,7 +627,7 @@ 1.180 } 1.181 1.182 QName opName = new QName(binding.getPortTypeName().getNamespaceURI(), bindingOpName); 1.183 - WSDLBoundOperationImpl bindingOp = new WSDLBoundOperationImpl(reader,binding, opName); 1.184 + EditableWSDLBoundOperation bindingOp = new WSDLBoundOperationImpl(reader,binding, opName); 1.185 binding.put(opName, bindingOp); 1.186 extensionFacade.bindingOperationAttributes(bindingOp, reader); 1.187 1.188 @@ -651,7 +667,7 @@ 1.189 } 1.190 } 1.191 1.192 - private void parseInputBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) { 1.193 + private void parseInputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) { 1.194 boolean bodyFound = false; 1.195 extensionFacade.bindingOperationInputAttributes(bindingOp, reader); 1.196 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.197 @@ -670,7 +686,7 @@ 1.198 } 1.199 } 1.200 1.201 - private void parseOutputBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) { 1.202 + private void parseOutputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) { 1.203 boolean bodyFound = false; 1.204 extensionFacade.bindingOperationOutputAttributes(bindingOp, reader); 1.205 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.206 @@ -689,9 +705,9 @@ 1.207 } 1.208 } 1.209 1.210 - private void parseFaultBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) { 1.211 + private void parseFaultBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) { 1.212 String faultName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name"); 1.213 - WSDLBoundFaultImpl wsdlBoundFault = new WSDLBoundFaultImpl(reader, faultName, bindingOp); 1.214 + EditableWSDLBoundFault wsdlBoundFault = new WSDLBoundFaultImpl(reader, faultName, bindingOp); 1.215 bindingOp.addFault(wsdlBoundFault); 1.216 1.217 extensionFacade.bindingOperationFaultAttributes(wsdlBoundFault, reader); 1.218 @@ -704,7 +720,7 @@ 1.219 private enum BindingMode { 1.220 INPUT, OUTPUT, FAULT} 1.221 1.222 - private static boolean parseSOAPBodyBinding(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) { 1.223 + private static boolean parseSOAPBodyBinding(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) { 1.224 String namespace = reader.getAttributeValue(null, "namespace"); 1.225 if (mode == BindingMode.INPUT) { 1.226 op.setRequestNamespace(namespace); 1.227 @@ -749,7 +765,7 @@ 1.228 } 1.229 1.230 1.231 - private static void parseMimeMultipartBinding(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) { 1.232 + private static void parseMimeMultipartBinding(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) { 1.233 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.234 QName name = reader.getName(); 1.235 if (MIMEConstants.QNAME_PART.equals(name)) { 1.236 @@ -760,7 +776,7 @@ 1.237 } 1.238 } 1.239 1.240 - private static void parseMIMEPart(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) { 1.241 + private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) { 1.242 boolean bodyFound = false; 1.243 Map<String, ParameterBinding> parts = null; 1.244 if (mode == BindingMode.INPUT) { 1.245 @@ -820,7 +836,7 @@ 1.246 XMLStreamReaderUtil.skipElement(reader); 1.247 return; 1.248 } 1.249 - WSDLPortTypeImpl portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName)); 1.250 + EditableWSDLPortType portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName)); 1.251 extensionFacade.portTypeAttributes(portType, reader); 1.252 wsdlDoc.addPortType(portType); 1.253 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.254 @@ -834,7 +850,7 @@ 1.255 } 1.256 1.257 1.258 - private void parsePortTypeOperation(XMLStreamReader reader, WSDLPortTypeImpl portType) { 1.259 + private void parsePortTypeOperation(XMLStreamReader reader, EditableWSDLPortType portType) { 1.260 String operationName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME); 1.261 if (operationName == null) { 1.262 //TODO: throw exception? 1.263 @@ -844,7 +860,7 @@ 1.264 } 1.265 1.266 QName operationQName = new QName(portType.getName().getNamespaceURI(), operationName); 1.267 - WSDLOperationImpl operation = new WSDLOperationImpl(reader,portType, operationQName); 1.268 + EditableWSDLOperation operation = new WSDLOperationImpl(reader,portType, operationQName); 1.269 extensionFacade.portTypeOperationAttributes(operation, reader); 1.270 String parameterOrder = ParserUtil.getAttribute(reader, "parameterOrder"); 1.271 operation.setParameterOrder(parameterOrder); 1.272 @@ -864,11 +880,11 @@ 1.273 } 1.274 1.275 1.276 - private void parsePortTypeOperationFault(XMLStreamReader reader, WSDLOperationImpl operation) { 1.277 + private void parsePortTypeOperationFault(XMLStreamReader reader, EditableWSDLOperation operation) { 1.278 String msg = ParserUtil.getMandatoryNonEmptyAttribute(reader, "message"); 1.279 QName msgName = ParserUtil.getQName(reader, msg); 1.280 String name = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name"); 1.281 - WSDLFaultImpl fault = new WSDLFaultImpl(reader,name, msgName, operation); 1.282 + EditableWSDLFault fault = new WSDLFaultImpl(reader,name, msgName, operation); 1.283 operation.addFault(fault); 1.284 extensionFacade.portTypeOperationFaultAttributes(fault, reader); 1.285 extensionFacade.portTypeOperationFault(operation, reader); 1.286 @@ -877,11 +893,11 @@ 1.287 } 1.288 } 1.289 1.290 - private void parsePortTypeOperationInput(XMLStreamReader reader, WSDLOperationImpl operation) { 1.291 + private void parsePortTypeOperationInput(XMLStreamReader reader, EditableWSDLOperation operation) { 1.292 String msg = ParserUtil.getMandatoryNonEmptyAttribute(reader, "message"); 1.293 QName msgName = ParserUtil.getQName(reader, msg); 1.294 String name = ParserUtil.getAttribute(reader, "name"); 1.295 - WSDLInputImpl input = new WSDLInputImpl(reader, name, msgName, operation); 1.296 + EditableWSDLInput input = new WSDLInputImpl(reader, name, msgName, operation); 1.297 operation.setInput(input); 1.298 extensionFacade.portTypeOperationInputAttributes(input, reader); 1.299 extensionFacade.portTypeOperationInput(operation, reader); 1.300 @@ -890,11 +906,11 @@ 1.301 } 1.302 } 1.303 1.304 - private void parsePortTypeOperationOutput(XMLStreamReader reader, WSDLOperationImpl operation) { 1.305 + private void parsePortTypeOperationOutput(XMLStreamReader reader, EditableWSDLOperation operation) { 1.306 String msg = ParserUtil.getAttribute(reader, "message"); 1.307 QName msgName = ParserUtil.getQName(reader, msg); 1.308 String name = ParserUtil.getAttribute(reader, "name"); 1.309 - WSDLOutputImpl output = new WSDLOutputImpl(reader,name, msgName, operation); 1.310 + EditableWSDLOutput output = new WSDLOutputImpl(reader,name, msgName, operation); 1.311 operation.setOutput(output); 1.312 extensionFacade.portTypeOperationOutputAttributes(output, reader); 1.313 extensionFacade.portTypeOperationOutput(operation, reader); 1.314 @@ -905,7 +921,7 @@ 1.315 1.316 private void parseMessage(XMLStreamReader reader) { 1.317 String msgName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME); 1.318 - WSDLMessageImpl msg = new WSDLMessageImpl(reader,new QName(targetNamespace, msgName)); 1.319 + EditableWSDLMessage msg = new WSDLMessageImpl(reader,new QName(targetNamespace, msgName)); 1.320 extensionFacade.messageAttributes(msg, reader); 1.321 int partIndex = 0; 1.322 while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) { 1.323 @@ -928,7 +944,7 @@ 1.324 } 1.325 } 1.326 if (desc != null) { 1.327 - WSDLPartImpl wsdlPart = new WSDLPartImpl(reader, part, partIndex, new WSDLPartDescriptorImpl(reader,ParserUtil.getQName(reader, desc), kind)); 1.328 + EditableWSDLPart wsdlPart = new WSDLPartImpl(reader, part, partIndex, new WSDLPartDescriptorImpl(reader,ParserUtil.getQName(reader, desc), kind)); 1.329 msg.add(wsdlPart); 1.330 } 1.331 if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)