directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r349933 - in /directory/network/branches/chain_refactor/src: examples/org/apache/mina/examples/echoserver/ examples/org/apache/mina/examples/httpserver/ examples/org/apache/mina/examples/sumup/ java/org/apache/mina/common/ java/org/apache/m...
Date Wed, 30 Nov 2005 12:34:32 GMT
Author: trustin
Date: Wed Nov 30 04:34:02 2005
New Revision: 349933

URL: http://svn.apache.org/viewcvs?rev=349933&view=rev
Log:
* The default value of IoSessionManager.filterChainBuilder is now an empty DefaultIoFilterChainBuilder.
* Fixed all compilation errors except spring integration

Modified:
    directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/echoserver/Main.java
    directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/httpserver/Main.java
    directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/sumup/Client.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoSessionManager.java
    directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/BaseIoSessionManager.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java
    directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java

Modified: directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/echoserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/echoserver/Main.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/echoserver/Main.java
(original)
+++ directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/echoserver/Main.java
Wed Nov 30 04:34:02 2005
@@ -18,6 +18,7 @@
  */
 package org.apache.mina.examples.echoserver;
 
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
@@ -66,14 +67,14 @@
         SSLFilter sslFilter =
             new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
         IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "sslFilter",
sslFilter );
         System.out.println( "SSL ON" );
     }
     
     private static void addLogger( ServiceRegistry registry ) throws Exception
     {
         IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "logger", new LoggingFilter() );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "logger",
new LoggingFilter() );
         System.out.println( "Logging ON" );
     }
 }

Modified: directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/httpserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/httpserver/Main.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/httpserver/Main.java
(original)
+++ directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/httpserver/Main.java
Wed Nov 30 04:34:02 2005
@@ -18,6 +18,7 @@
  */
 package org.apache.mina.examples.httpserver;
 
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
@@ -64,6 +65,6 @@
         SSLFilter sslFilter =
             new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
         IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "sslFilter",
sslFilter );
     }
 }

Modified: directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/sumup/Client.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/sumup/Client.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/sumup/Client.java
(original)
+++ directory/network/branches/chain_refactor/src/examples/org/apache/mina/examples/sumup/Client.java
Wed Nov 30 04:34:02 2005
@@ -22,6 +22,7 @@
 import java.net.InetSocketAddress;
 
 import org.apache.mina.common.ConnectFuture;
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.ThreadPoolFilter;
@@ -62,9 +63,9 @@
         ThreadPoolFilter ioThreadPoolFilter = new ThreadPoolFilter();
         ThreadPoolFilter protocolThreadPoolFilter = new ThreadPoolFilter();
         IoConnector connector = new SocketConnector();
-        connector.getFilterChain().addFirst(
+        ( ( DefaultIoFilterChainBuilder ) connector.getFilterChainBuilder() ).addFirst(
                 "ioThreadPool", ioThreadPoolFilter );
-        connector.getFilterChain().addLast(
+        ( ( DefaultIoFilterChainBuilder ) connector.getFilterChainBuilder() ).addLast(
                 "protocolThreadPool", protocolThreadPoolFilter );
 
         // Set connect timeout.
@@ -93,8 +94,5 @@
 
         // wait until the summation is done
         session.getCloseFuture().join();
-        
-        // Clear the filter chain so that they are deinitialized.
-        connector.getFilterChain().clear();
     }
 }

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoSessionManager.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoSessionManager.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/IoSessionManager.java
Wed Nov 30 04:34:02 2005
@@ -36,7 +36,7 @@
     /**
      * Returns the {@link IoFilterChain} which will affect the {@link IoFilterChain}
      * of all {@link IoSession}s which is managed by this manager.
-     * The default value is {@link IoFilterChainBuilder#NOOP}.
+     * The default value is an empty {@link DefaultIoFilterChainBuilder}.
      */
     IoFilterChainBuilder getFilterChainBuilder();
     
@@ -44,7 +44,7 @@
      * Sets the {@link IoFilterChain} which will affect the {@link IoFilterChain}
      * of all {@link IoSession}s which is managed by this manager.
      * If you specify <tt>null</tt> this property will be set to
