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