You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wh...@apache.org on 2002/08/19 11:19:33 UTC

cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/java WSIFOperation_Java.java

whitlock    2002/08/19 02:19:33

  Modified:    java/src/org/apache/wsif/base WSIFDefaultOperation.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSIFOperation_ApacheAxis.java
               java/src/org/apache/wsif/providers/ejb
                        WSIFOperation_EJB.java
               java/src/org/apache/wsif/providers/soap/apachesoap
                        WSIFOperation_ApacheSOAP.java
               java/test/addressbook AddressBookTest.java
               java/src/org/apache/wsif/providers/jms
                        WSIFOperation_Jms.java
               java/src/org/apache/wsif/providers/java
                        WSIFOperation_Java.java
  Log:
  Forbid reusing a WSIFOperation
  
  Revision  Changes    Path
  1.10      +9 -0      xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java
  
  Index: WSIFDefaultOperation.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- WSIFDefaultOperation.java	7 Aug 2002 15:10:25 -0000	1.9
  +++ WSIFDefaultOperation.java	19 Aug 2002 09:19:32 -0000	1.10
  @@ -80,6 +80,7 @@
       transient protected HashMap outJmsProps = new HashMap();
       transient protected HashMap inJmsPropVals = new HashMap();
       protected WSIFMessage context;
  +    protected boolean closed = false;
      
       /**
        * @see WSIFOperation#executeRequestResponseOperation(WSIFMessage, WSIFMessage, WSIFMessage)
  @@ -397,5 +398,13 @@
           }
           Trc.exit(context);
           return context;
  +    }
  +    
  +    protected void close() throws WSIFException {
  +    	Trc.entry(this);
  +        if (closed)
  +            throw new WSIFException("Cannot reuse a WSIFOperation to invoke multiple operations");
  +        closed = true;
  +        Trc.exit();
       }
   }
  
  
  
  1.20      +4 -0      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
  
  Index: WSIFOperation_ApacheAxis.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- WSIFOperation_ApacheAxis.java	16 Aug 2002 08:46:45 -0000	1.19
  +++ WSIFOperation_ApacheAxis.java	19 Aug 2002 09:19:32 -0000	1.20
  @@ -314,7 +314,9 @@
           WSIFMessage input,
           WSIFResponseHandler handler)
           throws WSIFException {
  +        	
           Trc.entry(this, input, handler);
  +        close();
   
           if (!portInstance.supportsAsync()) {
               throw new WSIFException("asynchronous operations not available");
  @@ -547,7 +549,9 @@
           WSIFMessage wsifmessage1,
           WSIFMessage wsifmessage2)
           throws WSIFException {
  +        	
           Trc.entry(this, wsifmessage, wsifmessage1, wsifmessage2);
  +        close();
           setAsyncOperation(false);
   
           boolean succ =
  
  
  
  1.11      +2 -0      xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFOperation_EJB.java
  
  Index: WSIFOperation_EJB.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/ejb/WSIFOperation_EJB.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSIFOperation_EJB.java	16 Aug 2002 08:46:46 -0000	1.10
  +++ WSIFOperation_EJB.java	19 Aug 2002 09:19:32 -0000	1.11
  @@ -828,6 +828,7 @@
           throws WSIFException {
   
           Trc.entry(this, input, output, fault);
  +        close();
   
           boolean operationSucceeded = true;
           boolean foundInputParameter = false;
  @@ -1105,6 +1106,7 @@
           throws WSIFException {
   
           Trc.entry(this, input);
  +        close();
   
           boolean foundInputParameter = false;
   
  
  
  
  1.22      +3 -0      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java
  
  Index: WSIFOperation_ApacheSOAP.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- WSIFOperation_ApacheSOAP.java	16 Aug 2002 08:46:45 -0000	1.21
  +++ WSIFOperation_ApacheSOAP.java	19 Aug 2002 09:19:32 -0000	1.22
  @@ -396,6 +396,7 @@
           throws WSIFException {
   
           Trc.entry(this, input, output, fault);
  +        close();
   
           setAsyncOperation(false);
   
  @@ -711,7 +712,9 @@
           WSIFMessage input,
           WSIFResponseHandler handler)
           throws WSIFException {
  +        	
           Trc.entry(this, input, handler);
  +        close();
   
           if (!prepared)
               prepare(input, null);
  
  
  
  1.14      +15 -1     xml-axis-wsif/java/test/addressbook/AddressBookTest.java
  
  Index: AddressBookTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/addressbook/AddressBookTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AddressBookTest.java	29 Jul 2002 13:38:07 -0000	1.13
  +++ AddressBookTest.java	19 Aug 2002 09:19:32 -0000	1.14
  @@ -63,12 +63,12 @@
   
   import org.apache.wsif.WSIFConstants;
   import org.apache.wsif.WSIFCorrelationId;
  +import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFMessage;
   import org.apache.wsif.WSIFOperation;
   import org.apache.wsif.WSIFPort;
   import org.apache.wsif.WSIFService;
   import org.apache.wsif.WSIFServiceFactory;
  -import org.apache.wsif.base.WSIFServiceImpl;
   import org.apache.wsif.providers.soap.apacheaxis.WSIFDynamicProvider_ApacheAxis;
   import org.apache.wsif.util.WSIFPluggableProviders;
   import util.AddressUtility;
  @@ -314,6 +314,20 @@
               } else {
                   System.out.println("Failed to lookup name in addressbook");
               }
  +
  +            // Check that we can't reuse an operation.            
  +            boolean caughtException = false;
  +            try {
  +                operationSucceeded =
  +                    operation.executeRequestResponseOperation(
  +                        inputMessage,
  +                        outputMessage,
  +                        faultMessage);
  +            } catch (WSIFException we) {
  +                caughtException = true;
  +            }
  +            assertTrue(caughtException);
  +            	
           } catch (Exception e) {
               System.err.println("AddressBookTest(" + portName + ") caught exception " + e);
               e.printStackTrace();
  
  
  
  1.18      +3 -0      xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java
  
  Index: WSIFOperation_Jms.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WSIFOperation_Jms.java	1 Aug 2002 11:24:06 -0000	1.17
  +++ WSIFOperation_Jms.java	19 Aug 2002 09:19:32 -0000	1.18
  @@ -174,7 +174,9 @@
           WSIFMessage output,
           WSIFMessage fault)
           throws WSIFException {
  +        	
           Trc.entry(this, input, output, fault);
  +        close();
   
           if (!fieldJmsPort.supportsSync())
               throw new WSIFException("synchronous operations not available");
  @@ -263,6 +265,7 @@
           //	 	workflow does not need WSIFResponseHandler!
   
           Trc.entry(this, input, handler);
  +        close();
   
           if (!fieldJmsPort.supportsAsync())
               throw new WSIFException("asynchronous operations not available");
  
  
  
  1.16      +2 -0      xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java
  
  Index: WSIFOperation_Java.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/java/WSIFOperation_Java.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WSIFOperation_Java.java	16 Aug 2002 08:46:46 -0000	1.15
  +++ WSIFOperation_Java.java	19 Aug 2002 09:19:32 -0000	1.16
  @@ -858,6 +858,7 @@
           throws WSIFException {
   
           Trc.entry(this, input, output, fault);
  +        close();
   
           boolean operationSucceeded = true;
           boolean usedOutputParam = false;
  @@ -1153,6 +1154,7 @@
       public void executeInputOnlyOperation(WSIFMessage input) throws WSIFException {
   
           Trc.entry(this, input);
  +        close();
   
           try {
               Object result = null;