directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r371256 - in /directory/sandbox/trustin/mina-spi/examples/src: main/java/org/apache/mina/examples/echoserver/ main/java/org/apache/mina/examples/httpserver/ main/java/org/apache/mina/examples/netcat/ main/java/org/apache/mina/examples/rever...
Date Sun, 22 Jan 2006 10:17:58 GMT
Author: trustin
Date: Sun Jan 22 02:17:46 2006
New Revision: 371256

URL: http://svn.apache.org/viewcvs?rev=371256&view=rev
Log:
Fixed compilation errors

Modified:
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/httpserver/Main.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/netcat/Main.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/reverser/Main.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Server.java
    directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/tennis/Main.java
    directory/sandbox/trustin/mina-spi/examples/src/test/java/org/apache/mina/examples/echoserver/AbstractTest.java

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/echoserver/Main.java
Sun Jan 22 02:17:46 2006
@@ -19,7 +19,7 @@
 package org.apache.mina.examples.echoserver;
 
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
-import org.apache.mina.common.MINA;
+import org.apache.mina.common.IoService;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
 import org.apache.mina.filter.LoggingFilter;
 import org.apache.mina.filter.SSLFilter;
@@ -51,7 +51,7 @@
         addLogger( chain );
         
         // Bind
-        MINA.bind( "nio:socket:*:" + PORT, new EchoProtocolHandler(), chain );
+        IoService.bind( "nio:socket:*:" + PORT, new EchoProtocolHandler(), chain );
 
         System.out.println( "Listening on port " + PORT );
     }

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/httpserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/httpserver/Main.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/httpserver/Main.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/httpserver/Main.java
Sun Jan 22 02:17:46 2006
@@ -19,7 +19,7 @@
 package org.apache.mina.examples.httpserver;
 
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
-import org.apache.mina.common.MINA;
+import org.apache.mina.common.IoService;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
 import org.apache.mina.filter.SSLFilter;
 
@@ -47,7 +47,7 @@
         }
 
         // Bind
-        MINA.bind( "nio:socket:*:" + PORT, new HttpProtocolHandler(), chain );
+        IoService.bind( "nio:socket:*:" + PORT, new HttpProtocolHandler(), chain );
         System.out.println( "Listening on port " + PORT );
     }
 

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/netcat/Main.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/netcat/Main.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/netcat/Main.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/netcat/Main.java
Sun Jan 22 02:17:46 2006
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.examples.netcat;
 
-import org.apache.mina.common.MINA;
+import org.apache.mina.common.IoService;
 
 /**
  * (<b>Entry point</b>) NetCat client.  NetCat client connects to the specified
@@ -40,8 +40,9 @@
 
         
         // Start communication.
-        MINA.connect( 
-                "nio:socket:" + args[0] + ':' + args[1],
+        IoService.connect( 
+                "nio:socket:" + args[0] + ':' + args[1] +
+                "?connectTimeout=10",
                 new NetCatProtocolHandler() );
     }
 }

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/reverser/Main.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/reverser/Main.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/reverser/Main.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/reverser/Main.java
Sun Jan 22 02:17:46 2006
@@ -18,7 +18,7 @@
  */
 package org.apache.mina.examples.reverser;
 
-import org.apache.mina.common.MINA;
+import org.apache.mina.common.IoService;
 
 /**
  * (<b>Entry point</b>) Reverser server which reverses all text lines from
@@ -34,7 +34,7 @@
     public static void main( String[] args ) throws Exception
     {
         // Bind
-        MINA.bind(
+        IoService.bind(
                 "nio:socket:*:" + PORT,
                 new ReverseProtocolHandler() );
 

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Client.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
Sun Jan 22 02:17:46 2006
@@ -19,13 +19,10 @@
 package org.apache.mina.examples.sumup;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
 
 import org.apache.mina.common.ConnectFuture;
-import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.ThreadPoolFilter;
-import org.apache.mina.transport.socket.nio.SocketConnector;
 
 /**
  * (<strong>Entry Point</strong>) Starts SumUp client.
@@ -56,27 +53,14 @@
             values[ i ] = Integer.parseInt( args[ i ] );
         }
 
-        // Create I/O and Protocol thread pool filter.
-        // I/O thread pool performs encoding and decoding of messages.
-        // Protocol thread pool performs actual protocol flow.
-        ThreadPoolFilter ioThreadPoolFilter = new ThreadPoolFilter();
-        ThreadPoolFilter protocolThreadPoolFilter = new ThreadPoolFilter();
-        IoConnector connector = new SocketConnector();
-        connector.getFilterChain().addFirst(
-                "ioThreadPool", ioThreadPoolFilter );
-        connector.getFilterChain().addLast(
-                "protocolThreadPool", protocolThreadPoolFilter );
-
-        // Set connect timeout.
-        connector.setConnectTimeout( CONNECT_TIMEOUT );
-        
         IoSession session;
         for( ;; )
         {
             try
             {
-                ConnectFuture future = connector.connect(
-                        new InetSocketAddress( HOSTNAME, PORT ),
+                ConnectFuture future = IoService.connect(
+                        "nio:socket:" + HOSTNAME + ':' + PORT +
+                        "?connectTimeout=" + CONNECT_TIMEOUT,
                         new ClientSessionHandler( USE_CUSTOM_CODEC, values ) );
                 
                 future.join();

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Server.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Server.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Server.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/sumup/Server.java
Sun Jan 22 02:17:46 2006
@@ -18,10 +18,7 @@
  */
 package org.apache.mina.examples.sumup;
 