-     * {@link IoFilterChainBuilder#NOOP}.
+     * an empty {@link DefaultIoFilterChainBuilder}.
      */
     void setFilterChainBuilder( IoFilterChainBuilder builder );
     

Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/BaseIoSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/BaseIoSessionManager.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/BaseIoSessionManager.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/common/support/BaseIoSessionManager.java
Wed Nov 30 04:34:02 2005
@@ -18,6 +18,7 @@
  */
 package org.apache.mina.common.support;
 
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoFilterChainBuilder;
 import org.apache.mina.common.IoSessionManager;
@@ -38,7 +39,7 @@
     /**
      * Current filter chain builder.
      */
-    protected IoFilterChainBuilder filterChainBuilder = IoFilterChainBuilder.NOOP;
+    protected IoFilterChainBuilder filterChainBuilder = new DefaultIoFilterChainBuilder();
 
     protected BaseIoSessionManager()
     {
@@ -53,7 +54,7 @@
     {
         if( builder == null )
         {
-            builder = IoFilterChainBuilder.NOOP;
+            builder = new DefaultIoFilterChainBuilder();
         }
         filterChainBuilder = builder;
     }

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AbstractTest.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
Wed Nov 30 04:34:02 2005
@@ -23,6 +23,7 @@
 import junit.framework.TestCase;
 
 import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.filter.LoggingFilter;
@@ -113,7 +114,7 @@
                         if( buf.remaining() == 1 && buf.get() == ( byte ) '.' )
                         {
                             SessionLog.info( session, "TLS Reentrance" );
-                            ( ( SSLFilter ) acceptor.getFilterChain().get( "SSL" ) ).startSSL(
session );
+                            ( ( SSLFilter ) ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder()
).get( "SSL" ).getFilter() ).startSSL( session );
 
                             // Send a response
                             buf = ByteBuffer.allocate( 1 );
@@ -153,8 +154,8 @@
             throw new IOException( "Cannot bind any test port." );
         }
 
-        registry.getAcceptor( TransportType.SOCKET ).getFilterChain().addLast( "logger",
new LoggingFilter() );
-        registry.getAcceptor( TransportType.DATAGRAM ).getFilterChain().addLast( "logger",
new LoggingFilter() );
+        ( ( DefaultIoFilterChainBuilder ) registry.getAcceptor( TransportType.SOCKET ).getFilterChainBuilder()
).addLast( "logger", new LoggingFilter() );
+        ( ( DefaultIoFilterChainBuilder ) registry.getAcceptor( TransportType.DATAGRAM ).getFilterChainBuilder()
).addLast( "logger", new LoggingFilter() );
 
         System.out.println( "Using port " + port + " for testing." );
     }
@@ -162,7 +163,7 @@
     protected void tearDown() throws Exception
     {
         registry.unbindAll();
-        registry.getAcceptor( TransportType.SOCKET ).getFilterChain().remove( "logger" );
-        registry.getAcceptor( TransportType.DATAGRAM ).getFilterChain().remove( "logger"
);
+        ( ( DefaultIoFilterChainBuilder ) registry.getAcceptor( TransportType.SOCKET ).getFilterChainBuilder()
).remove( "logger" );
+        ( ( DefaultIoFilterChainBuilder ) registry.getAcceptor( TransportType.DATAGRAM ).getFilterChainBuilder()
).remove( "logger" );
     }
 }

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java
Wed Nov 30 04:34:02 2005
@@ -30,6 +30,7 @@
 
 import org.apache.commons.net.EchoTCPClient;
 import org.apache.commons.net.EchoUDPClient;
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
@@ -61,7 +62,7 @@
         SSLFilter sslFilter =
             new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
         IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "SSL", sslFilter );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "SSL",
sslFilter );
         
         // Create a commons-net socket factory
         SSLSocketFactory.setSslEnabled(true);

Modified: directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java?rev=349933&r1=349932&r2=349933&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
(original)
+++ directory/network/branches/chain_refactor/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
Wed Nov 30 04:34:02 2005
@@ -26,6 +26,7 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ConnectFuture;
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoHandlerAdapter;
@@ -68,7 +69,7 @@
         SSLFilter acceptorSSLFilter =
             new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
         IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "SSL", acceptorSSLFilter );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "SSL",
acceptorSSLFilter );
         
         // Create a connector
         IoConnector connector = new SocketConnector();
@@ -77,7 +78,7 @@
         SSLFilter connectorSSLFilter =
             new SSLFilter( BogusSSLContextFactory.getInstance( false ) );
         connectorSSLFilter.setUseClientMode( true ); // set client mode
-        connector.getFilterChain().addLast( "SSL", connectorSSLFilter );
+        ( ( DefaultIoFilterChainBuilder ) acceptor.getFilterChainBuilder() ).addLast( "SSL",
connectorSSLFilter );
 
         testConnector( connector );
     }
@@ -142,10 +143,10 @@
         testConnector0( session );
         
         // Send closeNotify to test TLS closure if it is TLS connection.
-        SSLFilter sslf = ( SSLFilter ) connector.getFilterChain().get("SSL");
+        SSLFilter sslf = ( SSLFilter ) ( ( DefaultIoFilterChainBuilder ) connector.getFilterChainBuilder()
).get( "SSL" ).getFilter();
         if( sslf != null )
         {
-            connector.getFilterChain().addFirst( "log", new LoggingFilter() );
+            ( ( DefaultIoFilterChainBuilder ) connector.getFilterChainBuilder() ).addFirst(
"log", new LoggingFilter() );
             sslf.stopSSL( session ).join();
             
             System.out.println( "-------------------------------------------------------------------------------"
);
@@ -172,7 +173,7 @@
             // Now start TLS connection
             Assert.assertTrue( sslf.startSSL( session ) );
             testConnector0( session );
-            connector.getFilterChain().remove( "log" );
+            ( ( DefaultIoFilterChainBuilder ) connector.getFilterChainBuilder() ).remove(
"log" );
         }
         
         session.close().join();



Mime
View raw message