directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r328557 - in /directory/network/trunk/src: java/org/apache/mina/common/ java/org/apache/mina/common/support/ java/org/apache/mina/filter/ test/org/apache/mina/common/ test/org/apache/mina/filter/
Date Wed, 26 Oct 2005 04:51:14 GMT
Author: trustin
Date: Tue Oct 25 21:51:04 2005
New Revision: 328557

URL: http://svn.apache.org/viewcvs?rev=328557&view=rev
Log:
Modified the signature of IoFilter.filter(Added|Removed) method to make SSLFilter initiate
handshake as soon as the filter is added.

Modified:
    directory/network/trunk/src/java/org/apache/mina/common/IoFilter.java
    directory/network/trunk/src/java/org/apache/mina/common/IoFilterAdapter.java
    directory/network/trunk/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/common/support/IoSessionManagerFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/filter/LoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/filter/SSLFilter.java
    directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java
    directory/network/trunk/src/test/org/apache/mina/common/IoFilterChainTest.java
    directory/network/trunk/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java

Modified: directory/network/trunk/src/java/org/apache/mina/common/IoFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/IoFilter.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/IoFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/IoFilter.java Tue Oct 25 21:51:04
2005
@@ -49,7 +49,7 @@
      * @param parent the parent {@link IoSessionManager} or {@link IoSession}
      *               that added this filter to itself.
      */
-    void filterAdded( Object parent ) throws Exception;
+    void filterAdded( NextFilter nextFilter, Object parent ) throws Exception;
     
     /**
      * Invoked when this filter is removed from the specified <tt>parent</tt>
@@ -57,7 +57,7 @@
      * @param parent the parent {@link IoSessionManager} or {@link IoSession}
      *               that removed this filter from itself.
      */
