src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/WSDLOperationFinder.java

Fri, 14 Feb 2014 11:13:45 +0100

author
mkos
date
Fri, 14 Feb 2014 11:13:45 +0100
changeset 515
6cd506508147
parent 368
0989ad8c0860
child 637
9c07ef4934dd
permissions
-rw-r--r--

8026188: Enhance envelope factory
Summary: Avoiding caching data initialized via TCCL in static context; fix also reviewed by Alexander Fomin
Reviewed-by: ahgross, mgrebac, skoivu

ohair@286 1 /*
alanb@368 2 * Copyright (c) 1997, 2012, 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.wsdl;
ohair@286 27
ohair@286 28 import com.sun.xml.internal.ws.api.message.Packet;
alanb@368 29 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
ohair@286 30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
alanb@368 31 import com.sun.xml.internal.ws.api.model.JavaMethod;
ohair@286 32 import com.sun.xml.internal.ws.api.model.SEIModel;
alanb@368 33 import com.sun.xml.internal.ws.api.model.WSDLOperationMapping;
ohair@286 34 import com.sun.xml.internal.ws.api.WSBinding;
alanb@368 35 import com.sun.xml.internal.ws.model.JavaMethodImpl;
ohair@286 36 import com.sun.istack.internal.NotNull;
ohair@286 37 import com.sun.istack.internal.Nullable;
ohair@286 38
ohair@286 39 import javax.xml.namespace.QName;
ohair@286 40
ohair@286 41 /**
ohair@286 42 * Extensions if this class will be used for dispatching the request message to the correct endpoint method by
ohair@286 43 * identifying the wsdl operation associated with the request.
ohair@286 44 *
alanb@368 45 * @see OperationDispatcher
ohair@286 46 *
ohair@286 47 * @author Rama Pulavarthi
ohair@286 48 */
ohair@286 49 public abstract class WSDLOperationFinder {
ohair@286 50 protected final WSDLPort wsdlModel;
ohair@286 51 protected final WSBinding binding;
ohair@286 52 protected final SEIModel seiModel;
ohair@286 53
ohair@286 54 public WSDLOperationFinder(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) {
ohair@286 55 this.wsdlModel = wsdlModel;
ohair@286 56 this.binding = binding;
ohair@286 57 this.seiModel= seiModel;
ohair@286 58 }
ohair@286 59
ohair@286 60 /**
ohair@286 61 * This methods returns the QName of the WSDL operation correponding to a request Packet.
ohair@286 62 * An implementation should return null when it cannot dispatch to a unique method based on the information it processes.
ohair@286 63 * In such case, other OperationFinders are queried to resolve a WSDL operation.
ohair@286 64 * It should throw an instance of DispatchException if it finds incorrect information in the packet.
ohair@286 65 *
alanb@368 66 * @deprecated use getWSDLOperationMapping(Packet request)
alanb@368 67 *
ohair@286 68 * @param request Request Packet that is used to find the associated WSDLOperation
ohair@286 69 * @return QName of the WSDL Operation that this request correponds to.
ohair@286 70 * null when it cannot find a unique operation to dispatch to.
ohair@286 71 * @throws DispatchException When the information in the Packet is invalid
ohair@286 72 */
alanb@368 73 public QName getWSDLOperationQName(Packet request) throws DispatchException {
alanb@368 74 WSDLOperationMapping m = getWSDLOperationMapping(request);
alanb@368 75 return m != null ? m.getOperationName() : null;
alanb@368 76 }
alanb@368 77
alanb@368 78 public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
alanb@368 79 return null;
alanb@368 80 }
alanb@368 81
alanb@368 82 protected WSDLOperationMapping wsdlOperationMapping(JavaMethodImpl j) {
alanb@368 83 return new WSDLOperationMappingImpl(j.getOperation(), j);
alanb@368 84 }
alanb@368 85
alanb@368 86 protected WSDLOperationMapping wsdlOperationMapping(WSDLBoundOperation o) {
alanb@368 87 return new WSDLOperationMappingImpl(o, null);
alanb@368 88 }
alanb@368 89
alanb@368 90 static class WSDLOperationMappingImpl implements WSDLOperationMapping {
alanb@368 91 private WSDLBoundOperation wsdlOperation;
alanb@368 92 private JavaMethod javaMethod;
alanb@368 93 private QName operationName;
alanb@368 94
alanb@368 95 WSDLOperationMappingImpl(WSDLBoundOperation wsdlOperation, JavaMethodImpl javaMethod) {
alanb@368 96 this.wsdlOperation = wsdlOperation;
alanb@368 97 this.javaMethod = javaMethod;
alanb@368 98 operationName = (javaMethod != null) ? javaMethod.getOperationQName() : wsdlOperation.getName();
alanb@368 99 }
alanb@368 100
alanb@368 101 public WSDLBoundOperation getWSDLBoundOperation() {
alanb@368 102 return wsdlOperation;
alanb@368 103 }
alanb@368 104
alanb@368 105 public JavaMethod getJavaMethod() {
alanb@368 106 return javaMethod;
alanb@368 107 }
alanb@368 108
alanb@368 109 public QName getOperationName() {
alanb@368 110 return operationName;
alanb@368 111 }
alanb@368 112 }
ohair@286 113 }

mercurial