1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/jaxws/PolicyWSDLParserExtension.java Thu Sep 26 10:43:28 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/jaxws/PolicyWSDLParserExtension.java Fri Oct 04 16:21:34 2013 +0100 1.3 @@ -25,7 +25,8 @@ 1.4 1.5 package com.sun.xml.internal.ws.policy.jaxws; 1.6 1.7 -import com.sun.xml.internal.ws.api.model.wsdl.*; 1.8 +import com.sun.xml.internal.ws.api.model.wsdl.WSDLObject; 1.9 +import com.sun.xml.internal.ws.api.model.wsdl.editable.*; 1.10 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension; 1.11 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext; 1.12 import com.sun.xml.internal.ws.api.policy.PolicyResolver; 1.13 @@ -37,7 +38,6 @@ 1.14 import com.sun.xml.internal.ws.policy.sourcemodel.PolicySourceModelContext; 1.15 import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion; 1.16 import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken; 1.17 -import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl; 1.18 import com.sun.xml.internal.ws.policy.PolicyException; 1.19 import com.sun.xml.internal.ws.policy.PolicyMap; 1.20 import com.sun.xml.internal.ws.util.xml.XmlUtil; 1.21 @@ -54,12 +54,11 @@ 1.22 import java.util.HashMap; 1.23 import java.util.LinkedList; 1.24 import java.util.Map; 1.25 + 1.26 import javax.xml.namespace.QName; 1.27 import javax.xml.stream.XMLStreamException; 1.28 import javax.xml.stream.XMLStreamReader; 1.29 -import javax.xml.stream.XMLInputFactory; 1.30 import javax.xml.ws.WebServiceException; 1.31 -import javax.xml.xpath.XPathFactoryConfigurationException; 1.32 1.33 /** 1.34 * This class parses the Policy Attachments in the WSDL and creates a PolicyMap thaty captures the policies configured on 1.35 @@ -376,7 +375,7 @@ 1.36 } 1.37 1.38 @Override 1.39 - public boolean portElements(final WSDLPort port, final XMLStreamReader reader) { 1.40 + public boolean portElements(final EditableWSDLPort port, final XMLStreamReader reader) { 1.41 LOGGER.entering(); 1.42 final boolean result = processSubelement(port, reader, getHandlers4PortMap()); 1.43 LOGGER.exiting(); 1.44 @@ -384,14 +383,14 @@ 1.45 } 1.46 1.47 @Override 1.48 - public void portAttributes(final WSDLPort port, final XMLStreamReader reader) { 1.49 + public void portAttributes(final EditableWSDLPort port, final XMLStreamReader reader) { 1.50 LOGGER.entering(); 1.51 processAttributes(port, reader, getHandlers4PortMap()); 1.52 LOGGER.exiting(); 1.53 } 1.54 1.55 @Override 1.56 - public boolean serviceElements(final WSDLService service, final XMLStreamReader reader) { 1.57 + public boolean serviceElements(final EditableWSDLService service, final XMLStreamReader reader) { 1.58 LOGGER.entering(); 1.59 final boolean result = processSubelement(service, reader, getHandlers4ServiceMap()); 1.60 LOGGER.exiting(); 1.61 @@ -399,7 +398,7 @@ 1.62 } 1.63 1.64 @Override 1.65 - public void serviceAttributes(final WSDLService service, final XMLStreamReader reader) { 1.66 + public void serviceAttributes(final EditableWSDLService service, final XMLStreamReader reader) { 1.67 LOGGER.entering(); 1.68 processAttributes(service, reader, getHandlers4ServiceMap()); 1.69 LOGGER.exiting(); 1.70 @@ -424,7 +423,7 @@ 1.71 } 1.72 1.73 @Override 1.74 - public boolean bindingElements(final WSDLBoundPortType binding, final XMLStreamReader reader) { 1.75 + public boolean bindingElements(final EditableWSDLBoundPortType binding, final XMLStreamReader reader) { 1.76 LOGGER.entering(); 1.77 final boolean result = processSubelement(binding, reader, getHandlers4BindingMap()); 1.78 LOGGER.exiting(); 1.79 @@ -432,14 +431,14 @@ 1.80 } 1.81 1.82 @Override 1.83 - public void bindingAttributes(final WSDLBoundPortType binding, final XMLStreamReader reader) { 1.84 + public void bindingAttributes(final EditableWSDLBoundPortType binding, final XMLStreamReader reader) { 1.85 LOGGER.entering(); 1.86 processAttributes(binding, reader, getHandlers4BindingMap()); 1.87 LOGGER.exiting(); 1.88 } 1.89 1.90 @Override 1.91 - public boolean portTypeElements(final WSDLPortType portType, final XMLStreamReader reader) { 1.92 + public boolean portTypeElements(final EditableWSDLPortType portType, final XMLStreamReader reader) { 1.93 LOGGER.entering(); 1.94 final boolean result = processSubelement(portType, reader, getHandlers4PortTypeMap()); 1.95 LOGGER.exiting(); 1.96 @@ -447,14 +446,14 @@ 1.97 } 1.98 1.99 @Override 1.100 - public void portTypeAttributes(final WSDLPortType portType, final XMLStreamReader reader) { 1.101 + public void portTypeAttributes(final EditableWSDLPortType portType, final XMLStreamReader reader) { 1.102 LOGGER.entering(); 1.103 processAttributes(portType, reader, getHandlers4PortTypeMap()); 1.104 LOGGER.exiting(); 1.105 } 1.106 1.107 @Override 1.108 - public boolean portTypeOperationElements(final WSDLOperation operation, final XMLStreamReader reader) { 1.109 + public boolean portTypeOperationElements(final EditableWSDLOperation operation, final XMLStreamReader reader) { 1.110 LOGGER.entering(); 1.111 final boolean result = processSubelement(operation, reader, getHandlers4OperationMap()); 1.112 LOGGER.exiting(); 1.113 @@ -462,14 +461,14 @@ 1.114 } 1.115 1.116 @Override 1.117 - public void portTypeOperationAttributes(final WSDLOperation operation, final XMLStreamReader reader) { 1.118 + public void portTypeOperationAttributes(final EditableWSDLOperation operation, final XMLStreamReader reader) { 1.119 LOGGER.entering(); 1.120 processAttributes(operation, reader, getHandlers4OperationMap()); 1.121 LOGGER.exiting(); 1.122 } 1.123 1.124 @Override 1.125 - public boolean bindingOperationElements(final WSDLBoundOperation boundOperation, final XMLStreamReader reader) { 1.126 + public boolean bindingOperationElements(final EditableWSDLBoundOperation boundOperation, final XMLStreamReader reader) { 1.127 LOGGER.entering(); 1.128 final boolean result = processSubelement(boundOperation, reader, getHandlers4BoundOperationMap()); 1.129 LOGGER.exiting(); 1.130 @@ -477,14 +476,14 @@ 1.131 } 1.132 1.133 @Override 1.134 - public void bindingOperationAttributes(final WSDLBoundOperation boundOperation, final XMLStreamReader reader) { 1.135 + public void bindingOperationAttributes(final EditableWSDLBoundOperation boundOperation, final XMLStreamReader reader) { 1.136 LOGGER.entering(); 1.137 processAttributes(boundOperation, reader, getHandlers4BoundOperationMap()); 1.138 LOGGER.exiting(); 1.139 } 1.140 1.141 @Override 1.142 - public boolean messageElements(final WSDLMessage msg, final XMLStreamReader reader) { 1.143 + public boolean messageElements(final EditableWSDLMessage msg, final XMLStreamReader reader) { 1.144 LOGGER.entering(); 1.145 final boolean result = processSubelement(msg, reader, getHandlers4MessageMap()); 1.146 LOGGER.exiting(); 1.147 @@ -492,14 +491,14 @@ 1.148 } 1.149 1.150 @Override 1.151 - public void messageAttributes(final WSDLMessage msg, final XMLStreamReader reader) { 1.152 + public void messageAttributes(final EditableWSDLMessage msg, final XMLStreamReader reader) { 1.153 LOGGER.entering(); 1.154 processAttributes(msg, reader, getHandlers4MessageMap()); 1.155 LOGGER.exiting(); 1.156 } 1.157 1.158 @Override 1.159 - public boolean portTypeOperationInputElements(final WSDLInput input, final XMLStreamReader reader) { 1.160 + public boolean portTypeOperationInputElements(final EditableWSDLInput input, final XMLStreamReader reader) { 1.161 LOGGER.entering(); 1.162 final boolean result = processSubelement(input, reader, getHandlers4InputMap()); 1.163 LOGGER.exiting(); 1.164 @@ -507,7 +506,7 @@ 1.165 } 1.166 1.167 @Override 1.168 - public void portTypeOperationInputAttributes(final WSDLInput input, final XMLStreamReader reader) { 1.169 + public void portTypeOperationInputAttributes(final EditableWSDLInput input, final XMLStreamReader reader) { 1.170 LOGGER.entering(); 1.171 processAttributes(input, reader, getHandlers4InputMap()); 1.172 LOGGER.exiting(); 1.173 @@ -515,7 +514,7 @@ 1.174 1.175 1.176 @Override 1.177 - public boolean portTypeOperationOutputElements(final WSDLOutput output, final XMLStreamReader reader) { 1.178 + public boolean portTypeOperationOutputElements(final EditableWSDLOutput output, final XMLStreamReader reader) { 1.179 LOGGER.entering(); 1.180 final boolean result = processSubelement(output, reader, getHandlers4OutputMap()); 1.181 LOGGER.exiting(); 1.182 @@ -523,7 +522,7 @@ 1.183 } 1.184 1.185 @Override 1.186 - public void portTypeOperationOutputAttributes(final WSDLOutput output, final XMLStreamReader reader) { 1.187 + public void portTypeOperationOutputAttributes(final EditableWSDLOutput output, final XMLStreamReader reader) { 1.188 LOGGER.entering(); 1.189 processAttributes(output, reader, getHandlers4OutputMap()); 1.190 LOGGER.exiting(); 1.191 @@ -531,7 +530,7 @@ 1.192 1.193 1.194 @Override 1.195 - public boolean portTypeOperationFaultElements(final WSDLFault fault, final XMLStreamReader reader) { 1.196 + public boolean portTypeOperationFaultElements(final EditableWSDLFault fault, final XMLStreamReader reader) { 1.197 LOGGER.entering(); 1.198 final boolean result = processSubelement(fault, reader, getHandlers4FaultMap()); 1.199 LOGGER.exiting(); 1.200 @@ -539,14 +538,14 @@ 1.201 } 1.202 1.203 @Override 1.204 - public void portTypeOperationFaultAttributes(final WSDLFault fault, final XMLStreamReader reader) { 1.205 + public void portTypeOperationFaultAttributes(final EditableWSDLFault fault, final XMLStreamReader reader) { 1.206 LOGGER.entering(); 1.207 processAttributes(fault, reader, getHandlers4FaultMap()); 1.208 LOGGER.exiting(); 1.209 } 1.210 1.211 @Override 1.212 - public boolean bindingOperationInputElements(final WSDLBoundOperation operation, final XMLStreamReader reader) { 1.213 + public boolean bindingOperationInputElements(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) { 1.214 LOGGER.entering(); 1.215 final boolean result = processSubelement(operation, reader, getHandlers4BindingInputOpMap()); 1.216 LOGGER.exiting(); 1.217 @@ -554,7 +553,7 @@ 1.218 } 1.219 1.220 @Override 1.221 - public void bindingOperationInputAttributes(final WSDLBoundOperation operation, final XMLStreamReader reader) { 1.222 + public void bindingOperationInputAttributes(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) { 1.223 LOGGER.entering(); 1.224 processAttributes(operation, reader, getHandlers4BindingInputOpMap()); 1.225 LOGGER.exiting(); 1.226 @@ -562,7 +561,7 @@ 1.227 1.228 1.229 @Override 1.230 - public boolean bindingOperationOutputElements(final WSDLBoundOperation operation, final XMLStreamReader reader) { 1.231 + public boolean bindingOperationOutputElements(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) { 1.232 LOGGER.entering(); 1.233 final boolean result = processSubelement(operation, reader, getHandlers4BindingOutputOpMap()); 1.234 LOGGER.exiting(); 1.235 @@ -570,14 +569,14 @@ 1.236 } 1.237 1.238 @Override 1.239 - public void bindingOperationOutputAttributes(final WSDLBoundOperation operation, final XMLStreamReader reader) { 1.240 + public void bindingOperationOutputAttributes(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) { 1.241 LOGGER.entering(); 1.242 processAttributes(operation, reader, getHandlers4BindingOutputOpMap()); 1.243 LOGGER.exiting(); 1.244 } 1.245 1.246 @Override 1.247 - public boolean bindingOperationFaultElements(final WSDLBoundFault fault, final XMLStreamReader reader) { 1.248 + public boolean bindingOperationFaultElements(final EditableWSDLBoundFault fault, final XMLStreamReader reader) { 1.249 LOGGER.entering(); 1.250 final boolean result = processSubelement(fault, reader, getHandlers4BindingFaultOpMap()); 1.251 LOGGER.exiting(result); 1.252 @@ -585,7 +584,7 @@ 1.253 } 1.254 1.255 @Override 1.256 - public void bindingOperationFaultAttributes(final WSDLBoundFault fault, final XMLStreamReader reader) { 1.257 + public void bindingOperationFaultAttributes(final EditableWSDLBoundFault fault, final XMLStreamReader reader) { 1.258 LOGGER.entering(); 1.259 processAttributes(fault, reader, getHandlers4BindingFaultOpMap()); 1.260 LOGGER.exiting(); 1.261 @@ -701,7 +700,7 @@ 1.262 // may otherwise be multiple entries for policies that are contained 1.263 // by fault messages. 1.264 HashSet<BuilderHandlerMessageScope> messageSet = new HashSet<BuilderHandlerMessageScope>(); 1.265 - for (WSDLService service : context.getWSDLModel().getServices().values()) { 1.266 + for (EditableWSDLService service : context.getWSDLModel().getServices().values()) { 1.267 if (getHandlers4ServiceMap().containsKey(service)) { 1.268 getPolicyMapBuilder().registerHandler(new BuilderHandlerServiceScope( 1.269 getPolicyURIs(getHandlers4ServiceMap().get(service),modelContext) 1.270 @@ -711,7 +710,7 @@ 1.271 } 1.272 // end service scope 1.273 1.274 - for (WSDLPort port : service.getPorts()) { 1.275 + for (EditableWSDLPort port : service.getPorts()) { 1.276 if (getHandlers4PortMap().containsKey(port)) { 1.277 getPolicyMapBuilder().registerHandler( 1.278 new BuilderHandlerEndpointScope( 1.279 @@ -747,9 +746,9 @@ 1.280 } // endif handler for port type 1.281 // end endpoint scope 1.282 1.283 - for (WSDLBoundOperation boundOperation : port.getBinding().getBindingOperations()) { 1.284 + for (EditableWSDLBoundOperation boundOperation : port.getBinding().getBindingOperations()) { 1.285 1.286 - final WSDLOperation operation = boundOperation.getOperation(); 1.287 + final EditableWSDLOperation operation = boundOperation.getOperation(); 1.288 final QName operationName = new QName(boundOperation.getBoundPortType().getName().getNamespaceURI(), boundOperation.getName().getLocalPart()); 1.289 // We store the message and portType/operation under the same namespace as the binding/operation so that we can match them up later 1.290 if ( // handler for operation scope -- by boundOperation 1.291 @@ -778,9 +777,9 @@ 1.292 } // endif for portType:operation scope 1.293 // end operation scope 1.294 1.295 - final WSDLInput input = operation.getInput(); 1.296 + final EditableWSDLInput input = operation.getInput(); 1.297 if (null!=input) { 1.298 - WSDLMessage inputMsg = input.getMessage(); 1.299 + EditableWSDLMessage inputMsg = input.getMessage(); 1.300 if (inputMsg != null && getHandlers4MessageMap().containsKey(inputMsg)) { 1.301 messageSet.add(new BuilderHandlerMessageScope( 1.302 getPolicyURIs( 1.303 @@ -825,9 +824,9 @@ 1.304 } // endif portType op input msg 1.305 // end input message scope 1.306 1.307 - final WSDLOutput output = operation.getOutput(); 1.308 + final EditableWSDLOutput output = operation.getOutput(); 1.309 if (null!=output) { 1.310 - WSDLMessage outputMsg = output.getMessage(); 1.311 + EditableWSDLMessage outputMsg = output.getMessage(); 1.312 if (outputMsg != null && getHandlers4MessageMap().containsKey(outputMsg)) { 1.313 messageSet.add(new BuilderHandlerMessageScope( 1.314 getPolicyURIs( 1.315 @@ -872,8 +871,8 @@ 1.316 } // endif portType op output msg 1.317 // end output message scope 1.318 1.319 - for (WSDLBoundFault boundFault : boundOperation.getFaults()) { 1.320 - final WSDLFault fault = boundFault.getFault(); 1.321 + for (EditableWSDLBoundFault boundFault : boundOperation.getFaults()) { 1.322 + final EditableWSDLFault fault = boundFault.getFault(); 1.323 1.324 // this shouldn't happen ususally, 1.325 // but since this scenario tested in lagacy tests, dont' fail here 1.326 @@ -882,7 +881,7 @@ 1.327 continue; 1.328 } 1.329 1.330 - final WSDLMessage faultMessage = fault.getMessage(); 1.331 + final EditableWSDLMessage faultMessage = fault.getMessage(); 1.332 final QName faultName = new QName(boundOperation.getBoundPortType().getName().getNamespaceURI(), boundFault.getName()); 1.333 // We store the message and portType/fault under the same namespace as the binding/fault so that we can match them up later 1.334 if (faultMessage != null && getHandlers4MessageMap().containsKey(faultMessage)) { 1.335 @@ -948,14 +947,14 @@ 1.336 @Override 1.337 public void postFinished(final WSDLParserExtensionContext context) { 1.338 // finally register the PolicyMap on the WSDLModel 1.339 - WSDLModel wsdlModel = context.getWSDLModel(); 1.340 + EditableWSDLModel wsdlModel = context.getWSDLModel(); 1.341 PolicyMap effectiveMap; 1.342 try { 1.343 if(context.isClientSide()) 1.344 effectiveMap = context.getPolicyResolver().resolve(new PolicyResolver.ClientContext(policyBuilder.getPolicyMap(),context.getContainer())); 1.345 else 1.346 effectiveMap = context.getPolicyResolver().resolve(new PolicyResolver.ServerContext(policyBuilder.getPolicyMap(), context.getContainer(),null)); 1.347 - ((WSDLModelImpl) wsdlModel).setPolicyMap(effectiveMap); 1.348 + wsdlModel.setPolicyMap(effectiveMap); 1.349 } catch (PolicyException e) { 1.350 LOGGER.logSevereException(e); 1.351 throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1007_POLICY_EXCEPTION_WHILE_FINISHING_PARSING_WSDL(), e));