Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
ohair@286 | 1 | /* |
ohair@286 | 2 | * Copyright (c) 1997, 2011, 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 | import javax.xml.ws.WebServiceFeature; |
ohair@286 | 61 | |
ohair@286 | 62 | import com.sun.xml.internal.org.jvnet.ws.databinding.DatabindingModeFeature; |
ohair@286 | 63 | |
ohair@286 | 64 | import java.lang.reflect.Method; |
ohair@286 | 65 | import java.security.AccessController; |
ohair@286 | 66 | import java.security.PrivilegedActionException; |
ohair@286 | 67 | import java.security.PrivilegedExceptionAction; |
ohair@286 | 68 | import java.util.ArrayList; |
ohair@286 | 69 | import java.util.Collection; |
ohair@286 | 70 | import java.util.Collections; |
ohair@286 | 71 | import java.util.HashMap; |
ohair@286 | 72 | import java.util.List; |
ohair@286 | 73 | import java.util.Map; |
ohair@286 | 74 | import java.util.logging.Level; |
ohair@286 | 75 | import java.util.logging.Logger; |
ohair@286 | 76 | |
ohair@286 | 77 | /** |
ohair@286 | 78 | * model of the web service. Used by the runtime marshall/unmarshall |
ohair@286 | 79 | * web service invocations |
ohair@286 | 80 | * |
ohair@286 | 81 | * @author JAXWS Development Team |
ohair@286 | 82 | */ |
ohair@286 | 83 | public abstract class AbstractSEIModelImpl implements SEIModel { |
ohair@286 | 84 | |
ohair@286 | 85 | protected AbstractSEIModelImpl(WebServiceFeatureList features) { |
ohair@286 | 86 | this.features = features; |
ohair@286 | 87 | databindingInfo = new BindingInfo(); |
ohair@286 | 88 | databindingInfo.setSEIModel(this); |
ohair@286 | 89 | } |
ohair@286 | 90 | |
ohair@286 | 91 | void postProcess() { |
ohair@286 | 92 | // should be called only once. |
ohair@286 | 93 | if (jaxbContext != null) |
ohair@286 | 94 | return; |
ohair@286 | 95 | populateMaps(); |
ohair@286 | 96 | createJAXBContext(); |
ohair@286 | 97 | } |
ohair@286 | 98 | |
ohair@286 | 99 | /** |
ohair@286 | 100 | * Link {@link SEIModel} to {@link WSDLModel}. |
ohair@286 | 101 | * Merge it with {@link #postProcess()}. |
ohair@286 | 102 | */ |
ohair@286 | 103 | public void freeze(WSDLPort port) { |
ohair@286 | 104 | this.port = port; |
ohair@286 | 105 | for (JavaMethodImpl m : javaMethods) { |
ohair@286 | 106 | m.freeze(port); |
ohair@286 | 107 | putOp(m.getOperationQName(),m); |
ohair@286 | 108 | |
ohair@286 | 109 | } |
ohair@286 | 110 | if (databinding != null) ((com.sun.xml.internal.ws.db.DatabindingImpl)databinding).freeze(port); |
ohair@286 | 111 | } |
ohair@286 | 112 | |
ohair@286 | 113 | /** |
ohair@286 | 114 | * Populate methodToJM and nameToJM maps. |
ohair@286 | 115 | */ |
ohair@286 | 116 | abstract protected void populateMaps(); |
ohair@286 | 117 | |
ohair@286 | 118 | public Pool.Marshaller getMarshallerPool() { |
ohair@286 | 119 | return marshallers; |
ohair@286 | 120 | } |
ohair@286 | 121 | |
ohair@286 | 122 | /** |
ohair@286 | 123 | * @return the <code>JAXBRIContext</code> |
ohair@286 | 124 | * @deprecated |
ohair@286 | 125 | */ |
ohair@286 | 126 | public JAXBContext getJAXBContext() { |
ohair@286 | 127 | JAXBContext jc = bindingContext.getJAXBContext(); |
ohair@286 | 128 | if (jc != null) return jc; |
ohair@286 | 129 | if (jaxbContext == null && jc instanceof JAXBRIContext) jaxbContext = (JAXBRIContext) bindingContext.getJAXBContext(); |
ohair@286 | 130 | return jaxbContext; |
ohair@286 | 131 | } |
ohair@286 | 132 | |
ohair@286 | 133 | public BindingContext getBindingContext() { |
ohair@286 | 134 | return bindingContext; |
ohair@286 | 135 | } |
ohair@286 | 136 | |
ohair@286 | 137 | /** |
ohair@286 | 138 | * @return the known namespaces from JAXBRIContext |
ohair@286 | 139 | */ |
ohair@286 | 140 | public List<String> getKnownNamespaceURIs() { |
ohair@286 | 141 | return knownNamespaceURIs; |
ohair@286 | 142 | } |
ohair@286 | 143 | |
ohair@286 | 144 | /** |
ohair@286 | 145 | * @return the <code>Bridge</code> for the <code>type</code> |
ohair@286 | 146 | * @deprecated use getBond |
ohair@286 | 147 | */ |
ohair@286 | 148 | public final Bridge getBridge(TypeReference type) { |
ohair@286 | 149 | Bridge b = bridgeMap.get(type); |
ohair@286 | 150 | assert b!=null; // we should have created Bridge for all TypeReferences known to this model |
ohair@286 | 151 | return b; |
ohair@286 | 152 | } |
ohair@286 | 153 | |
ohair@286 | 154 | public final XMLBridge getXMLBridge(TypeInfo type) { |
ohair@286 | 155 | XMLBridge b = xmlBridgeMap.get(type); |
ohair@286 | 156 | assert b!=null; // we should have created Bridge for all TypeReferences known to this model |
ohair@286 | 157 | return b; |
ohair@286 | 158 | } |
ohair@286 | 159 | |
ohair@286 | 160 | private void /*JAXBRIContext*/ createJAXBContext() { |
ohair@286 | 161 | final List<TypeInfo> types = getAllTypeInfos(); |
ohair@286 | 162 | final List<Class> cls = new ArrayList<Class>(types.size() + additionalClasses.size()); |
ohair@286 | 163 | |
ohair@286 | 164 | cls.addAll(additionalClasses); |
ohair@286 | 165 | for (TypeInfo type : types) |
ohair@286 | 166 | cls.add((Class) type.type); |
ohair@286 | 167 | |
ohair@286 | 168 | try { |
ohair@286 | 169 | //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace, false); |
ohair@286 | 170 | // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above |
ohair@286 | 171 | bindingContext = AccessController.doPrivileged(new PrivilegedExceptionAction<BindingContext>() { |
ohair@286 | 172 | public BindingContext run() throws Exception { |
ohair@286 | 173 | if(LOGGER.isLoggable(Level.FINEST)) { |
ohair@286 | 174 | LOGGER.log(Level.FINEST,"Creating JAXBContext with classes="+cls+" and types="+types); |
ohair@286 | 175 | } |
ohair@286 | 176 | UsesJAXBContextFeature f = features.get(UsesJAXBContextFeature.class); |
ohair@286 | 177 | DatabindingModeFeature dbf = features.get(DatabindingModeFeature.class); |
ohair@286 | 178 | JAXBContextFactory factory = f!=null ? f.getFactory() : null; |
ohair@286 | 179 | if(factory==null) factory=JAXBContextFactory.DEFAULT; |
ohair@286 | 180 | |
ohair@286 | 181 | // return factory.createJAXBContext(AbstractSEIModelImpl.this,cls,types); |
ohair@286 | 182 | |
ohair@286 | 183 | databindingInfo.properties().put(JAXBContextFactory.class.getName(), factory); |
ohair@286 | 184 | if (dbf != null) { |
ohair@286 | 185 | if (LOGGER.isLoggable(Level.FINE)) |
ohair@286 | 186 | LOGGER.fine("DatabindingModeFeature in SEI specifies mode: " |
ohair@286 | 187 | + dbf.getMode()); |
ohair@286 | 188 | databindingInfo.setDatabindingMode(dbf |
ohair@286 | 189 | .getMode()); |
ohair@286 | 190 | } |
ohair@286 | 191 | |
ohair@286 | 192 | if (f!=null) databindingInfo.setDatabindingMode(BindingContextFactory.DefaultDatabindingMode); |
ohair@286 | 193 | databindingInfo.setClassLoader(classLoader); |
ohair@286 | 194 | databindingInfo.contentClasses().addAll(cls); |
ohair@286 | 195 | databindingInfo.typeInfos().addAll(types); |
ohair@286 | 196 | databindingInfo.properties().put("c14nSupport", Boolean.FALSE); |
ohair@286 | 197 | databindingInfo.setDefaultNamespace(AbstractSEIModelImpl.this.getTargetNamespace()); |
ohair@286 | 198 | BindingContext bc = BindingContextFactory.create(databindingInfo); |
ohair@286 | 199 | if (LOGGER.isLoggable(Level.FINE)) |
ohair@286 | 200 | LOGGER.log(Level.FINE, |
ohair@286 | 201 | "Created binding context: " |
ohair@286 | 202 | + bc.getClass().getName()); |
ohair@286 | 203 | // System.out.println("---------------------- databinding " + bc); |
ohair@286 | 204 | return bc; |
ohair@286 | 205 | } |
ohair@286 | 206 | }); |
ohair@286 | 207 | // createBridgeMap(types); |
ohair@286 | 208 | createBondMap(types); |
ohair@286 | 209 | } catch (PrivilegedActionException e) { |
ohair@286 | 210 | throw new WebServiceException(ModelerMessages.UNABLE_TO_CREATE_JAXB_CONTEXT(), e); |
ohair@286 | 211 | } |
ohair@286 | 212 | knownNamespaceURIs = new ArrayList<String>(); |
ohair@286 | 213 | for (String namespace : bindingContext.getKnownNamespaceURIs()) { |
ohair@286 | 214 | if (namespace.length() > 0) { |
ohair@286 | 215 | if (!namespace.equals(SOAPNamespaceConstants.XSD) && !namespace.equals(SOAPNamespaceConstants.XMLNS)) |
ohair@286 | 216 | knownNamespaceURIs.add(namespace); |
ohair@286 | 217 | } |
ohair@286 | 218 | } |
ohair@286 | 219 | |
ohair@286 | 220 | marshallers = new Pool.Marshaller(jaxbContext); |
ohair@286 | 221 | |
ohair@286 | 222 | //return getJAXBContext(); |
ohair@286 | 223 | } |
ohair@286 | 224 | |
ohair@286 | 225 | /** |
ohair@286 | 226 | * @return returns non-null list of TypeReference |
ohair@286 | 227 | */ |
ohair@286 | 228 | private List<TypeInfo> getAllTypeInfos() { |
ohair@286 | 229 | List<TypeInfo> types = new ArrayList<TypeInfo>(); |
ohair@286 | 230 | Collection<JavaMethodImpl> methods = methodToJM.values(); |
ohair@286 | 231 | for (JavaMethodImpl m : methods) { |
ohair@286 | 232 | m.fillTypes(types); |
ohair@286 | 233 | } |
ohair@286 | 234 | return types; |
ohair@286 | 235 | } |
ohair@286 | 236 | |
ohair@286 | 237 | private void createBridgeMap(List<TypeReference> types) { |
ohair@286 | 238 | for (TypeReference type : types) { |
ohair@286 | 239 | Bridge bridge = jaxbContext.createBridge(type); |
ohair@286 | 240 | bridgeMap.put(type, bridge); |
ohair@286 | 241 | } |
ohair@286 | 242 | } |
ohair@286 | 243 | private void createBondMap(List<TypeInfo> types) { |
ohair@286 | 244 | for (TypeInfo type : types) { |
ohair@286 | 245 | XMLBridge binding = bindingContext.createBridge(type); |
ohair@286 | 246 | xmlBridgeMap.put(type, binding); |
ohair@286 | 247 | } |
ohair@286 | 248 | } |
ohair@286 | 249 | |
ohair@286 | 250 | |
ohair@286 | 251 | /** |
ohair@286 | 252 | * @return true if <code>name</code> is the name |
ohair@286 | 253 | * of a known fault name for the <code>Method method</code> |
ohair@286 | 254 | */ |
ohair@286 | 255 | public boolean isKnownFault(QName name, Method method) { |
ohair@286 | 256 | JavaMethodImpl m = getJavaMethod(method); |
ohair@286 | 257 | for (CheckedExceptionImpl ce : m.getCheckedExceptions()) { |
ohair@286 | 258 | if (ce.getDetailType().tagName.equals(name)) |
ohair@286 | 259 | return true; |
ohair@286 | 260 | } |
ohair@286 | 261 | return false; |
ohair@286 | 262 | } |
ohair@286 | 263 | |
ohair@286 | 264 | /** |
ohair@286 | 265 | * @return true if <code>ex</code> is a Checked Exception |
ohair@286 | 266 | * for <code>Method m</code> |
ohair@286 | 267 | */ |
ohair@286 | 268 | public boolean isCheckedException(Method m, Class ex) { |
ohair@286 | 269 | JavaMethodImpl jm = getJavaMethod(m); |
ohair@286 | 270 | for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) { |
ohair@286 | 271 | if (ce.getExceptionClass().equals(ex)) |
ohair@286 | 272 | return true; |
ohair@286 | 273 | } |
ohair@286 | 274 | return false; |
ohair@286 | 275 | } |
ohair@286 | 276 | |
ohair@286 | 277 | /** |
ohair@286 | 278 | * @return the <code>JavaMethod</code> representing the <code>method</code> |
ohair@286 | 279 | */ |
ohair@286 | 280 | public JavaMethodImpl getJavaMethod(Method method) { |
ohair@286 | 281 | return methodToJM.get(method); |
ohair@286 | 282 | } |
ohair@286 | 283 | |
ohair@286 | 284 | /** |
ohair@286 | 285 | * @return the <code>JavaMethod</code> associated with the |
ohair@286 | 286 | * operation named name |
ohair@286 | 287 | */ |
ohair@286 | 288 | public JavaMethodImpl getJavaMethod(QName name) { |
ohair@286 | 289 | return nameToJM.get(name); |
ohair@286 | 290 | } |
ohair@286 | 291 | |
ohair@286 | 292 | public JavaMethod getJavaMethodForWsdlOperation(QName operationName) { |
ohair@286 | 293 | return wsdlOpToJM.get(operationName); |
ohair@286 | 294 | } |
ohair@286 | 295 | |
ohair@286 | 296 | |
ohair@286 | 297 | /** |
ohair@286 | 298 | * @return the <code>QName</code> associated with the |
ohair@286 | 299 | * JavaMethod jm. |
ohair@286 | 300 | * |
ohair@286 | 301 | * @deprecated |
ohair@286 | 302 | * Use {@link JavaMethod#getOperationName()}. |
ohair@286 | 303 | */ |
ohair@286 | 304 | public QName getQNameForJM(JavaMethodImpl jm) { |
ohair@286 | 305 | for (QName key : nameToJM.keySet()) { |
ohair@286 | 306 | JavaMethodImpl jmethod = nameToJM.get(key); |
ohair@286 | 307 | if (jmethod.getOperationName().equals(jm.getOperationName())){ |
ohair@286 | 308 | return key; |
ohair@286 | 309 | } |
ohair@286 | 310 | } |
ohair@286 | 311 | return null; |
ohair@286 | 312 | } |
ohair@286 | 313 | |
ohair@286 | 314 | /** |
ohair@286 | 315 | * @return a <code>Collection</code> of <code>JavaMethods</code> |
ohair@286 | 316 | * associated with this <code>RuntimeModel</code> |
ohair@286 | 317 | */ |
ohair@286 | 318 | public final Collection<JavaMethodImpl> getJavaMethods() { |
ohair@286 | 319 | return Collections.unmodifiableList(javaMethods); |
ohair@286 | 320 | } |
ohair@286 | 321 | |
ohair@286 | 322 | void addJavaMethod(JavaMethodImpl jm) { |
ohair@286 | 323 | if (jm != null) |
ohair@286 | 324 | javaMethods.add(jm); |
ohair@286 | 325 | } |
ohair@286 | 326 | |
ohair@286 | 327 | /** |
ohair@286 | 328 | * Applies binding related information to the RpcLitPayload. The payload map is populated correctl |
ohair@286 | 329 | * @return |
ohair@286 | 330 | * Returns attachment parameters if/any. |
ohair@286 | 331 | */ |
ohair@286 | 332 | private List<ParameterImpl> applyRpcLitParamBinding(JavaMethodImpl method, WrapperParameter wrapperParameter, WSDLBoundPortType boundPortType, Mode mode) { |
ohair@286 | 333 | QName opName = new QName(boundPortType.getPortTypeName().getNamespaceURI(), method.getOperationName()); |
ohair@286 | 334 | WSDLBoundOperation bo = boundPortType.get(opName); |
ohair@286 | 335 | Map<Integer, ParameterImpl> bodyParams = new HashMap<Integer, ParameterImpl>(); |
ohair@286 | 336 | List<ParameterImpl> unboundParams = new ArrayList<ParameterImpl>(); |
ohair@286 | 337 | List<ParameterImpl> attachParams = new ArrayList<ParameterImpl>(); |
ohair@286 | 338 | for(ParameterImpl param : wrapperParameter.wrapperChildren){ |
ohair@286 | 339 | String partName = param.getPartName(); |
ohair@286 | 340 | if(partName == null) |
ohair@286 | 341 | continue; |
ohair@286 | 342 | |
ohair@286 | 343 | ParameterBinding paramBinding = boundPortType.getBinding(opName, |
ohair@286 | 344 | partName, mode); |
ohair@286 | 345 | if(paramBinding != null){ |
ohair@286 | 346 | if(mode == Mode.IN) |
ohair@286 | 347 | param.setInBinding(paramBinding); |
ohair@286 | 348 | else if(mode == Mode.OUT || mode == Mode.INOUT) |
ohair@286 | 349 | param.setOutBinding(paramBinding); |
ohair@286 | 350 | |
ohair@286 | 351 | if(paramBinding.isUnbound()){ |
ohair@286 | 352 | unboundParams.add(param); |
ohair@286 | 353 | } else if(paramBinding.isAttachment()){ |
ohair@286 | 354 | attachParams.add(param); |
ohair@286 | 355 | }else if(paramBinding.isBody()){ |
ohair@286 | 356 | if(bo != null){ |
ohair@286 | 357 | WSDLPart p = bo.getPart(param.getPartName(), mode); |
ohair@286 | 358 | if(p != null) |
ohair@286 | 359 | bodyParams.put(p.getIndex(), param); |
ohair@286 | 360 | else |
ohair@286 | 361 | bodyParams.put(bodyParams.size(), param); |
ohair@286 | 362 | }else{ |
ohair@286 | 363 | bodyParams.put(bodyParams.size(), param); |
ohair@286 | 364 | } |
ohair@286 | 365 | } |
ohair@286 | 366 | } |
ohair@286 | 367 | |
ohair@286 | 368 | } |
ohair@286 | 369 | wrapperParameter.clear(); |
ohair@286 | 370 | for(int i = 0; i < bodyParams.size();i++){ |
ohair@286 | 371 | ParameterImpl p = bodyParams.get(i); |
ohair@286 | 372 | wrapperParameter.addWrapperChild(p); |
ohair@286 | 373 | } |
ohair@286 | 374 | |
ohair@286 | 375 | //add unbounded parts |
ohair@286 | 376 | for(ParameterImpl p:unboundParams){ |
ohair@286 | 377 | wrapperParameter.addWrapperChild(p); |
ohair@286 | 378 | } |
ohair@286 | 379 | return attachParams; |
ohair@286 | 380 | } |
ohair@286 | 381 | |
ohair@286 | 382 | |
ohair@286 | 383 | void put(QName name, JavaMethodImpl jm) { |
ohair@286 | 384 | nameToJM.put(name, jm); |
ohair@286 | 385 | } |
ohair@286 | 386 | |
ohair@286 | 387 | void put(Method method, JavaMethodImpl jm) { |
ohair@286 | 388 | methodToJM.put(method, jm); |
ohair@286 | 389 | } |
ohair@286 | 390 | |
ohair@286 | 391 | void putOp(QName opName, JavaMethodImpl jm) { |
ohair@286 | 392 | wsdlOpToJM.put(opName, jm); |
ohair@286 | 393 | } |
ohair@286 | 394 | public String getWSDLLocation() { |
ohair@286 | 395 | return wsdlLocation; |
ohair@286 | 396 | } |
ohair@286 | 397 | |
ohair@286 | 398 | void setWSDLLocation(String location) { |
ohair@286 | 399 | wsdlLocation = location; |
ohair@286 | 400 | } |
ohair@286 | 401 | |
ohair@286 | 402 | public QName getServiceQName() { |
ohair@286 | 403 | return serviceName; |
ohair@286 | 404 | } |
ohair@286 | 405 | |
ohair@286 | 406 | public WSDLPort getPort() { |
ohair@286 | 407 | return port; |
ohair@286 | 408 | } |
ohair@286 | 409 | |
ohair@286 | 410 | public QName getPortName() { |
ohair@286 | 411 | return portName; |
ohair@286 | 412 | } |
ohair@286 | 413 | |
ohair@286 | 414 | public QName getPortTypeName() { |
ohair@286 | 415 | return portTypeName; |
ohair@286 | 416 | } |
ohair@286 | 417 | |
ohair@286 | 418 | void setServiceQName(QName name) { |
ohair@286 | 419 | serviceName = name; |
ohair@286 | 420 | } |
ohair@286 | 421 | |
ohair@286 | 422 | void setPortName(QName name) { |
ohair@286 | 423 | portName = name; |
ohair@286 | 424 | } |
ohair@286 | 425 | |
ohair@286 | 426 | void setPortTypeName(QName name) { |
ohair@286 | 427 | portTypeName = name; |
ohair@286 | 428 | } |
ohair@286 | 429 | |
ohair@286 | 430 | /** |
ohair@286 | 431 | * This is the targetNamespace for the WSDL containing the PortType |
ohair@286 | 432 | * definition |
ohair@286 | 433 | */ |
ohair@286 | 434 | void setTargetNamespace(String namespace) { |
ohair@286 | 435 | targetNamespace = namespace; |
ohair@286 | 436 | } |
ohair@286 | 437 | |
ohair@286 | 438 | /** |
ohair@286 | 439 | * This is the targetNamespace for the WSDL containing the PortType |
ohair@286 | 440 | * definition |
ohair@286 | 441 | */ |
ohair@286 | 442 | public String getTargetNamespace() { |
ohair@286 | 443 | return targetNamespace; |
ohair@286 | 444 | } |
ohair@286 | 445 | |
ohair@286 | 446 | @NotNull |
ohair@286 | 447 | public QName getBoundPortTypeName() { |
ohair@286 | 448 | assert portName != null; |
ohair@286 | 449 | return new QName(portName.getNamespaceURI(), portName.getLocalPart()+"Binding"); |
ohair@286 | 450 | } |
ohair@286 | 451 | |
ohair@286 | 452 | /** |
ohair@286 | 453 | * Adds additional classes obtained from {@link XmlSeeAlso} annotation. In starting |
ohair@286 | 454 | * from wsdl case these classes would most likely be JAXB ObjectFactory that references other classes. |
ohair@286 | 455 | */ |
ohair@286 | 456 | public void addAdditionalClasses(Class... additionalClasses) { |
ohair@286 | 457 | for(Class cls : additionalClasses) |
ohair@286 | 458 | this.additionalClasses.add(cls); |
ohair@286 | 459 | } |
ohair@286 | 460 | |
ohair@286 | 461 | public Databinding getDatabinding() { |
ohair@286 | 462 | return databinding; |
ohair@286 | 463 | } |
ohair@286 | 464 | |
ohair@286 | 465 | public void setDatabinding(Databinding wsRuntime) { |
ohair@286 | 466 | this.databinding = wsRuntime; |
ohair@286 | 467 | } |
ohair@286 | 468 | |
ohair@286 | 469 | public WSBinding getWSBinding() { |
ohair@286 | 470 | return wsBinding; |
ohair@286 | 471 | } |
ohair@286 | 472 | |
ohair@286 | 473 | public Class getContractClass() { |
ohair@286 | 474 | return contractClass; |
ohair@286 | 475 | } |
ohair@286 | 476 | |
ohair@286 | 477 | public Class getEndpointClass() { |
ohair@286 | 478 | return endpointClass; |
ohair@286 | 479 | } |
ohair@286 | 480 | |
ohair@286 | 481 | private List<Class> additionalClasses = new ArrayList<Class>(); |
ohair@286 | 482 | |
ohair@286 | 483 | private Pool.Marshaller marshallers; |
ohair@286 | 484 | /** |
ohair@286 | 485 | * @deprecated |
ohair@286 | 486 | */ |
ohair@286 | 487 | protected JAXBRIContext jaxbContext; |
ohair@286 | 488 | protected BindingContext bindingContext; |
ohair@286 | 489 | private String wsdlLocation; |
ohair@286 | 490 | private QName serviceName; |
ohair@286 | 491 | private QName portName; |
ohair@286 | 492 | private QName portTypeName; |
ohair@286 | 493 | private Map<Method,JavaMethodImpl> methodToJM = new HashMap<Method, JavaMethodImpl>(); |
ohair@286 | 494 | /** |
ohair@286 | 495 | * Payload QName to the method that handles it. |
ohair@286 | 496 | */ |
ohair@286 | 497 | private Map<QName,JavaMethodImpl> nameToJM = new HashMap<QName, JavaMethodImpl>(); |
ohair@286 | 498 | /** |
ohair@286 | 499 | * Wsdl Operation QName to the method that handles it. |
ohair@286 | 500 | */ |
ohair@286 | 501 | private Map<QName, JavaMethodImpl> wsdlOpToJM = new HashMap<QName, JavaMethodImpl>(); |
ohair@286 | 502 | |
ohair@286 | 503 | private List<JavaMethodImpl> javaMethods = new ArrayList<JavaMethodImpl>(); |
ohair@286 | 504 | private final Map<TypeReference, Bridge> bridgeMap = new HashMap<TypeReference, Bridge>(); |
ohair@286 | 505 | private final Map<TypeInfo, XMLBridge> xmlBridgeMap = new HashMap<TypeInfo, XMLBridge>(); |
ohair@286 | 506 | protected final QName emptyBodyName = new QName(""); |
ohair@286 | 507 | private String targetNamespace = ""; |
ohair@286 | 508 | private List<String> knownNamespaceURIs = null; |
ohair@286 | 509 | private WSDLPort port; |
ohair@286 | 510 | private final WebServiceFeatureList features; |
ohair@286 | 511 | private Databinding databinding; |
ohair@286 | 512 | BindingID bindingId; |
ohair@286 | 513 | protected Class contractClass; |
ohair@286 | 514 | protected Class endpointClass; |
ohair@286 | 515 | protected ClassLoader classLoader = null; |
ohair@286 | 516 | protected WSBinding wsBinding; |
ohair@286 | 517 | protected BindingInfo databindingInfo; |
ohair@286 | 518 | private static final Logger LOGGER = Logger.getLogger(AbstractSEIModelImpl.class.getName()); |
ohair@286 | 519 | } |