You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2006/12/06 23:01:55 UTC

svn commit: r483254 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: client/ context/ description/

Author: gdaniels
Date: Wed Dec  6 14:01:53 2006
New Revision: 483254

URL: http://svn.apache.org/viewvc?view=rev&rev=483254
Log:
Introduce a means to get the most recent OperationContext from the ServiceClient.  This works by optionally storing the OperationContext in the ServiceContext - this caching is controlled by a boolean property on ServiceContext.java.  If the property is set, each time an OperationContext gets created by an OperationClient, it will be stored away.  You can access it later with ServiceClient.getLastOperationContext().

This fixes http://issues.apache.org/jira/browse/AXIS2-1823, except for a test case!

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/OperationClient.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/OperationClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/OperationClient.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/OperationClient.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/OperationClient.java Wed Dec  6 14:01:53 2006
@@ -31,7 +31,7 @@
  * in a new message being created, then if a message receiver is registered with
  * the client then the message will be delivered to that client.
  */
-public interface OperationClient {
+public interface  OperationClient {
     /**
      * Sets the options that should be used for this particular client. This
      * resets the entire set of options to use the new options - so you'd lose

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Wed Dec  6 14:01:53 2006
@@ -747,6 +747,20 @@
         options.setTo(targetEpr);
     }
 
+    /**
+     * Gets the last OperationContext
+     */
+    public OperationContext getLastOperationContext() {
+        return serviceContext.getLastOperationContext();
+    }
+
+    /**
+     * Sets whether or not to cache the last OperationContext
+     */
+    public void setCachingOperationContext(boolean cachingOpContext) {
+        serviceContext.setCachingOperationContext(cachingOpContext);
+    }
+
 
     /**
      * This class acts as a callback that allows users to wait on the result.

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ServiceContext.java Wed Dec  6 14:01:53 2006
@@ -41,6 +41,11 @@
     private ServiceGroupContext serviceGroupContext;
     private ConfigurationContext configContext;
 
+    /** Should we cache the last OperationContext? */
+    private boolean cachingOperationContext;
+    /** A cache for the last OperationContext */
+    private OperationContext lastOperationContext;
+
     public ServiceContext(AxisService serviceConfig, ServiceGroupContext serviceGroupContext) {
         super(serviceGroupContext);
         this.serviceGroupContext = serviceGroupContext;
@@ -50,8 +55,16 @@
 
     public OperationContext createOperationContext(QName name) {
         AxisOperation axisOp = axisService.getOperation(name);
+        return createOperationContext(axisOp);
+    }
 
-        return new OperationContext(axisOp, this);
+    public OperationContext createOperationContext(AxisOperation axisOp) {
+        OperationContext ctx = new OperationContext(axisOp, this);
+        if (cachingOperationContext) {
+            // Squirrel this away for anyone who wants it later
+            lastOperationContext = ctx;
+        }
+        return ctx;
     }
 
     public AxisService getAxisService() {
@@ -123,5 +136,21 @@
 
     public void setMyEPR(EndpointReference myEPR) {
         this.myEPR = myEPR;
+    }
+
+    public OperationContext getLastOperationContext() {
+        return lastOperationContext;
+    }
+
+    public void setLastOperationContext(OperationContext lastOperationContext) {
+        this.lastOperationContext = lastOperationContext;
+    }
+
+    public boolean isCachingOperationContext() {
+        return cachingOperationContext;
+    }
+
+    public void setCachingOperationContext(boolean cacheLastOperationContext) {
+        this.cachingOperationContext = cacheLastOperationContext;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Wed Dec  6 14:01:53 2006
@@ -118,8 +118,7 @@
         this.sc = sc;
         this.options = options;
         this.completed = false;
-        this.oc = new OperationContext(axisOp);
-        this.oc.setParent(this.sc);
+        this.oc = sc.createOperationContext(axisOp);
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutOnlyAxisOperation.java Wed Dec  6 14:01:53 2006
@@ -185,7 +185,7 @@
         this.sc = sc;
         this.options = options;
         this.completed = false;
-        oc = new OperationContext(axisOp, sc);
+        oc = sc.createOperationContext(axisOp);
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java?view=diff&rev=483254&r1=483253&r2=483254
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java Wed Dec  6 14:01:53 2006
@@ -42,12 +42,12 @@
     }
 
     public OperationClient createClient(ServiceContext sc, Options options) {
-        return new RobustOperationClient(this, sc, options);
+        return new RobustOutOnlyOperationClient(this, sc, options);
     }
 
-    class RobustOperationClient extends OutInAxisOperationClient {
+    class RobustOutOnlyOperationClient extends OutInAxisOperationClient {
 
-        public RobustOperationClient(OutInAxisOperation axisOp, ServiceContext sc, Options options) {
+        public RobustOutOnlyOperationClient(OutInAxisOperation axisOp, ServiceContext sc, Options options) {
             super(axisOp, sc, options);
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org