-    void filterRemoved( Object parent ) throws Exception;
+    void filterRemoved( NextFilter nextFilter, Object parent ) throws Exception;
     
     /**
      * Filters {@link IoHandler#sessionOpened(IoSession)} event.

Modified: directory/network/trunk/src/java/org/apache/mina/common/IoFilterAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/IoFilterAdapter.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/IoFilterAdapter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/IoFilterAdapter.java Tue Oct 25
21:51:04 2005
@@ -28,11 +28,11 @@
  */
 public class IoFilterAdapter implements IoFilter
 {
-    public void filterAdded( Object parent )
+    public void filterAdded( NextFilter nextFilter, Object parent ) throws Exception
     {
     }
     
-    public void filterRemoved( Object parent )
+    public void filterRemoved( NextFilter nextFilter, Object parent ) throws Exception
     {
     }
 

Modified: directory/network/trunk/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
Tue Oct 25 21:51:04 2005
@@ -84,11 +84,11 @@
     {
         return new IoFilter()
         {
-            public void filterAdded( Object parent )
+            public void filterAdded( NextFilter nextFilter, Object parent )
             {
             }
             
-            public void filterRemoved( Object parent )
+            public void filterRemoved( NextFilter nextFilter, Object parent )
             {
             }
 
@@ -156,11 +156,11 @@
     {
         return new IoFilter()
         {
-            public void filterAdded( Object parent )
+            public void filterAdded( NextFilter nextFilter, Object parent )
             {
             }
             
-            public void filterRemoved( Object parent )
+            public void filterRemoved( NextFilter nextFilter, Object parent )
             {
             }
            
@@ -242,7 +242,7 @@
     
     /**
      * Adds the specified interceptor with the specified name at the beginning of this chain.
-     * @throws Exception if {@link IoFilter#filterAdded(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterAdded(NextFilter, Object)} thrown an exception.
      */
     public synchronized void addFirst( String name,
                                        IoFilter filter ) throws Exception
@@ -254,7 +254,7 @@
 
     /**
      * Adds the specified interceptor with the specified name at the end of this chain.
-     * @throws Exception if {@link IoFilter#filterAdded(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterAdded(NextFilter, Object)} thrown an exception.
      */
     public synchronized void addLast( String name,
                                       IoFilter filter ) throws Exception
@@ -267,7 +267,7 @@
     /**
      * Adds the specified interceptor with the specified name just before the interceptor
whose name is
      * <code>baseName</code> in this chain.
-     * @throws Exception if {@link IoFilter#filterAdded(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterAdded(NextFilter, Object)} thrown an exception.
      */
     public synchronized void addBefore( String baseName,
                                         String name,
@@ -282,7 +282,7 @@
     /**
      * Adds the specified interceptor with the specified name just after the interceptor
whose name is
      * <code>baseName</code> in this chain.
-     * @throws Exception if {@link IoFilter#filterAdded(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterAdded(NextFilter, Object)} thrown an exception.
      */
     public synchronized void addAfter( String baseName,
                                        String name,
@@ -296,7 +296,7 @@
 
     /**
      * Removes the interceptor with the specified name from this chain.
-     * @throws Exception if {@link IoFilter#filterRemoved(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterRemoved(NextFilter, Object)} thrown an
exception.
      */
     public synchronized IoFilter remove( String name ) throws Exception
     {
@@ -311,7 +311,7 @@
         IoFilter filter = entry.filter;
         filter2entry.remove( filter );
         
-        filter.filterRemoved( parent );
+        filter.filterRemoved( entry.nextFilter, parent );
 
         return filter;
     }
@@ -319,7 +319,7 @@
 
     /**
      * Removes all interceptors added to this chain.
-     * @throws Exception if {@link IoFilter#filterRemoved(Object)} thrown an exception.
+     * @throws Exception if {@link IoFilter#filterRemoved(NextFilter, Object)} thrown an
exception.
      */
     public synchronized void clear() throws Exception
     {
@@ -332,9 +332,10 @@
 
     private void register( Entry prevEntry, String name, IoFilter filter ) throws Exception
     {
-        filter.filterAdded( parent );
-        
         Entry newEntry = new Entry( prevEntry, prevEntry.nextEntry, name, filter );
+
+        filter.filterAdded( newEntry.nextFilter, parent );
+        
         prevEntry.nextEntry.prevEntry = newEntry;
         prevEntry.nextEntry = newEntry;
         name2entry.put( name, newEntry );

Modified: directory/network/trunk/src/java/org/apache/mina/common/support/IoSessionManagerFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/support/IoSessionManagerFilterChain.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/support/IoSessionManagerFilterChain.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/common/support/IoSessionManagerFilterChain.java
Tue Oct 25 21:51:04 2005
@@ -25,7 +25,6 @@
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionManager;
 
-
 /**
  * An {@link IoFilterChain} that forwards all events
  * except <tt>filterWrite</tt> to the {@link IoSessionFilterChain}
@@ -52,11 +51,11 @@
     {
         return new IoFilter()
         {
-            public void filterAdded( Object parent )
+            public void filterAdded( NextFilter nextFilter, Object parent )
             {
             }
             
-            public void filterRemoved( Object parent )
+            public void filterRemoved( NextFilter nextFilter, Object parent )
             {
             }
 

Modified: directory/network/trunk/src/java/org/apache/mina/filter/LoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/LoggingFilter.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/LoggingFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/LoggingFilter.java Tue Oct 25
21:51:04 2005
@@ -108,11 +108,11 @@
         nextFilter.filterClose( session, closeFuture );
     }
 
-    public void filterAdded( Object parent ) throws Exception
+    public void filterAdded( NextFilter nextFilter, Object parent ) throws Exception
     {
     }
 
-    public void filterRemoved( Object parent ) throws Exception
+    public void filterRemoved( NextFilter nextFilter, Object parent ) throws Exception
     {
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/filter/SSLFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/SSLFilter.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/SSLFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/SSLFilter.java Tue Oct 25 21:51:04
2005
@@ -222,6 +222,14 @@
     {
         this.enabledProtocols = protocols;
     }
+    
+    public void filterAdded( NextFilter nextFilter, Object parent ) throws SSLException
+    {
+        if( parent instanceof IoSession )
+        {
+            createSSLSessionHandler( nextFilter, ( IoSession ) parent );
+        }
+    }
 
     // IoFilter impl.
 

Modified: directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java Tue Oct
25 21:51:04 2005
@@ -649,7 +649,7 @@
         nextFilter.filterClose( session, closeFuture );
     }
 
-    public synchronized void filterAdded( Object parent )
+    public synchronized void filterAdded( NextFilter nextFilter, Object parent )
     {
         if( parents.size() > 0 )
         {
@@ -664,7 +664,7 @@
         leader.lead();
     }
 
-    public synchronized void filterRemoved( Object parent )
+    public synchronized void filterRemoved( NextFilter nextFilter, Object parent )
     {
         parents.remove( parent );
         if( parents.size() > 0 )

Modified: directory/network/trunk/src/test/org/apache/mina/common/IoFilterChainTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/common/IoFilterChainTest.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/common/IoFilterChainTest.java (original)
+++ directory/network/trunk/src/test/org/apache/mina/common/IoFilterChainTest.java Tue Oct
25 21:51:04 2005
@@ -232,23 +232,23 @@
             nextFilter.filterClose( session, closeFuture );
         }
 
-        public void filterAdded( Object parent ) throws Exception
+        public void filterAdded( NextFilter nextFilter, Object parent ) throws Exception
         {
         }
 
-        public void filterRemoved( Object parent ) throws Exception
+        public void filterRemoved( NextFilter nextFilter, Object parent ) throws Exception
         {
         }
     }
 
     private class AddRemoveTestFilter extends IoFilterAdapter
     {
-        public void filterAdded( Object parent )
+        public void filterAdded( NextFilter nextFilter, Object parent )
         {
             result += "ADDED";
         }
         
-        public void filterRemoved( Object parent )
+        public void filterRemoved( NextFilter nextFilter, Object parent )
         {
             result += "REMOVED";
         }

Modified: directory/network/trunk/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java?rev=328557&r1=328556&r2=328557&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
(original)
+++ directory/network/trunk/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
Tue Oct 25 21:51:04 2005
@@ -29,12 +29,12 @@
     public void setUp()
     {
         filter = new ThreadPoolFilter();
-        filter.filterAdded( FILTER_PARENT );
+        filter.filterAdded( null, FILTER_PARENT );
     }
     
     public void tearDown()
     {
-        filter.filterRemoved( FILTER_PARENT );
+        filter.filterRemoved( null, FILTER_PARENT );
         Assert.assertEquals( 0, filter.getPoolSize() );
         filter = null;
     }



Mime
View raw message