1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingWSDLParserExtension.java Thu Sep 26 10:43:28 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingWSDLParserExtension.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 @@ -26,19 +26,18 @@ 1.11 package com.sun.xml.internal.ws.wsdl.parser; 1.12 1.13 import com.sun.xml.internal.ws.api.addressing.AddressingVersion; 1.14 -import com.sun.xml.internal.ws.api.model.wsdl.*; 1.15 +import com.sun.xml.internal.ws.api.model.wsdl.WSDLFeaturedObject; 1.16 +import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS; 1.17 +import com.sun.xml.internal.ws.api.model.wsdl.editable.*; 1.18 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension; 1.19 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext; 1.20 -import com.sun.xml.internal.ws.model.wsdl.*; 1.21 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; 1.22 -import com.sun.xml.internal.ws.resources.AddressingMessages; 1.23 1.24 import javax.xml.namespace.QName; 1.25 import javax.xml.stream.XMLStreamException; 1.26 import javax.xml.stream.XMLStreamReader; 1.27 import javax.xml.ws.WebServiceException; 1.28 import javax.xml.ws.soap.AddressingFeature; 1.29 -import java.util.Map; 1.30 1.31 /** 1.32 * W3C WS-Addressing Runtime WSDL parser extension 1.33 @@ -47,12 +46,12 @@ 1.34 */ 1.35 public class W3CAddressingWSDLParserExtension extends WSDLParserExtension { 1.36 @Override 1.37 - public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) { 1.38 + public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) { 1.39 return addressibleElement(reader, binding); 1.40 } 1.41 1.42 @Override 1.43 - public boolean portElements(WSDLPort port, XMLStreamReader reader) { 1.44 + public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) { 1.45 return addressibleElement(reader, port); 1.46 } 1.47 1.48 @@ -69,8 +68,8 @@ 1.49 } 1.50 1.51 @Override 1.52 - public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) { 1.53 - WSDLBoundOperationImpl impl = (WSDLBoundOperationImpl)operation; 1.54 + public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) { 1.55 + EditableWSDLBoundOperation edit = (EditableWSDLBoundOperation) operation; 1.56 1.57 QName anon = reader.getName(); 1.58 if (anon.equals(AddressingVersion.W3C.wsdlAnonymousTag)) { 1.59 @@ -81,11 +80,11 @@ 1.60 // TODO: throw exception only if wsdl:required=true 1.61 // TODO: is this the right exception ? 1.62 } else if (value.equals("optional")) { 1.63 - impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.optional); 1.64 + edit.setAnonymous(ANONYMOUS.optional); 1.65 } else if (value.equals("required")) { 1.66 - impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.required); 1.67 + edit.setAnonymous(ANONYMOUS.required); 1.68 } else if (value.equals("prohibited")) { 1.69 - impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.prohibited); 1.70 + edit.setAnonymous(ANONYMOUS.prohibited); 1.71 } else { 1.72 throw new WebServiceException("wsaw:Anonymous value \"" + value + "\" not understood."); 1.73 // TODO: throw exception only if wsdl:required=true 1.74 @@ -101,29 +100,29 @@ 1.75 return false; 1.76 } 1.77 1.78 - public void portTypeOperationInputAttributes(WSDLInput input, XMLStreamReader reader) { 1.79 + public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) { 1.80 String action = ParserUtil.getAttribute(reader, getWsdlActionTag()); 1.81 if (action != null) { 1.82 - ((WSDLInputImpl)input).setAction(action); 1.83 - ((WSDLInputImpl)input).setDefaultAction(false); 1.84 + input.setAction(action); 1.85 + input.setDefaultAction(false); 1.86 } 1.87 } 1.88 1.89 1.90 - public void portTypeOperationOutputAttributes(WSDLOutput output, XMLStreamReader reader) { 1.91 + public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) { 1.92 String action = ParserUtil.getAttribute(reader, getWsdlActionTag()); 1.93 if (action != null) { 1.94 - ((WSDLOutputImpl)output).setAction(action); 1.95 - ((WSDLOutputImpl)output).setDefaultAction(false); 1.96 + output.setAction(action); 1.97 + output.setDefaultAction(false); 1.98 } 1.99 } 1.100 1.101 1.102 - public void portTypeOperationFaultAttributes(WSDLFault fault, XMLStreamReader reader) { 1.103 + public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) { 1.104 String action = ParserUtil.getAttribute(reader, getWsdlActionTag()); 1.105 if (action != null) { 1.106 - ((WSDLFaultImpl) fault).setAction(action); 1.107 - ((WSDLFaultImpl) fault).setDefaultAction(false); 1.108 + fault.setAction(action); 1.109 + fault.setDefaultAction(false); 1.110 } 1.111 } 1.112 1.113 @@ -139,11 +138,10 @@ 1.114 */ 1.115 @Override 1.116 public void finished(WSDLParserExtensionContext context) { 1.117 - WSDLModel model = context.getWSDLModel(); 1.118 - for (WSDLService service : model.getServices().values()) { 1.119 - for (WSDLPort wp : service.getPorts()) { 1.120 - WSDLPortImpl port = (WSDLPortImpl)wp; 1.121 - WSDLBoundPortTypeImpl binding = port.getBinding(); 1.122 + EditableWSDLModel model = context.getWSDLModel(); 1.123 + for (EditableWSDLService service : model.getServices().values()) { 1.124 + for (EditableWSDLPort port : service.getPorts()) { 1.125 + EditableWSDLBoundPortType binding = port.getBinding(); 1.126 1.127 // populate actions for the messages that do not have an explicit wsaw:Action 1.128 populateActions(binding); 1.129 @@ -166,12 +164,12 @@ 1.130 * 1.131 * @param binding soapbinding:operation 1.132 */ 1.133 - private void populateActions(WSDLBoundPortTypeImpl binding) { 1.134 - WSDLPortTypeImpl porttype = binding.getPortType(); 1.135 - for (WSDLOperationImpl o : porttype.getOperations()) { 1.136 + private void populateActions(EditableWSDLBoundPortType binding) { 1.137 + EditableWSDLPortType porttype = binding.getPortType(); 1.138 + for (EditableWSDLOperation o : porttype.getOperations()) { 1.139 // TODO: this may be performance intensive. Alternatively default action 1.140 // TODO: can be calculated when the operation is actually invoked. 1.141 - WSDLBoundOperationImpl wboi = binding.get(o.getName()); 1.142 + EditableWSDLBoundOperation wboi = binding.get(o.getName()); 1.143 1.144 if (wboi == null) { 1.145 //If this operation is unbound set the action to default 1.146 @@ -202,9 +200,9 @@ 1.147 if (o.getFaults() == null || !o.getFaults().iterator().hasNext()) 1.148 continue; 1.149 1.150 - for (WSDLFault f : o.getFaults()) { 1.151 + for (EditableWSDLFault f : o.getFaults()) { 1.152 if (f.getAction() == null || f.getAction().equals("")) { 1.153 - ((WSDLFaultImpl)f).setAction(defaultFaultAction(f.getName(), o)); 1.154 + f.setAction(defaultFaultAction(f.getName(), o)); 1.155 } 1.156 1.157 } 1.158 @@ -216,26 +214,26 @@ 1.159 * 1.160 * @param binding WSDLBoundPortTypeImpl 1.161 */ 1.162 - protected void patchAnonymousDefault(WSDLBoundPortTypeImpl binding) { 1.163 - for (WSDLBoundOperationImpl wbo : binding.getBindingOperations()) { 1.164 + protected void patchAnonymousDefault(EditableWSDLBoundPortType binding) { 1.165 + for (EditableWSDLBoundOperation wbo : binding.getBindingOperations()) { 1.166 if (wbo.getAnonymous() == null) 1.167 - wbo.setAnonymous(WSDLBoundOperation.ANONYMOUS.optional); 1.168 + wbo.setAnonymous(ANONYMOUS.optional); 1.169 } 1.170 } 1.171 1.172 - private String defaultInputAction(WSDLOperation o) { 1.173 + private String defaultInputAction(EditableWSDLOperation o) { 1.174 return buildAction(o.getInput().getName(), o, false); 1.175 } 1.176 1.177 - private String defaultOutputAction(WSDLOperation o) { 1.178 + private String defaultOutputAction(EditableWSDLOperation o) { 1.179 return buildAction(o.getOutput().getName(), o, false); 1.180 } 1.181 1.182 - private String defaultFaultAction(String name, WSDLOperation o) { 1.183 + private String defaultFaultAction(String name, EditableWSDLOperation o) { 1.184 return buildAction(name, o, true); 1.185 } 1.186 1.187 - protected static final String buildAction(String name, WSDLOperation o, boolean isFault) { 1.188 + protected static final String buildAction(String name, EditableWSDLOperation o, boolean isFault) { 1.189 String tns = o.getName().getNamespaceURI(); 1.190 1.191 String delim = SLASH_DELIMITER;