Fri, 22 Nov 2013 21:11:19 +0100
8010935: Better XML handling
8027378: Two closed/javax/xml/8005432 fails with jdk7u51b04
8028382: Two javax/xml/8005433 tests still fail after the fix JDK-8028147
Summary: base fix + fixes for test regressions; fix also reviewed by Maxim Soloviev, Alexander Fomin
Reviewed-by: mchung, mgrebac, mullan
ohair@286 | 1 | /* |
alanb@368 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.ws.model; |
ohair@286 | 27 | |
ohair@286 | 28 | import com.sun.istack.internal.NotNull; |
ohair@286 | 29 | import com.sun.xml.internal.bind.api.Bridge; |
ohair@286 | 30 | import com.sun.xml.internal.bind.api.JAXBRIContext; |
ohair@286 | 31 | import com.sun.xml.internal.bind.api.TypeReference; |
ohair@286 | 32 | import com.sun.xml.internal.ws.api.BindingID; |
ohair@286 | 33 | import com.sun.xml.internal.ws.api.WSBinding; |
ohair@286 | 34 | import com.sun.xml.internal.ws.api.databinding.Databinding; |
ohair@286 | 35 | import com.sun.xml.internal.ws.api.model.JavaMethod; |
ohair@286 | 36 | import com.sun.xml.internal.ws.api.model.ParameterBinding; |
ohair@286 | 37 | import com.sun.xml.internal.ws.api.model.SEIModel; |
ohair@286 | 38 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel; |
ohair@286 | 39 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
ohair@286 | 40 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLPart; |
ohair@286 | 41 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType; |
ohair@286 | 42 | import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; |
ohair@286 | 43 | import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants; |
ohair@286 | 44 | import com.sun.xml.internal.ws.resources.ModelerMessages; |
ohair@286 | 45 | import com.sun.xml.internal.ws.spi.db.BindingContext; |
ohair@286 | 46 | import com.sun.xml.internal.ws.spi.db.BindingContextFactory; |
ohair@286 | 47 | import com.sun.xml.internal.ws.spi.db.BindingInfo; |
ohair@286 | 48 | import com.sun.xml.internal.ws.spi.db.XMLBridge; |
ohair@286 | 49 | import com.sun.xml.internal.ws.spi.db.TypeInfo; |
ohair@286 | 50 | import com.sun.xml.internal.ws.util.Pool; |
ohair@286 | 51 | import com.sun.xml.internal.ws.developer.UsesJAXBContextFeature; |
ohair@286 | 52 | import com.sun.xml.internal.ws.developer.JAXBContextFactory; |
ohair@286 | 53 | import com.sun.xml.internal.ws.binding.WebServiceFeatureList; |
ohair@286 | 54 | |
ohair@286 | 55 | import javax.jws.WebParam.Mode; |
ohair@286 | 56 | import javax.xml.bind.JAXBContext; |
ohair@286 | 57 | import javax.xml.bind.annotation.XmlSeeAlso; |
ohair@286 | 58 | import javax.xml.namespace.QName; |
ohair@286 | 59 | import javax.xml.ws.WebServiceException; |
ohair@286 | 60 | |
ohair@286 | 61 | |
ohair@286 | 62 | import java.lang.reflect.Method; |
ohair@286 | 63 | import java.security.AccessController; |
ohair@286 | 64 | import java.security.PrivilegedActionException; |
ohair@286 | 65 | import java.security.PrivilegedExceptionAction; |
ohair@286 | 66 | import java.util.ArrayList; |
ohair@286 | 67 | import java.util.Collection; |
ohair@286 | 68 | import java.util.Collections; |
ohair@286 | 69 | import java.util.HashMap; |
ohair@286 | 70 | import java.util.List; |
ohair@286 | 71 | import java.util.Map; |
ohair@286 | 72 | import java.util.logging.Level; |
ohair@286 | 73 | import java.util.logging.Logger; |
ohair@286 | 74 | |
ohair@286 | 75 | /** |
ohair@286 | 76 | * model of the web service. Used by the runtime marshall/unmarshall |
ohair@286 | 77 | * web service invocations |
ohair@286 | 78 | * |
ohair@286 | 79 | * @author JAXWS Development Team |
ohair@286 | 80 | */ |
ohair@286 | 81 | public abstract class AbstractSEIModelImpl implements SEIModel { |
ohair@286 | 82 | |
ohair@286 | 83 | protected AbstractSEIModelImpl(WebServiceFeatureList features) { |
ohair@286 | 84 | this.features = features; |
ohair@286 | 85 | databindingInfo = new BindingInfo(); |
ohair@286 | 86 | databindingInfo.setSEIModel(this); |
ohair@286 | 87 | } |
ohair@286 | 88 | |
ohair@286 | 89 | void postProcess() { |
ohair@286 | 90 | // should be called only once. |
alanb@368 | 91 | if (jaxbContext != null) { |
ohair@286 | 92 | return; |
alanb@368 | 93 | } |
ohair@286 | 94 | populateMaps(); |
ohair@286 | 95 | createJAXBContext(); |
ohair@286 | 96 | } |
ohair@286 | 97 | |
ohair@286 | 98 | /** |
ohair@286 | 99 | * Link {@link SEIModel} to {@link WSDLModel}. |
ohair@286 | 100 | * Merge it with {@link #postProcess()}. |
ohair@286 | 101 | */ |
ohair@286 | 102 | public void freeze(WSDLPort port) { |
ohair@286 | 103 | this.port = port; |
ohair@286 | 104 | for (JavaMethodImpl m : javaMethods) { |
ohair@286 | 105 | m.freeze(port); |
ohair@286 | 106 | putOp(m.getOperationQName(),m); |
ohair@286 | 107 | |
ohair@286 | 108 | } |
alanb@368 | 109 | if (databinding != null) { |
alanb@368 | 110 | ((com.sun.xml.internal.ws.db.DatabindingImpl)databinding).freeze(port); |
alanb@368 | 111 | } |
ohair@286 | 112 | } |
ohair@286 | 113 | |
ohair@286 | 114 | /** |
ohair@286 | 115 | * Populate methodToJM and nameToJM maps. |
ohair@286 | 116 | */ |
ohair@286 | 117 | abstract protected void populateMaps(); |
ohair@286 | 118 | |
alanb@368 | 119 | @Override |
ohair@286 | 120 | public Pool.Marshaller getMarshallerPool() { |
ohair@286 | 121 | return marshallers; |
ohair@286 | 122 | } |
ohair@286 | 123 | |
ohair@286 | 124 | /** |
ohair@286 | 125 | * @return the <code>JAXBRIContext</code> |
ohair@286 | 126 | * @deprecated |
ohair@286 | 127 | */ |
alanb@368 | 128 | @Override |
ohair@286 | 129 | public JAXBContext getJAXBContext() { |
ohair@286 | 130 | JAXBContext jc = bindingContext.getJAXBContext(); |
alanb@368 | 131 | if (jc != null) { |
alanb@368 | 132 | return jc; |
alanb@368 | 133 | } |
ohair@286 | 134 | return jaxbContext; |
ohair@286 | 135 | } |
ohair@286 | 136 | |
ohair@286 | 137 | public BindingContext getBindingContext() { |
ohair@286 | 138 | return bindingContext; |
ohair@286 | 139 | } |
ohair@286 | 140 | |
ohair@286 | 141 | /** |
ohair@286 | 142 | * @return the known namespaces from JAXBRIContext |
ohair@286 | 143 | */ |
ohair@286 | 144 | public List<String> getKnownNamespaceURIs() { |
ohair@286 | 145 | return knownNamespaceURIs; |
ohair@286 | 146 | } |
ohair@286 | 147 | |
ohair@286 | 148 | /** |
ohair@286 | 149 | * @return the <code>Bridge</code> for the <code>type</code> |
ohair@286 | 150 | * @deprecated use getBond |
ohair@286 | 151 | */ |
ohair@286 | 152 | public final Bridge getBridge(TypeReference type) { |
ohair@286 | 153 | Bridge b = bridgeMap.get(type); |
ohair@286 | 154 | assert b!=null; // we should have created Bridge for all TypeReferences known to this model |
ohair@286 | 155 | return b; |
ohair@286 | 156 | } |
ohair@286 | 157 | |
ohair@286 | 158 | public final XMLBridge getXMLBridge(TypeInfo type) { |
ohair@286 | 159 | XMLBridge b = xmlBridgeMap.get(type); |
ohair@286 | 160 | assert b!=null; // we should have created Bridge for all TypeReferences known to this model |
ohair@286 | 161 | return b; |
ohair@286 | 162 | } |
ohair@286 | 163 | |
ohair@286 | 164 | private void /*JAXBRIContext*/ createJAXBContext() { |
ohair@286 | 165 | final List<TypeInfo> types = getAllTypeInfos(); |
ohair@286 | 166 | final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size()); |
ohair@286 | 167 | |
ohair@286 | 168 | cls.addAll(additionalClasses); |
alanb@368 | 169 | for (TypeInfo type : types) { |
ohair@286 | 170 | cls.add((Class) type.type); |
alanb@368 | 171 | } |
ohair@286 | 172 | |
ohair@286 | 173 | try { |
ohair@286 | 174 | //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false); |
ohair@286 | 175 | // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above |
ohair@286 | 176 | bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() { |
ohair@286 | 177 | public BindingContext run() throws Exception { |
ohair@286 | 178 | if(LOGGER.isLoggable(Level.FINEST)) { |
alanb@368 | 179 | LOGGER.log(Level.FINEST, "Creating JAXBContext with classes={0} and types={1}", new Object[]{cls, types}); |
ohair@286 | 180 | } |
ohair@286 | 181 | UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class); |
alanb@368 | 182 | com.oracle.webservices.internal.api.databinding.DatabindingModeFeature dmf = |
alanb@368 | 183 | features.get(com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class); |
ohair@286 | 184 | JAXBContextFactory factory = f!=null ? f.getFactory() : null; |
ohair@286 | 185 | if(factory==null) factory=JAXBContextFactory.DEFAULT; |
ohair@286 | 186 | |
ohair@286 | 187 | // return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types); |
ohair@286 | 188 | |
ohair@286 | 189 | databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory); |
alanb@368 | 190 | if (dmf != null) { |
ohair@286 | 191 | if (LOGGER.isLoggable(Level.FINE)) |
alanb@368 | 192 | LOGGER.log(Level.FINE, "DatabindingModeFeature in SEI specifies mode: {0}", dmf.getMode()); |
alanb@368 | 193 | databindingInfo.setDatabindingMode(dmf |
ohair@286 | 194 | .getMode()); |
ohair@286 | 195 | } |
ohair@286 | 196 | |
ohair@286 | 197 | if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode); |
ohair@286 | 198 | databindingInfo.setClassLoader(classLoader); |
ohair@286 | 199 | databindingInfo.contentClasses().addAll(cls); |
ohair@286 | 200 | databindingInfo.typeInfos().addAll(types); |
ohair@286 | 201 | databindingInfo.properties().put("c14nSupport", Boolean.FALSE); |
alanb@368 | 202 | databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getDefaultSchemaNamespace()); |
ohair@286 | 203 | BindingContext bc = BindingContextFactory.create(databindingInfo); |
ohair@286 | 204 | if (LOGGER.isLoggable(Level.FINE)) |
ohair@286 | 205 | LOGGER.log(Level.FINE, |
ohair@286 | 206 | "Created binding context: " |
ohair@286 | 207 | + bc.getClass().getName()); |
ohair@286 | 208 | // System.out.println("---------------------- databinding " + bc); |
ohair@286 | 209 | return bc; |
ohair@286 | 210 | } |
ohair@286 | 211 | }); |
ohair@286 | 212 | // createBridgeMap(types); |
ohair@286 | 213 | createBondMap(types); |
ohair@286 | 214 | } catch (PrivilegedActionException e) { |
ohair@286 | 215 | throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e); |
ohair@286 | 216 | } |
ohair@286 | 217 | knownNamespaceURIs = new ArrayList<String>(); |
ohair@286 | 218 | for (String namespace : bindingContext.getKnownNamespaceURIs()) { |
ohair@286 | 219 | if (namespace.length() > 0) { |
ohair@286 | 220 | if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS)) |
ohair@286 | 221 | knownNamespaceURIs.add(namespace); |
ohair@286 | 222 | } |
ohair@286 | 223 | } |
ohair@286 | 224 | |
ohair@286 | 225 | marshallers = new Pool.Marshaller(jaxbContext); |
ohair@286 | 226 | |
ohair@286 | 227 | //return getJAXBContext(); |
ohair@286 | 228 | } |
ohair@286 | 229 | |
ohair@286 | 230 | /** |
ohair@286 | 231 | * @return returns non-null list of TypeReference |
ohair@286 | 232 | */ |
ohair@286 | 233 | private List<TypeInfo> getAllTypeInfos() { |
ohair@286 | 234 | List<TypeInfo> types = new ArrayList<TypeInfo>(); |
ohair@286 | 235 | Collection<JavaMethodImpl> methods = methodToJM.values(); |
ohair@286 | 236 | for (JavaMethodImpl m : methods) { |
ohair@286 | 237 | m.fillTypes(types); |
ohair@286 | 238 | } |
ohair@286 | 239 | return types; |
ohair@286 | 240 | } |
ohair@286 | 241 | |
ohair@286 | 242 | private void createBridgeMap(List<TypeReference> types) { |
ohair@286 | 243 | for (TypeReference type : types) { |
ohair@286 | 244 | Bridge bridge = jaxbContext.createBridge(type); |
ohair@286 | 245 | bridgeMap.put(type, bridge); |
ohair@286 | 246 | } |
ohair@286 | 247 | } |
ohair@286 | 248 | private void createBondMap(List<TypeInfo> types) { |
ohair@286 | 249 | for (TypeInfo type : types) { |
ohair@286 | 250 | XMLBridge binding = bindingContext.createBridge(type); |
ohair@286 | 251 | xmlBridgeMap.put(type, binding); |
ohair@286 | 252 | } |
ohair@286 | 253 | } |
ohair@286 | 254 | |
ohair@286 | 255 | |
ohair@286 | 256 | /** |
ohair@286 | 257 | * @return true if <code>name</code> is the name |
ohair@286 | 258 | * of a known fault name for the <code>Method method</code> |
ohair@286 | 259 | */ |
ohair@286 | 260 | public boolean isKnownFault(QName name, Method method) { |
ohair@286 | 261 | JavaMethodImpl m = getJavaMethod(method); |
ohair@286 | 262 | for (CheckedExceptionImpl ce : m.getCheckedExceptions()) { |
ohair@286 | 263 | if (ce.getDetailType().tagName.equals(name)) |
ohair@286 | 264 | return true; |
ohair@286 | 265 | } |
ohair@286 | 266 | return false; |
ohair@286 | 267 | } |
ohair@286 | 268 | |
ohair@286 | 269 | /** |
ohair@286 | 270 | * @return true if <code>ex</code> is a Checked Exception |
ohair@286 | 271 | * for <code>Method m</code> |
ohair@286 | 272 | */ |
ohair@286 | 273 | public boolean isCheckedException(Method m, Class ex) { |
ohair@286 | 274 | JavaMethodImpl jm = getJavaMethod(m); |
ohair@286 | 275 | for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) { |
ohair@286 | 276 | if (ce.getExceptionClass().equals(ex)) |
ohair@286 | 277 | return true; |
ohair@286 | 278 | } |
ohair@286 | 279 | return false; |
ohair@286 | 280 | } |
ohair@286 | 281 | |
ohair@286 | 282 | /** |
ohair@286 | 283 | * @return the <code>JavaMethod</code> representing the <code>method</code> |
ohair@286 | 284 | */ |
ohair@286 | 285 | public JavaMethodImpl getJavaMethod(Method method) { |
ohair@286 | 286 | return methodToJM.get(method); |
ohair@286 | 287 | } |
ohair@286 | 288 | |
ohair@286 | 289 | /** |
ohair@286 | 290 | * @return the <code>JavaMethod</code> associated with the |
ohair@286 | 291 | * operation named name |
ohair@286 | 292 | */ |
ohair@286 | 293 | public JavaMethodImpl getJavaMethod(QName name) { |
ohair@286 | 294 | return nameToJM.get(name); |
ohair@286 | 295 | } |
ohair@286 | 296 | |
ohair@286 | 297 | public JavaMethod getJavaMethodForWsdlOperation(QName operationName) { |
ohair@286 | 298 | return wsdlOpToJM.get(operationName); |
ohair@286 | 299 | } |
ohair@286 | 300 | |
ohair@286 | 301 | |
ohair@286 | 302 | /** |
ohair@286 | 303 | * @return the <code>QName</code> associated with the |
ohair@286 | 304 | * JavaMethod jm. |
ohair@286 | 305 | * |
ohair@286 | 306 | * @deprecated |
ohair@286 | 307 | * Use {@link JavaMethod#getOperationName()}. |
ohair@286 | 308 | */ |
ohair@286 | 309 | public QName getQNameForJM(JavaMethodImpl jm) { |
ohair@286 | 310 | for (QName key : nameToJM.keySet()) { |
ohair@286 | 311 | JavaMethodImpl jmethod = nameToJM.get(key); |
ohair@286 | 312 | if (jmethod.getOperationName().equals(jm.getOperationName())){ |
ohair@286 | 313 | return key; |
ohair@286 | 314 | } |
ohair@286 | 315 | } |
ohair@286 | 316 | return null; |
ohair@286 | 317 | } |
ohair@286 | 318 | |
ohair@286 | 319 | /** |
ohair@286 | 320 | * @return a <code>Collection</code> of <code>JavaMethods</code> |
ohair@286 | 321 | * associated with this <code>RuntimeModel</code> |
ohair@286 | 322 | */ |
ohair@286 | 323 | public final Collection<JavaMethodImpl> getJavaMethods() { |
ohair@286 | 324 | return Collections.unmodifiableList(javaMethods); |
ohair@286 | 325 | } |
ohair@286 | 326 | |
ohair@286 | 327 | void addJavaMethod(JavaMethodImpl jm) { |
ohair@286 | 328 | if (jm != null) |
ohair@286 | 329 | javaMethods.add(jm); |
ohair@286 | 330 | } |
ohair@286 | 331 | |
ohair@286 | 332 | /** |
alanb@368 | 333 | * Applies binding related information to the RpcLitPayload. The payload map is populated correctly |
ohair@286 | 334 | * @return |
ohair@286 | 335 | * Returns attachment parameters if/any. |
ohair@286 | 336 | */ |
ohair@286 | 337 | private List<ParameterImpl> applyRpcLitParamBinding(JavaMethodImpl method, WrapperParameter wrapperParameter, WSDLBoundPortType boundPortType, Mode mode) { |
ohair@286 | 338 | QName opName = new QName(boundPortType.getPortTypeName().getNamespaceURI(), method.getOperationName()); |
ohair@286 | 339 | WSDLBoundOperation bo = boundPortType.get(opName); |
ohair@286 | 340 | Map<Integer, ParameterImpl> bodyParams = new HashMap<Integer, ParameterImpl>(); |
ohair@286 | 341 | List<ParameterImpl> unboundParams = new ArrayList<ParameterImpl>(); |
ohair@286 | 342 | List<ParameterImpl> attachParams = new ArrayList<ParameterImpl>(); |
ohair@286 | 343 | for(ParameterImpl param : wrapperParameter.wrapperChildren){ |
ohair@286 | 344 | String partName = param.getPartName(); |
ohair@286 | 345 | if(partName == null) |
ohair@286 | 346 | continue; |
ohair@286 | 347 | |
ohair@286 | 348 | ParameterBinding paramBinding = boundPortType.getBinding(opName, |
ohair@286 | 349 | partName, mode); |
ohair@286 | 350 | if(paramBinding != null){ |
ohair@286 | 351 | if(mode == Mode.IN) |
ohair@286 | 352 | param.setInBinding(paramBinding); |
ohair@286 | 353 | else if(mode == Mode.OUT || mode == Mode.INOUT) |
ohair@286 | 354 | param.setOutBinding(paramBinding); |
ohair@286 | 355 | |
ohair@286 | 356 | if(paramBinding.isUnbound()){ |
ohair@286 | 357 | unboundParams.add(param); |
ohair@286 | 358 | } else if(paramBinding.isAttachment()){ |
ohair@286 | 359 | attachParams.add(param); |
ohair@286 | 360 | }else if(paramBinding.isBody()){ |
ohair@286 | 361 | if(bo != null){ |
ohair@286 | 362 | WSDLPart p = bo.getPart(param.getPartName(), mode); |
ohair@286 | 363 | if(p != null) |
ohair@286 | 364 | bodyParams.put(p.getIndex(), param); |
ohair@286 | 365 | else |
ohair@286 | 366 | bodyParams.put(bodyParams.size(), param); |
ohair@286 | 367 | }else{ |
ohair@286 | 368 | bodyParams.put(bodyParams.size(), param); |
ohair@286 | 369 | } |
ohair@286 | 370 | } |
ohair@286 | 371 | } |
ohair@286 | 372 | |
ohair@286 | 373 | } |
ohair@286 | 374 | wrapperParameter.clear(); |
ohair@286 | 375 | for(int i = 0; i < bodyParams.size();i++){ |
ohair@286 | 376 | ParameterImpl p = bodyParams.get(i); |
ohair@286 | 377 | wrapperParameter.addWrapperChild(p); |
ohair@286 | 378 | } |
ohair@286 | 379 | |
ohair@286 | 380 | //add unbounded parts |
ohair@286 | 381 | for(ParameterImpl p:unboundParams){ |
ohair@286 | 382 | wrapperParameter.addWrapperChild(p); |
ohair@286 | 383 | } |
ohair@286 | 384 | return attachParams; |
ohair@286 | 385 | } |
ohair@286 | 386 | |
ohair@286 | 387 | |
ohair@286 | 388 | void put(QName name, JavaMethodImpl jm) { |
ohair@286 | 389 | nameToJM.put(name, jm); |
ohair@286 | 390 | } |
ohair@286 | 391 | |
ohair@286 | 392 | void put(Method method, JavaMethodImpl jm) { |
ohair@286 | 393 | methodToJM.put(method, jm); |
ohair@286 | 394 | } |
ohair@286 | 395 | |
ohair@286 | 396 | void putOp(QName opName, JavaMethodImpl jm) { |
ohair@286 | 397 | wsdlOpToJM.put(opName, jm); |
ohair@286 | 398 | } |
ohair@286 | 399 | public String getWSDLLocation() { |
ohair@286 | 400 | return wsdlLocation; |
ohair@286 | 401 | } |
ohair@286 | 402 | |
ohair@286 | 403 | void setWSDLLocation(String location) { |
ohair@286 | 404 | wsdlLocation = location; |
ohair@286 | 405 | } |
ohair@286 | 406 | |
ohair@286 | 407 | public QName getServiceQName() { |
ohair@286 | 408 | return serviceName; |
ohair@286 | 409 | } |
ohair@286 | 410 | |
ohair@286 | 411 | public WSDLPort getPort() { |
ohair@286 | 412 | return port; |
ohair@286 | 413 | } |
ohair@286 | 414 | |
ohair@286 | 415 | public QName getPortName() { |
ohair@286 | 416 | return portName; |
ohair@286 | 417 | } |
ohair@286 | 418 | |
ohair@286 | 419 | public QName getPortTypeName() { |
ohair@286 | 420 | return portTypeName; |
ohair@286 | 421 | } |
ohair@286 | 422 | |
ohair@286 | 423 | void setServiceQName(QName name) { |
ohair@286 | 424 | serviceName = name; |
ohair@286 | 425 | } |
ohair@286 | 426 | |
ohair@286 | 427 | void setPortName(QName name) { |
ohair@286 | 428 | portName = name; |
ohair@286 | 429 | } |
ohair@286 | 430 | |
ohair@286 | 431 | void setPortTypeName(QName name) { |
ohair@286 | 432 | portTypeName = name; |
ohair@286 | 433 | } |
ohair@286 | 434 | |
ohair@286 | 435 | /** |
ohair@286 | 436 | * This is the targetNamespace for the WSDL containing the PortType |
ohair@286 | 437 | * definition |
ohair@286 | 438 | */ |
ohair@286 | 439 | void setTargetNamespace(String namespace) { |
ohair@286 | 440 | targetNamespace = namespace; |
ohair@286 | 441 | } |
ohair@286 | 442 | |
ohair@286 | 443 | /** |
ohair@286 | 444 | * This is the targetNamespace for the WSDL containing the PortType |
ohair@286 | 445 | * definition |
ohair@286 | 446 | */ |
ohair@286 | 447 | public String getTargetNamespace() { |
ohair@286 | 448 | return targetNamespace; |
ohair@286 | 449 | } |
ohair@286 | 450 | |
alanb@368 | 451 | String getDefaultSchemaNamespace() { |
alanb@368 | 452 | String defaultNamespace = getTargetNamespace(); |
alanb@368 | 453 | if (defaultSchemaNamespaceSuffix == null) return defaultNamespace; |
alanb@368 | 454 | if (!defaultNamespace.endsWith("/")) { |
alanb@368 | 455 | defaultNamespace += "/"; |
alanb@368 | 456 | } |
alanb@368 | 457 | return (defaultNamespace + defaultSchemaNamespaceSuffix); |
alanb@368 | 458 | } |
alanb@368 | 459 | |
ohair@286 | 460 | @NotNull |
ohair@286 | 461 | public QName getBoundPortTypeName() { |
ohair@286 | 462 | assert portName != null; |
ohair@286 | 463 | return new QName(portName.getNamespaceURI(), portName.getLocalPart()+"Binding"); |
ohair@286 | 464 | } |
ohair@286 | 465 | |
ohair@286 | 466 | /** |
ohair@286 | 467 | * Adds additional classes obtained from {@link XmlSeeAlso} annotation. In starting |
ohair@286 | 468 | * from wsdl case these classes would most likely be JAXB ObjectFactory that references other classes. |
ohair@286 | 469 | */ |
ohair@286 | 470 | public void addAdditionalClasses(Class... additionalClasses) { |
ohair@286 | 471 | for(Class cls : additionalClasses) |
ohair@286 | 472 | this.additionalClasses.add(cls); |
ohair@286 | 473 | } |
ohair@286 | 474 | |
ohair@286 | 475 | public Databinding getDatabinding() { |
ohair@286 | 476 | return databinding; |
ohair@286 | 477 | } |
ohair@286 | 478 | |
ohair@286 | 479 | public void setDatabinding(Databinding wsRuntime) { |
ohair@286 | 480 | this.databinding = wsRuntime; |
ohair@286 | 481 | } |
ohair@286 | 482 | |
ohair@286 | 483 | public WSBinding getWSBinding() { |
ohair@286 | 484 | return wsBinding; |
ohair@286 | 485 | } |
ohair@286 | 486 | |
ohair@286 | 487 | public Class getContractClass() { |
ohair@286 | 488 | return contractClass; |
ohair@286 | 489 | } |
ohair@286 | 490 | |
ohair@286 | 491 | public Class getEndpointClass() { |
ohair@286 | 492 | return endpointClass; |
ohair@286 | 493 | } |
ohair@286 | 494 | |
ohair@286 | 495 | private List<Class> additionalClasses = new ArrayList<Class>(); |
ohair@286 | 496 | |
ohair@286 | 497 | private Pool.Marshaller marshallers; |
ohair@286 | 498 | /** |
ohair@286 | 499 | * @deprecated |
ohair@286 | 500 | */ |
ohair@286 | 501 | protected JAXBRIContext jaxbContext; |
ohair@286 | 502 | protected BindingContext bindingContext; |
ohair@286 | 503 | private String wsdlLocation; |
ohair@286 | 504 | private QName serviceName; |
ohair@286 | 505 | private QName portName; |
ohair@286 | 506 | private QName portTypeName; |
ohair@286 | 507 | private Map<Method,JavaMethodImpl> methodToJM = new HashMap<Method, JavaMethodImpl>(); |
ohair@286 | 508 | /** |
ohair@286 | 509 | * Payload QName to the method that handles it. |
ohair@286 | 510 | */ |
ohair@286 | 511 | private Map<QName,JavaMethodImpl> nameToJM = new HashMap<QName, JavaMethodImpl>(); |
ohair@286 | 512 | /** |
ohair@286 | 513 | * Wsdl Operation QName to the method that handles it. |
ohair@286 | 514 | */ |
ohair@286 | 515 | private Map<QName, JavaMethodImpl> wsdlOpToJM = new HashMap<QName, JavaMethodImpl>(); |
ohair@286 | 516 | |
ohair@286 | 517 | private List<JavaMethodImpl> javaMethods = new ArrayList<JavaMethodImpl>(); |
ohair@286 | 518 | private final Map<TypeReference, Bridge> bridgeMap = new HashMap<TypeReference, Bridge>(); |
ohair@286 | 519 | private final Map<TypeInfo, XMLBridge> xmlBridgeMap = new HashMap<TypeInfo, XMLBridge>(); |
ohair@286 | 520 | protected final QName emptyBodyName = new QName(""); |
ohair@286 | 521 | private String targetNamespace = ""; |
ohair@286 | 522 | private List<String> knownNamespaceURIs = null; |
ohair@286 | 523 | private WSDLPort port; |
ohair@286 | 524 | private final WebServiceFeatureList features; |
ohair@286 | 525 | private Databinding databinding; |
ohair@286 | 526 | BindingID bindingId; |
ohair@286 | 527 | protected Class contractClass; |
ohair@286 | 528 | protected Class endpointClass; |
ohair@286 | 529 | protected ClassLoader classLoader = null; |
ohair@286 | 530 | protected WSBinding wsBinding; |
ohair@286 | 531 | protected BindingInfo databindingInfo; |
alanb@368 | 532 | protected String defaultSchemaNamespaceSuffix; |
ohair@286 | 533 | private static final Logger LOGGER = Logger.getLogger(AbstractSEIModelImpl.class.getName()); |
ohair@286 | 534 | } |