directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r349902 - in /directory/network/branches/chain_refactor/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, 30 Nov 2005 07:12:15 GMT
Author: trustin
Date: Tue Nov 29 23:11:32 2005
New Revision: 349902

URL: http://svn.apache.org/viewcvs?rev=349902&view=rev
Log:
* Added filter name parameter to IoFilter.init() and destroy()

Modified:
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilter.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterAdapter.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterChain.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/LoggingFilter.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/SSLFilter.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/common/FutureTest.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/common/IoFilterChainTest.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
Tue Nov 29 23:11:32 2005
@@ -169,7 +169,6 @@
 
     /**
      * Removes all filters added to this chain.
-     * @throws Exception if {@link IoFilter#destroy(IoFilterChain, NextFilter)} thrown an
exception.
      */
     public synchronized void clear() throws Exception
     {

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilter.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilter.java
Tue Nov 29 23:11:32 2005
@@ -49,10 +49,11 @@
      * this filter is added to more than one parents.
      *
      * @param parent the parent who called this method
+     * @param name the name assigned to this filter
      * @param nextFilter the {@link NextFilter} for this filter.  You can reuse
      *                   this object until this filter is removed from the chain.
      */
-    void init( IoFilterChain parent, NextFilter nextFilter ) throws Exception;
+    void init( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception;
     
     /**
      * Invoked when this filter is removed from the specified <tt>parent</tt>.
@@ -60,10 +61,11 @@
      * this filter is removed from more than one parents.
      *
      * @param parent the parent who called this method
+     * @param name the name assigned to this filter
      * @param nextFilter the {@link NextFilter} for this filter.  You can reuse
      *                   this object until this filter is removed from the chain.
      */
-    void destroy( IoFilterChain parent, NextFilter nextFilter ) throws Exception;
+    void destroy( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception;
     
     /**
      * Filters {@link IoHandler#sessionCreated(IoSession)} event.

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterAdapter.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterAdapter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterAdapter.java
Tue Nov 29 23:11:32 2005
@@ -28,11 +28,11 @@
  */
 public class IoFilterAdapter implements IoFilter
 {
-    public void init( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+    public void init( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception
     {
     }
     
-    public void destroy( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+    public void destroy( IoFilterChain parent, String name, NextFilter nextFilter ) throws
Exception
     {
     }
     

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterChain.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterChain.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoFilterChain.java
Tue Nov 29 23:11:32 2005
@@ -54,39 +54,39 @@
 
     /**
      * Adds the specified filter with the specified name at the beginning of this chain.
-     * @throws Exception if {@link IoFilter#init(IoFilterChain, NextFilter)} thrown an exception.
+     * @throws Exception if {@link IoFilter#init(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     void addFirst( String name, IoFilter filter ) throws Exception;
 
     /**
      * Adds the specified filter with the specified name at the end of this chain.
-     * @throws Exception if {@link IoFilter#init(IoFilterChain, NextFilter)} thrown an exception.
+     * @throws Exception if {@link IoFilter#init(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     void addLast( String name, IoFilter filter ) throws Exception;
 
     /**
      * Adds the specified filter with the specified name just before the filter whose name
is
      * <code>baseName</code> in this chain.
-     * @throws Exception if {@link IoFilter#init(IoFilterChain, NextFilter)} thrown an exception.
+     * @throws Exception if {@link IoFilter#init(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     void addBefore( String baseName, String name, IoFilter filter ) throws Exception;
 
     /**
      * Adds the specified filter with the specified name just after the filter whose name
is
      * <code>baseName</code> in this chain.
-     * @throws Exception if {@link IoFilter#init(IoFilterChain, NextFilter)} thrown an exception.
+     * @throws Exception if {@link IoFilter#init(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     void addAfter( String baseName, String name, IoFilter filter ) throws Exception;
 
     /**
      * Removes the filter with the specified name from this chain.
-     * @throws Exception if {@link IoFilter#destroy(IoFilterChain, NextFilter)} thrown an
exception.
+     * @throws Exception if {@link IoFilter#destroy(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     IoFilter remove( String name ) throws Exception;
 
     /**
      * Removes all filters added to this chain.
-     * @throws Exception if {@link IoFilter#destroy(IoFilterChain, NextFilter)} thrown an
exception.
+     * @throws Exception if {@link IoFilter#destroy(IoFilterChain, String, NextFilter)} thrown
an exception.
      */
     void clear() throws Exception;
     

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/AbstractIoFilterChain.java
Tue Nov 29 23:11:32 2005
@@ -78,11 +78,11 @@
     {
         return new IoFilter()
         {
-            public void init( IoFilterChain parent, NextFilter nextFilter )
+            public void init( IoFilterChain parent, String name, NextFilter nextFilter )
             {
             }
             
-            public void destroy( IoFilterChain parent, NextFilter nextFilter )
+            public void destroy( IoFilterChain parent, String name, NextFilter nextFilter
)
             {
             }
             
@@ -155,11 +155,11 @@
     {
         return new IoFilter()
         {
-            public void init( IoFilterChain parent, NextFilter nextFilter )
+            public void init( IoFilterChain parent, String name, NextFilter nextFilter )
             {
             }
             
-            public void destroy( IoFilterChain parent, NextFilter nextFilter )
+            public void destroy( IoFilterChain parent, String name, NextFilter nextFilter
)
             {
             }
            
@@ -303,7 +303,7 @@
     {
         EntryImpl newEntry = new EntryImpl( prevEntry, prevEntry.nextEntry, name, filter
);
 
-        filter.init( this, newEntry.getNextFilter() );
+        filter.init( this, name, newEntry.getNextFilter() );
         
         prevEntry.nextEntry.prevEntry = newEntry;
         prevEntry.nextEntry = newEntry;
@@ -322,7 +322,7 @@
         IoFilter filter = entry.getFilter();
         filter2entry.remove( filter );
         
-        filter.destroy( this, entry.getNextFilter() );
+        filter.destroy( this, entry.getName(), entry.getNextFilter() );
     }
 
     /**

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/LoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/LoggingFilter.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/LoggingFilter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/LoggingFilter.java
Tue Nov 29 23:11:32 2005
@@ -53,14 +53,6 @@
     {
     }
     
-    public void init()
-    {
-    }
-    
-    public void destroy()
-    {
-    }
-    
     public void sessionCreated( NextFilter nextFilter, IoSession session )
     {
         nextFilter.sessionCreated( session );
@@ -114,11 +106,11 @@
         nextFilter.filterClose( session, closeFuture );
     }
 
-    public void init( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+    public void init( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception
     {
     }
 
-    public void destroy( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+    public void destroy( IoFilterChain parent, String name, NextFilter nextFilter ) throws
Exception
     {
     }
 }

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/SSLFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/SSLFilter.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/SSLFilter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/SSLFilter.java
Tue Nov 29 23:11:32 2005
@@ -113,10 +113,9 @@
      */
     public static final SSLFilterMessage SESSION_UNSECURED = new SSLFilterMessage( "SESSION_UNSECURED"
);
     
+    private static final String NEXT_FILTER = SSLFilter.class.getName() + ".NextFilter";
     private static final String SSL_HANDLER = SSLFilter.class.getName() + ".SSLHandler";
 
-    private IoFilterChain parent;
-    
     // SSL Context
     private SSLContext sslContext;
 
@@ -179,7 +178,7 @@
                 }
             }
             
-            createSSLSessionHandler( parent.get( this ).getNextFilter(), session );
+            createSSLSessionHandler( ( NextFilter ) session.getAttribute( NEXT_FILTER ),
session );
             return true;
         }
     }
@@ -228,7 +227,7 @@
                 throw new IllegalArgumentException( "Not managed by this filter." );
             }
             
-            NextFilter nextFilter = parent.get( this ).getNextFilter();
+            NextFilter nextFilter = ( NextFilter ) session.getAttribute( NEXT_FILTER );
             return initiateClosure( nextFilter, session );
         }
     }
@@ -331,9 +330,9 @@
         this.enabledProtocols = protocols;
     }
     
-    public void init( IoFilterChain parent, NextFilter nextFilter ) throws SSLException
+    public void init( IoFilterChain parent, String name, NextFilter nextFilter ) throws SSLException
     {
-        this.parent = parent;
+        parent.getSession().setAttribute( NEXT_FILTER, nextFilter );
         Object managerOrSession = parent.getSession();
         if( managerOrSession instanceof IoSession )
         {
@@ -341,7 +340,7 @@
         }
     }
     
-    public void destroy( IoFilterChain parent, NextFilter nextFilter )
+    public void destroy( IoFilterChain parent, String name, NextFilter nextFilter )
     {
         
     }

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/filter/ThreadPoolFilter.java
Tue Nov 29 23:11:32 2005
@@ -648,7 +648,7 @@
         nextFilter.filterClose( session, closeFuture );
     }
 
-    public synchronized void init( IoFilterChain parent, NextFilter nextFilter )
+    public synchronized void init( IoFilterChain parent, String name, NextFilter nextFilter
)
     {
         if( parents.size() > 0 )
         {
@@ -663,7 +663,7 @@
         leader.lead();
     }
 
-    public synchronized void destroy( IoFilterChain parent, NextFilter nextFilter )
+    public synchronized void destroy( IoFilterChain parent, String name, NextFilter nextFilter
)
     {
         parents.remove( parent );
         if( parents.size() > 0 )

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/common/FutureTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/common/FutureTest.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/common/FutureTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/common/FutureTest.java
Tue Nov 29 23:11:32 2005
@@ -116,6 +116,11 @@
             {
                 return false;
             }
+
+            public IoSessionManager getManager()
+            {
+                return null;
+            }
         };
         
         future.setSession( session );

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/common/IoFilterChainTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/common/IoFilterChainTest.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/common/IoFilterChainTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/common/IoFilterChainTest.java
Tue Nov 29 23:11:32 2005
@@ -321,23 +321,23 @@
             nextFilter.filterClose( session, closeFuture );
         }
 
-        public void init( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+        public void init( IoFilterChain parent, String name, NextFilter nextFilter ) throws
Exception
         {
         }
 
-        public void destroy( IoFilterChain parent, NextFilter nextFilter ) throws Exception
+        public void destroy( IoFilterChain parent, String name, NextFilter nextFilter ) throws
Exception
         {
         }
     }
 
     private class AddRemoveTestFilter extends IoFilterAdapter
     {
-        public void init( IoFilterChain parent, NextFilter nextFilter )
+        public void init( IoFilterChain parent, String name, NextFilter nextFilter )
         {
             result += "ADDED";
         }
         
-        public void destroy( IoFilterChain parent, NextFilter nextFilter )
+        public void destroy( IoFilterChain parent, String name, NextFilter nextFilter )
         {
             result += "REMOVED";
         }

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java?rev=349902&r1=349901&r2=349902&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
Tue Nov 29 23:11:32 2005
@@ -39,12 +39,12 @@
     public void setUp()
     {
         filter = new ThreadPoolFilter();
-        filter.init( FILTER_PARENT, null );
+        filter.init( FILTER_PARENT, "", null );
     }
     
     public void tearDown()
     {
-        filter.destroy( FILTER_PARENT, null );
+        filter.destroy( FILTER_PARENT, "", null );
         Assert.assertEquals( 0, filter.getPoolSize() );
         filter = null;
     }
@@ -123,8 +123,8 @@
             
             future.join();
             
-            filter.destroy( FILTER_PARENT, null );
-            filter.init( FILTER_PARENT, null );
+            filter.destroy( FILTER_PARENT, "", null );
+            filter.init( FILTER_PARENT, "", null );
         }
     }
     



Mime
View raw message