1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.xml.internal.ws.wsdl; |
26 package com.sun.xml.internal.ws.wsdl; |
27 |
27 |
28 import com.sun.xml.internal.ws.api.message.Packet; |
28 import com.sun.xml.internal.ws.api.message.Packet; |
|
29 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; |
29 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
|
31 import com.sun.xml.internal.ws.api.model.JavaMethod; |
30 import com.sun.xml.internal.ws.api.model.SEIModel; |
32 import com.sun.xml.internal.ws.api.model.SEIModel; |
|
33 import com.sun.xml.internal.ws.api.model.WSDLOperationMapping; |
31 import com.sun.xml.internal.ws.api.WSBinding; |
34 import com.sun.xml.internal.ws.api.WSBinding; |
|
35 import com.sun.xml.internal.ws.model.JavaMethodImpl; |
32 import com.sun.istack.internal.NotNull; |
36 import com.sun.istack.internal.NotNull; |
33 import com.sun.istack.internal.Nullable; |
37 import com.sun.istack.internal.Nullable; |
34 |
38 |
35 import javax.xml.namespace.QName; |
39 import javax.xml.namespace.QName; |
36 |
40 |
37 /** |
41 /** |
38 * Extensions if this class will be used for dispatching the request message to the correct endpoint method by |
42 * Extensions if this class will be used for dispatching the request message to the correct endpoint method by |
39 * identifying the wsdl operation associated with the request. |
43 * identifying the wsdl operation associated with the request. |
40 * |
44 * |
41 * @See OperationDispatcher |
45 * @see OperationDispatcher |
42 * |
46 * |
43 * @author Rama Pulavarthi |
47 * @author Rama Pulavarthi |
44 */ |
48 */ |
45 public abstract class WSDLOperationFinder { |
49 public abstract class WSDLOperationFinder { |
46 protected final WSDLPort wsdlModel; |
50 protected final WSDLPort wsdlModel; |
57 * This methods returns the QName of the WSDL operation correponding to a request Packet. |
61 * This methods returns the QName of the WSDL operation correponding to a request Packet. |
58 * An implementation should return null when it cannot dispatch to a unique method based on the information it processes. |
62 * An implementation should return null when it cannot dispatch to a unique method based on the information it processes. |
59 * In such case, other OperationFinders are queried to resolve a WSDL operation. |
63 * In such case, other OperationFinders are queried to resolve a WSDL operation. |
60 * It should throw an instance of DispatchException if it finds incorrect information in the packet. |
64 * It should throw an instance of DispatchException if it finds incorrect information in the packet. |
61 * |
65 * |
|
66 * @deprecated use getWSDLOperationMapping(Packet request) |
|
67 * |
62 * @param request Request Packet that is used to find the associated WSDLOperation |
68 * @param request Request Packet that is used to find the associated WSDLOperation |
63 * @return QName of the WSDL Operation that this request correponds to. |
69 * @return QName of the WSDL Operation that this request correponds to. |
64 * null when it cannot find a unique operation to dispatch to. |
70 * null when it cannot find a unique operation to dispatch to. |
65 * @throws DispatchException When the information in the Packet is invalid |
71 * @throws DispatchException When the information in the Packet is invalid |
66 */ |
72 */ |
67 public abstract QName getWSDLOperationQName(Packet request) throws DispatchException; |
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 } |
68 } |
113 } |