-import org.apache.mina.common.TransportType;
-import org.apache.mina.registry.Service;
-import org.apache.mina.registry.ServiceRegistry;
-import org.apache.mina.registry.SimpleServiceRegistry;
+import org.apache.mina.common.IoService;
 
 /**
  * (<strong>Entry Point</strong>) Starts SumUp server.
@@ -37,11 +34,8 @@
 
     public static void main( String[] args ) throws Throwable
     {
-        // Create ServiceRegistry.
-        ServiceRegistry registry = new SimpleServiceRegistry();
-
-        registry.bind(
-                new Service( "sumUp", TransportType.SOCKET, SERVER_PORT ),
+        IoService.bind(
+                "nio:socket:*:" + SERVER_PORT,
                 new ServerSessionHandler( USE_CUSTOM_CODEC ) );
 
         System.out.println( "Listening on port " + SERVER_PORT );

Modified: directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/tennis/Main.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/tennis/Main.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/tennis/Main.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/main/java/org/apache/mina/examples/tennis/Main.java
Sun Jan 22 02:17:46 2006
@@ -4,9 +4,8 @@
 package org.apache.mina.examples.tennis;
 
 import org.apache.mina.common.ConnectFuture;
-import org.apache.mina.common.IoAddress;
+import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.MINA;
 
 /**
  * (<b>Entry point</b>) An 'in-VM pipe' example which simulates a tennis game
@@ -28,11 +27,11 @@
     public static void main( String[] args ) throws Exception
     {
         // Set up server
-        MINA.bind( "vm:pipe:8080", new TennisPlayer() );
+        IoService.bind( "vm:pipe:8080", new TennisPlayer() );
 
         // Connect to the server.
-        ConnectFuture future = MINA.connect(
-                new IoAddress( "vm:pipe:8080" ),
+        ConnectFuture future = IoService.connect(
+                "vm:pipe:8080",
                 new TennisPlayer() );
         
         future.join();
@@ -44,6 +43,6 @@
         // Wait until the match ends.
         session.getCloseFuture().join();
         
-        MINA.unbind( new IoAddress( "vm:pipe:8080" ) );
+        IoService.unbind( "vm:pipe:8080" );
     }
 }

Modified: directory/sandbox/trustin/mina-spi/examples/src/test/java/org/apache/mina/examples/echoserver/AbstractTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/examples/src/test/java/org/apache/mina/examples/echoserver/AbstractTest.java?rev=371256&r1=371255&r2=371256&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/examples/src/test/java/org/apache/mina/examples/echoserver/AbstractTest.java
(original)
+++ directory/sandbox/trustin/mina-spi/examples/src/test/java/org/apache/mina/examples/echoserver/AbstractTest.java
Sun Jan 22 02:17:46 2006
@@ -16,16 +16,15 @@
  *   limitations under the License.
  *
  */
-package org.apache.mina.examples.echoserver;
+package org.apache.IoService.examples.echoserver;
 
 import java.io.IOException;
 
 import junit.framework.TestCase;
 
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoAddress;
+import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.MINA;
 import org.apache.mina.filter.LoggingFilter;
 import org.apache.mina.filter.SSLFilter;
 import org.apache.mina.util.SessionLog;
@@ -88,7 +87,7 @@
             
             try
             {
-                MINA.bind( "nio:socket:*:" + port, new EchoProtocolHandler()
+                IoService.bind( "nio:socket:*:" + port, new EchoProtocolHandler()
                 {
                     // This is for TLS reentrance test
                     public void messageReceived( IoSession session, Object message ) throws
Exception
@@ -119,7 +118,7 @@
                 } );
                 socketBound = true;
 
-                MINA.bind( "nio:datagram:*:" + port, new EchoProtocolHandler() );
+                IoService.bind( "nio:datagram:*:" + port, new EchoProtocolHandler() );
                 datagramBound = true;
 
                 break;
@@ -131,8 +130,8 @@
             {
                 if( !socketBound || !datagramBound )
                 {
-                    MINA.unbind( "nio:socket:*:" + port );
-                    MINA.unbind( "nio:datagram:*:" + port );
+                    IoService.unbind( "nio:socket:*:" + port );
+                    IoService.unbind( "nio:datagram:*:" + port );
                 }
             }
         }



Mime
View raw message