axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glyn Normington" <glyn_norming...@uk.ibm.com>
Subject Re: [PATCH] Undo and chains
Date Thu, 20 Dec 2001 17:08:27 GMT
Apologies if this is a repeat of an earlier note - I may have had a mail
glitch.

Anyway, Doug has agreed that this change can go in and I hope to work with
him and anyone else who is willing to write up the chain/handler rationale
in the new year. The next step is to make SimpleTargetedChain extend
SimpleChain and remove some duplicate logic, but that will probably have to
wait until the new year.

Please would someone commit this today so I can be sure it has not
disturbed the build before I go on holiday tomorrow?

Glyn

Index: xml-axis/java/src/org/apache/axis/Chain.java
===================================================================
RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/Chain.java,v
retrieving revision 1.10
diff -u -r1.10 Chain.java
--- xml-axis/java/src/org/apache/axis/Chain.java   2001/10/30 16:46:34      1.10
+++ xml-axis/java/src/org/apache/axis/Chain.java   2001/12/18 13:58:17
@@ -64,16 +64,11 @@

 public interface Chain extends Handler {
     /**
-     * Adds a handler to the end of the chain
+     * Adds a handler to the end of the chain. May not be called after invoke.
      */
     public void addHandler(Handler handler);

     /**
-     * Removes the specified handler from the chain
-     */
-    public void removeHandler(int index);
-
-    /**
      * Is this handler in the chain?
      */
     public boolean contains(Handler handler);
@@ -82,11 +77,6 @@
      * Get the list of handlers in the chain - is Handler[] the right form?
      */
     public Handler[] getHandlers();
-
-    /**
-     * Erase the contents of the chain
-     */
-    public void clear();

     // How many do we want to force people to implement?
 };
Index: xml-axis/java/src/org/apache/axis/SimpleChain.java
===================================================================
RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/SimpleChain.java,v
retrieving revision 1.35
diff -u -r1.35 SimpleChain.java
--- xml-axis/java/src/org/apache/axis/SimpleChain.java  2001/12/03 22:49:22 1.35
+++ xml-axis/java/src/org/apache/axis/SimpleChain.java  2001/12/18 13:58:17
@@ -78,6 +78,7 @@

     protected Vector     handlers ;
     protected Hashtable  options ;
+    protected boolean    invoked;

     public void init() {
         for ( int i = 0 ; i < handlers.size() ; i++ )
@@ -98,6 +99,7 @@
      * rethrow the exception.
      */
     public void invoke(MessageContext msgContext) throws AxisFault {
+    invoked = true;
         doVisiting(msgContext, iVisitor);
     }

@@ -106,6 +108,7 @@
      * contributing to a WSDL description.
      */
     public void generateWSDL(MessageContext msgContext) throws AxisFault {
+    invoked = true;
         doVisiting(msgContext, wsdlVisitor);
     }

@@ -170,18 +173,13 @@
         if (handler == null)
             throw new NullPointerException(
                     JavaUtils.getMessage("nullHandler00", "SimpleChain::addHandler"));
+
+        if (invoked)
+            throw new NullPointerException(
+                    JavaUtils.getMessage("addAfterInvoke00", "SimpleChain::addHandler"));

         if ( handlers == null ) handlers = new Vector();
         handlers.add( handler );
-    }
-
-    public void removeHandler(int index) {
-        if ( handlers != null )
-            handlers.removeElementAt( index );
-    }
-
-    public void clear() {
-        handlers.clear();
     }

     public boolean contains(Handler handler) {
Index: xml-axis/java/src/org/apache/axis/utils/resources.properties
===================================================================
RCS file: /home/cvspublic/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
retrieving revision 1.31
diff -u -r1.31 resources.properties
--- xml-axis/java/src/org/apache/axis/utils/resources.properties  2001/12/13 17:33:17 1.31
+++ xml-axis/java/src/org/apache/axis/utils/resources.properties  2001/12/18 13:58:20
@@ -4,6 +4,7 @@
 # 3.  If a single quote character is to appear in the resulting message, it must appear in
this file as two consecutive single quote characters.
 # 4.  Lines beginning with "#" (like this one) are comment lines and may contain translation
instructions.  They need not be translated unless your
translated file, rather than this file, will serve as a base for other translators.

+addAfterInvoke00={0}:  the chain has already been invoked
 addBody00=Adding body element to message...
 addHeader00=Adding header to message...
 addTrailer00=Adding trailer to message...



Mime
View raw message