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

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
equal deleted inserted replaced
-1:000000000000 0:373ffda63c9a
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.xml.internal.ws.wsdl;
27
28 import com.sun.xml.internal.ws.api.message.Packet;
29 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
31 import com.sun.xml.internal.ws.api.model.JavaMethod;
32 import com.sun.xml.internal.ws.api.model.SEIModel;
33 import com.sun.xml.internal.ws.api.model.WSDLOperationMapping;
34 import com.sun.xml.internal.ws.api.WSBinding;
35 import com.sun.xml.internal.ws.model.JavaMethodImpl;
36 import com.sun.istack.internal.NotNull;
37 import com.sun.istack.internal.Nullable;
38
39 import javax.xml.namespace.QName;
40
41 /**
42 * Extensions if this class will be used for dispatching the request message to the correct endpoint method by
43 * identifying the wsdl operation associated with the request.
44 *
45 * @see OperationDispatcher
46 *
47 * @author Rama Pulavarthi
48 */
49 public abstract class WSDLOperationFinder {
50 protected final WSDLPort wsdlModel;
51 protected final WSBinding binding;
52 protected final SEIModel seiModel;
53
54 public WSDLOperationFinder(@NotNull WSDLPort wsdlModel, @NotNull WSBinding binding, @Nullable SEIModel seiModel) {
55 this.wsdlModel = wsdlModel;
56 this.binding = binding;
57 this.seiModel= seiModel;
58 }
59
60 /**
61 * This methods returns the QName of the WSDL operation correponding to a request Packet.
62 * An implementation should return null when it cannot dispatch to a unique method based on the information it processes.
63 * In such case, other OperationFinders are queried to resolve a WSDL operation.
64 * It should throw an instance of DispatchException if it finds incorrect information in the packet.
65 *
66 * @deprecated use getWSDLOperationMapping(Packet request)
67 *
68 * @param request Request Packet that is used to find the associated WSDLOperation
69 * @return QName of the WSDL Operation that this request correponds to.
70 * null when it cannot find a unique operation to dispatch to.
71 * @throws DispatchException When the information in the Packet is invalid
72 */
73 public QName getWSDLOperationQName(Packet request) throws DispatchException {
74 WSDLOperationMapping m = getWSDLOperationMapping(request);
75 return m != null ? m.getOperationName() : null;
76 }
77
78 public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
79 return null;
80 }
81
82 protected WSDLOperationMapping wsdlOperationMapping(JavaMethodImpl j) {
83 return new WSDLOperationMappingImpl(j.getOperation(), j);
84 }
85
86 protected WSDLOperationMapping wsdlOperationMapping(WSDLBoundOperation o) {
87 return new WSDLOperationMappingImpl(o, null);
88 }
89
90 static class WSDLOperationMappingImpl implements WSDLOperationMapping {
91 private WSDLBoundOperation wsdlOperation;
92 private JavaMethod javaMethod;
93 private QName operationName;
94
95 WSDLOperationMappingImpl(WSDLBoundOperation wsdlOperation, JavaMethodImpl javaMethod) {
96 this.wsdlOperation = wsdlOperation;
97 this.javaMethod = javaMethod;
98 operationName = (javaMethod != null) ? javaMethod.getOperationQName() : wsdlOperation.getName();
99 }
100
101 public WSDLBoundOperation getWSDLBoundOperation() {
102 return wsdlOperation;
103 }
104
105 public JavaMethod getJavaMethod() {
106 return javaMethod;
107 }
108
109 public QName getOperationName() {
110 return operationName;
111 }
112 }
113 }

mercurial