Author: ningjiang
Date: Mon Jul 5 10:12:35 2010
New Revision: 960517
URL: http://svn.apache.org/viewvc?rev=960517&view=rev
Log:
Merged revisions 960506 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r960506 | ningjiang | 2010-07-05 17:52:10 +0800 (Mon, 05 Jul 2010) | 1 line
CXF-2884 Client async invoke API should accept context and exchange parameters
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:960506
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java?rev=960517&r1=960516&r2=960517&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
(original)
+++
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
Mon Jul 5 10:12:35 2010
@@ -119,7 +119,7 @@ public interface Client extends Intercep
* @param params The params that matches the parts of the input message
of the operation. If the
* BindingOperationInfo supports unwrapping, it assumes the params are in
the "unwrapped" form. If
* params are in the wrapped form, use invokeWrapped
- * @return The return values that matche the parts of the output message
of the operation
+ *
*/
void invoke(ClientCallback callback,
String operationName,
@@ -132,7 +132,7 @@ public interface Client extends Intercep
* @param params The params that matches the parts of the input message
of the operation. If the
* BindingOperationInfo supports unwrapping, it assumes the params are in
the "unwrapped" form. If
* params are in the wrapped form, use invokeWrapped
- * @return The return values that matche the parts of the output message
of the operation
+ *
*/
void invoke(ClientCallback callback,
QName operationName,
@@ -145,7 +145,7 @@ public interface Client extends Intercep
* @param operationName The name of the operation to be invoked. The
service namespace will be used
* when looking up the BindingOperationInfo.
* @param params The params that matches the parts of the input message
of the operation
- * @return The return values that matche the parts of the output message
of the operation
+ *
*/
void invokeWrapped(ClientCallback callback,
String operationName,
@@ -156,7 +156,7 @@ public interface Client extends Intercep
* @param callback The callback that is called when the response is ready
* @param operationName The name of the operation to be invoked
* @param params The params that matches the parts of the input message
of the operation
- * @return The return values that matche the parts of the output message
of the operation
+ *
*/
void invokeWrapped(ClientCallback callback,
QName operationName,
@@ -167,11 +167,50 @@ public interface Client extends Intercep
* @param callback The callback that is called when the response is ready
* @param oi The operation to be invoked
* @param params The params that matches the parts of the input message
of the operation
- * @return The return values that matche the parts of the output message
of the operation
+ *
+ */
+ void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object... params) throws Exception;
+
+ /**
+ * Invokes an operation asynchronously
+ * @param callback The callback that is called when the response is ready
+ * @param oi The operation to be invoked
+ * @param params The params that matches the parts of the input message
of the operation
+ * @param context contextual information for the invocation
+ */
+ void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object[] params,
+ Map<String, Object> context) throws Exception;
+
+ /**
+ * Invokes an operation asynchronously
+ * @param callback The callback that is called when the response is ready
+ * @param oi The operation to be invoked
+ * @param params The params that matches the parts of the input message
of the operation
+ * @param exchange The Exchange to be used for the invocation
+ *
+ */
+ void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object[] params,
+ Exchange exchange) throws Exception;
+
+ /**
+ * Invokes an operation asynchronously
+ * @param callback The callback that is called when the response is ready
+ * @param oi The operation to be invoked
+ * @param params The params that matches the parts of the input message
of the operation
+ * @param context Optional (can be null) contextual information for the
invocation
+ * @param exchange Optional (can be null) The Exchange to be used for the
invocation
*/
void invoke(ClientCallback callback,
BindingOperationInfo oi,
- Object... params) throws Exception;
+ Object[] params,
+ Map<String, Object> context,
+ Exchange exchange) throws Exception;
/**
Modified:
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=960517&r1=960516&r2=960517&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Mon Jul 5 10:12:35 2010
@@ -378,18 +378,47 @@ public class ClientImpl
public void invoke(ClientCallback callback,
BindingOperationInfo oi,
Object... params) throws Exception {
+ invoke(callback, oi, params, null, null);
+ }
+
+ public void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object[] params,
+ Map<String, Object> context) throws Exception {
+ invoke(callback, oi, params, context, null);
+ }
+
+ public void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object[] params,
+ Exchange exchange) throws Exception {
+ invoke(callback, oi, params, null, exchange);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void invoke(ClientCallback callback,
+ BindingOperationInfo oi,
+ Object[] params,
+ Map<String, Object> context,
+ Exchange exchange) throws Exception {
Bus origBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(bus);
try {
- Exchange exchange = new ExchangeImpl();
+ if (exchange == null) {
+ exchange = new ExchangeImpl();
+ }
exchange.setSynchronous(false);
Endpoint endpoint = getEndpoint();
- Map<String, Object> context = new HashMap<String, Object>();
- Map<String, Object> resp = getResponseContext();
- resp.clear();
- Map<String, Object> reqContext = new HashMap<String,
Object>(getRequestContext());
- context.put(RESPONSE_CONTEXT, resp);
- context.put(REQUEST_CONTEXT, reqContext);
+ if (context == null) {
+ context = new HashMap<String, Object>();
+ Map<String, Object> resp = getResponseContext();
+ resp.clear();
+ Map<String, Object> reqContext = new HashMap<String,
Object>(getRequestContext());
+ context.put(RESPONSE_CONTEXT, resp);
+ context.put(REQUEST_CONTEXT, reqContext);
+ }
+
+ Map<String, Object> reqContext = (Map<String,
Object>)context.get(REQUEST_CONTEXT);
Message message = endpoint.getBinding().createMessage();
message.put(Message.INVOCATION_CONTEXT, context);