directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r370972 - in /directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina: common/ transport/socket/nio/support/
Date Sat, 21 Jan 2006 03:03:24 GMT
Author: trustin
Date: Fri Jan 20 19:03:16 2006
New Revision: 370972

URL: http://svn.apache.org/viewcvs?rev=370972&view=rev
Log:
* Fixed all compilation errors in transport.nio package

Added:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSession.java
      - copied, changed from r370948, directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Removed:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Modified:
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoSession.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/MINA.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptor.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnector.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionManager.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptor.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnector.java
    directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSession.java

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoSession.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoSession.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/IoSession.java
Fri Jan 20 19:03:16 2006
@@ -18,7 +18,6 @@
  */
 package org.apache.mina.common;
 
-import java.net.SocketAddress;
 import java.util.Set;
 
 /**
@@ -159,13 +158,13 @@
     /**
      * Returns the socket address of remote peer. 
      */
-    SocketAddress getRemoteAddress();
+    IoAddress getRemoteAddress();
 
     /**
      * Returns the socket address of local machine which is associated with this
      * session.
      */
-    SocketAddress getLocalAddress();
+    IoAddress getLocalAddress();
 
     /**
      * Returns idle time for the specified type of idleness in seconds.

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/MINA.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/MINA.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/MINA.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/common/MINA.java
Fri Jan 20 19:03:16 2006
@@ -107,6 +107,10 @@
     
     private static IoServiceProvider getProviderSafely( IoAddress address )
     {
+        if( address == null )
+        {
+            throw new NullPointerException( "address" );
+        }
     	IoServiceProvider p = getProvider( address.getProviderType(), address.getTransportType()
);
     	if( p != null )
     	{
@@ -149,6 +153,10 @@
      */
     public static void bind( IoAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder
) throws IOException
     {
+        if( handler == null )
+        {
+            throw new NullPointerException( "handler" );
+        }
     	IoAcceptor acceptor = getProviderSafely( address ).getAcceptor();
         if( filterChainBuilder == null )
         {
@@ -201,6 +209,14 @@
      */
     public static IoSession newSession( IoAddress remoteAddress, IoAddress localAddress )
     {
+        if( remoteAddress == null )
+        {
+            throw new NullPointerException( "remoteAddress" );
+        }
+        if( localAddress == null )
+        {
+            throw new NullPointerException( "localAddress" );
+        }
     	IoAcceptor acceptor = getProviderSafely( localAddress ).getAcceptor();
     	return acceptor.newSession( remoteAddress, localAddress );
     }
@@ -261,6 +277,10 @@
     public static ConnectFuture connect( IoAddress address, IoAddress localAddress,
                                          IoHandler handler, IoFilterChainBuilder filterChainBuilder
)
     {
+        if( handler == null )
+        {
+            throw new NullPointerException( "handler" );
+        }
     	IoConnector connector = getProviderSafely( address ).getConnector();
         if( filterChainBuilder == null )
         {

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptor.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptor.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptor.java
Fri Jan 20 19:03:16 2006
@@ -19,11 +19,11 @@
 package org.apache.mina.transport.socket.nio.support;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -73,22 +73,6 @@
     public void bind( IoAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder
)
             throws IOException
     {
-        if( address == null )
-            throw new NullPointerException( "address" );
-        if( handler == null )
-            throw new NullPointerException( "handler" );
-
-        if( !( address instanceof InetSocketAddress ) )
-            throw new IllegalArgumentException( "Unexpected address type: "
-                                                + address.getClass() );
-        if( ( ( InetSocketAddress ) address ).getPort() == 0 )
-            throw new IllegalArgumentException( "Unsupported port number: 0" );
-        
-        if( filterChainBuilder == null )
-        {
-            filterChainBuilder = IoFilterChainBuilder.NOOP;
-        }
-
         RegistrationRequest request = new RegistrationRequest( address, handler, filterChainBuilder
);
         synchronized( this )
         {
@@ -120,12 +104,9 @@
         }
     }
 
-    public void unbind( SocketAddress address )
+    public void unbind( IoAddress address )
     {
         // TODO: DIRMINA-93
-        if( address == null )
-            throw new NullPointerException( "address" );
-
         CancellationRequest request = new CancellationRequest( address );
         synchronized( this )
         {
@@ -170,17 +151,8 @@
         }
     }
     
-    public IoSession newSession( SocketAddress remoteAddress, SocketAddress localAddress
)
+    public IoSession newSession( IoAddress remoteAddress, IoAddress localAddress )
     {
-        if( remoteAddress == null )
-        {
-            throw new NullPointerException( "remoteAddress" );
-        }
-        if( localAddress == null )
-        {
-            throw new NullPointerException( "localAddress" );
-        }
-        
         Selector selector = this.selector;
         DatagramChannel ch = ( DatagramChannel ) channels.get( localAddress );
         if( selector == null || ch == null )
@@ -195,13 +167,12 @@
         }
 
         RegistrationRequest req = ( RegistrationRequest ) key.attachment();
-        DatagramSessionImpl s = new DatagramSessionImpl( wrapper, this, ch, req.handler );
+        DatagramSession s = new DatagramSession( this, ch, req.handler );
         s.setRemoteAddress( remoteAddress );
         s.setSelectionKey( key );
         
         try
         {
-            this.filterChainBuilder.buildFilterChain( s.getFilterChain() );
             req.filterChainBuilder.buildFilterChain( s.getFilterChain() );
             ( ( DatagramFilterChain ) s.getFilterChain() ).sessionCreated( s );
         }
@@ -213,6 +184,11 @@
         return s;
     }
     
+    public Collection getManagedSessions( IoAddress address )
+    {
+        throw new UnsupportedOperationException();
+    }
+
     public boolean getBroadcast()
     {
         return broadcast;
@@ -274,7 +250,7 @@
         }
     }
 
-    public void flushSession( DatagramSessionImpl session )
+    public void flushSession( DatagramSession session )
     {
         scheduleFlush( session );
         Selector selector = this.selector;
@@ -284,11 +260,11 @@
         }
     }
 
-    public void closeSession( DatagramSessionImpl session )
+    public void closeSession( DatagramSession session )
     {
     }
 
-    private void scheduleFlush( DatagramSessionImpl session )
+    private void scheduleFlush( DatagramSession session )
     {
         synchronized( flushingSessions )
         {
@@ -374,8 +350,8 @@
             DatagramChannel ch = ( DatagramChannel ) key.channel();
 
             RegistrationRequest req = ( RegistrationRequest ) key.attachment();
-            DatagramSessionImpl session =
-                new DatagramSessionImpl( wrapper, this, ch, req.handler );
+            DatagramSession session =
+                new DatagramSession( this, ch, req.handler );
             session.setSelectionKey( key );
             
             try
@@ -399,7 +375,7 @@
         }
     }
 
-    private void readSession( DatagramSessionImpl session )
+    private void readSession( DatagramSession session )
     {
 
         ByteBuffer readBuf = ByteBuffer.allocate( 2048 );
@@ -410,7 +386,7 @@
             if( remoteAddress != null )
             {
                 readBuf.flip();
-                session.setRemoteAddress( remoteAddress );
+                session.setRemoteAddress( SocketAddresses.compose( "datagram", remoteAddress
) );
 
                 ByteBuffer newBuf = ByteBuffer.allocate( readBuf.limit() );
                 newBuf.put( readBuf );
@@ -437,11 +413,11 @@
 
         for( ;; )
         {
-            DatagramSessionImpl session;
+            DatagramSession session;
 
             synchronized( flushingSessions )
             {
-                session = ( DatagramSessionImpl ) flushingSessions.pop();
+                session = ( DatagramSession ) flushingSessions.pop();
             }
 
             if( session == null )
@@ -458,7 +434,7 @@
         }
     }
 
-    private void flush( DatagramSessionImpl session ) throws IOException
+    private void flush( DatagramSession session ) throws IOException
     {
         DatagramChannel ch = session.getChannel();
 
@@ -503,7 +479,7 @@
 
             int pos = buf.position();
             int writtenBytes = ch
-                    .send( buf.buf(), session.getRemoteAddress() );
+                    .send( buf.buf(), SocketAddresses.parse( session.getRemoteAddress() )
);
 
             if( writtenBytes == 0 )
             {
@@ -564,7 +540,7 @@
                     ch.socket().setTrafficClass( trafficClass );
                 }
                 ch.configureBlocking( false );
-                ch.socket().bind( req.address );
+                ch.socket().bind( SocketAddresses.parse( req.address ) );
                 ch.register( selector, SelectionKey.OP_READ, req );
                 channels.put( req.address, ch );
             }
@@ -647,7 +623,7 @@
         }
     }
     
-    public void updateTrafficMask( DatagramSessionImpl session )
+    public void updateTrafficMask( DatagramSession session )
     {
         // There's no point in changing the traffic mask for sessions originating
         // from this acceptor since new sessions are created every time data is
@@ -656,14 +632,14 @@
 
     private static class RegistrationRequest
     {
-        private final SocketAddress address;
+        private final IoAddress address;
         private final IoHandler handler;
         private final IoFilterChainBuilder filterChainBuilder;
 
         private Throwable exception; 
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, IoHandler handler, IoFilterChainBuilder
filterChainBuilder )
+        private RegistrationRequest( IoAddress address, IoHandler handler, IoFilterChainBuilder
filterChainBuilder )
         {
             this.address = address;
             this.handler = handler;
@@ -673,11 +649,11 @@
 
     private static class CancellationRequest
     {
-        private final SocketAddress address;
+        private final IoAddress address;
         private boolean done;
         private RuntimeException exception;
         
-        private CancellationRequest( SocketAddress address )
+        private CancellationRequest( IoAddress address )
         {
             this.address = address;
         }

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnector.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnector.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnector.java
Fri Jan 20 19:03:16 2006
@@ -19,8 +19,6 @@
 package org.apache.mina.transport.socket.nio.support;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -30,6 +28,7 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.ExceptionMonitor;
+import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoFilterChainBuilder;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoFilter.WriteRequest;
@@ -42,7 +41,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class DatagramConnector extends BaseIoConnector implements DatagramSessionManager
+public class DatagramConnector implements DatagramSessionManager, IoConnector
 {
     private static volatile int nextId = 0;
 
@@ -66,34 +65,9 @@
     {
     }
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoFilterChainBuilder
filterChainBuilder )
-    {
-        return connect( address, null, handler, filterChainBuilder );
-    }
-
-    public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
+    public ConnectFuture connect( IoAddress address, IoAddress localAddress,
                                   IoHandler handler, IoFilterChainBuilder filterChainBuilder
)
     {
-        if( address == null )
-            throw new NullPointerException( "address" );
-        if( handler == null )
-            throw new NullPointerException( "handler" );
-
-        if( !( address instanceof InetSocketAddress ) )
-            throw new IllegalArgumentException( "Unexpected address type: "
-                                                + address.getClass() );
-        
-        if( localAddress != null && !( localAddress instanceof InetSocketAddress
) )
-        {
-            throw new IllegalArgumentException( "Unexpected local address type: "
-                                                + localAddress.getClass() );
-        }
-        
-        if( filterChainBuilder == null )
-        {
-            filterChainBuilder = IoFilterChainBuilder.NOOP;
-        }
-        
         DatagramChannel ch = null;
         boolean initialized = false;
         try
@@ -115,9 +89,9 @@
             }
             if( localAddress != null )
             {
-                ch.socket().bind( localAddress );
+                ch.socket().bind( SocketAddresses.parse( localAddress ) );
             }
-            ch.connect( address );
+            ch.connect( SocketAddresses.parse( address ) );
             ch.configureBlocking( false );
             initialized = true;
         }
@@ -233,7 +207,7 @@
         }
     }
 
-    public void closeSession( DatagramSessionImpl session )
+    public void closeSession( DatagramSession session )
     {
         synchronized( this )
         {
@@ -260,7 +234,7 @@
         selector.wakeup();
     }
 
-    public void flushSession( DatagramSessionImpl session )
+    public void flushSession( DatagramSession session )
     {
         scheduleFlush( session );
         Selector selector = this.selector;
@@ -270,7 +244,7 @@
         }
     }
 
-    private void scheduleFlush( DatagramSessionImpl session )
+    private void scheduleFlush( DatagramSession session )
     {
         synchronized( flushingSessions )
         {
@@ -278,7 +252,7 @@
         }
     }
 
-    public void updateTrafficMask( DatagramSessionImpl session )
+    public void updateTrafficMask( DatagramSession session )
     {
         scheduleTrafficControl( session );
         Selector selector = this.selector;
@@ -289,7 +263,7 @@
         selector.wakeup();
     }
     
-    private void scheduleTrafficControl( DatagramSessionImpl session )
+    private void scheduleTrafficControl( DatagramSession session )
     {
         synchronized( trafficControllingSessions )
         {
@@ -304,11 +278,11 @@
 
         for( ;; )
         {
-            DatagramSessionImpl session;
+            DatagramSession session;
 
             synchronized( trafficControllingSessions )
             {
-                session = ( DatagramSessionImpl ) trafficControllingSessions.pop();
+                session = ( DatagramSession ) trafficControllingSessions.pop();
             }
 
             if( session == null )
@@ -423,7 +397,7 @@
             SelectionKey key = ( SelectionKey ) it.next();
             it.remove();
 
-            DatagramSessionImpl session = ( DatagramSessionImpl ) key.attachment();
+            DatagramSession session = ( DatagramSession ) key.attachment();
 
             if( key.isReadable() && session.getTrafficMask().isReadable() )
             {
@@ -437,7 +411,7 @@
         }
     }
 
-    private void readSession( DatagramSessionImpl session )
+    private void readSession( DatagramSession session )
     {
 
         ByteBuffer readBuf = ByteBuffer.allocate( 2048 );
@@ -472,11 +446,11 @@
 
         for( ;; )
         {
-            DatagramSessionImpl session;
+            DatagramSession session;
 
             synchronized( flushingSessions )
             {
-                session = ( DatagramSessionImpl ) flushingSessions.pop();
+                session = ( DatagramSession ) flushingSessions.pop();
             }
 
             if( session == null )
@@ -493,7 +467,7 @@
         }
     }
 
-    private void flush( DatagramSessionImpl session ) throws IOException
+    private void flush( DatagramSession session ) throws IOException
     {
         DatagramChannel ch = session.getChannel();
 
@@ -579,13 +553,12 @@
             if( req == null )
                 break;
 
-            DatagramSessionImpl session =
-                new DatagramSessionImpl( wrapper, this, req.channel, req.handler );
+            DatagramSession session =
+                new DatagramSession( this, req.channel, req.handler );
 
             boolean success = false;
             try
             {
-                this.filterChainBuilder.buildFilterChain( session.getFilterChain() );
                 req.filterChainBuilder.buildFilterChain( session.getFilterChain() );
                 ( ( DatagramFilterChain ) session.getFilterChain() ).sessionCreated( session
);
 
@@ -626,10 +599,10 @@
 
         for( ;; )
         {
-            DatagramSessionImpl session;
+            DatagramSession session;
             synchronized( cancelQueue )
             {
-                session = ( DatagramSessionImpl ) cancelQueue.pop();
+                session = ( DatagramSession ) cancelQueue.pop();
             }
 
             if( session == null )

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramFilterChain.java
Fri Jan 20 19:03:16 2006
@@ -39,7 +39,7 @@
     
     protected void doWrite( IoSession session, WriteRequest writeRequest )
     {
-        DatagramSessionImpl s = ( DatagramSessionImpl ) session;
+        DatagramSession s = ( DatagramSession ) session;
         Queue writeRequestQueue = s.getWriteRequestQueue();
         
         synchronized( writeRequestQueue )
@@ -55,7 +55,7 @@
 
     protected void doClose( IoSession session, CloseFuture closeFuture )
     {
-        DatagramSessionImpl s = ( DatagramSessionImpl ) session;
+        DatagramSession s = ( DatagramSession ) session;
         DatagramSessionManager manager = s.getManagerDelegate();
         if( manager instanceof DatagramConnector )
         {

Copied: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSession.java
(from r370948, directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSession.java?p2=directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSession.java&p1=directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java&r1=370948&r2=370972&rev=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSession.java
Fri Jan 20 19:03:16 2006
@@ -18,20 +18,18 @@
  */
 package org.apache.mina.transport.socket.nio.support;
 
-import java.net.SocketAddress;
 import java.net.SocketException;
 import java.nio.channels.DatagramChannel;
 import java.nio.channels.SelectionKey;
 
 import org.apache.mina.common.CloseFuture;
+import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.IoSessionManager;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoSession;
-import org.apache.mina.transport.socket.nio.DatagramSession;
 import org.apache.mina.util.Queue;
 
 /**
@@ -40,38 +38,30 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-class DatagramSessionImpl extends BaseIoSession implements DatagramSession
+class DatagramSession extends BaseIoSession
 {
-    private final IoSessionManager wrapperManager;
     private final DatagramSessionManager managerDelegate;
     private final DatagramFilterChain filterChain;
     private final DatagramChannel ch;
     private final Queue writeRequestQueue;
     private final IoHandler handler;
-    private final SocketAddress localAddress;
-    private SocketAddress remoteAddress;
+    private final IoAddress localAddress;
+    private IoAddress remoteAddress;
     private SelectionKey key;
 
     /**
      * Creates a new instance.
      */
-    DatagramSessionImpl( IoSessionManager wrapperManager,
-                         DatagramSessionManager managerDelegate,
+    DatagramSession( DatagramSessionManager managerDelegate,
                          DatagramChannel ch, IoHandler defaultHandler )
     {
-        this.wrapperManager = wrapperManager;
         this.managerDelegate = managerDelegate;
         this.filterChain = new DatagramFilterChain( this );
         this.ch = ch;
         this.writeRequestQueue = new Queue();
         this.handler = defaultHandler;
-        this.remoteAddress = ch.socket().getRemoteSocketAddress();
-        this.localAddress = ch.socket().getLocalSocketAddress();
-    }
-    
-    public IoSessionManager getManager()
-    {
-        return wrapperManager;
+        this.remoteAddress = SocketAddresses.compose( "datagram", ch.socket().getRemoteSocketAddress()
);
+        this.localAddress = SocketAddresses.compose( "datagram", ch.socket().getLocalSocketAddress()
);
     }
     
     DatagramSessionManager getManagerDelegate()
@@ -132,17 +122,17 @@
         return TransportType.DATAGRAM;
     }
 
-    public SocketAddress getRemoteAddress()
+    public IoAddress getRemoteAddress()
     {
         return remoteAddress;
     }
 
-    void setRemoteAddress( SocketAddress remoteAddress )
+    void setRemoteAddress( IoAddress remoteAddress )
     {
         this.remoteAddress = remoteAddress;
     }
 
-    public SocketAddress getLocalAddress()
+    public IoAddress getLocalAddress()
     {
         return localAddress;
     }

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionManager.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionManager.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionManager.java
Fri Jan 20 19:03:16 2006
@@ -25,23 +25,23 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-interface DatagramSessionManager extends org.apache.mina.transport.socket.nio.DatagramSessionManager
+interface DatagramSessionManager
 {
     /**
      * Requests this processor to flush the write buffer of the specified
      * session.  This method is invoked by MINA internally.
      */
-    void flushSession( DatagramSessionImpl session );
+    void flushSession( DatagramSession session );
 
     /**
      * Requests this processor to close the specified session.
      * This method is invoked by MINA internally.
      */
-    void closeSession( DatagramSessionImpl session );
+    void closeSession( DatagramSession session );
     
     /**
      * Requests this processor to update the traffic mask for the specified
      * session. This method is invoked by MINA internally.
      */
-    void updateTrafficMask( DatagramSessionImpl session );    
+    void updateTrafficMask( DatagramSession session );    
 }

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptor.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptor.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptor.java
Fri Jan 20 19:03:16 2006
@@ -81,11 +81,6 @@
      */
     public void bind( IoAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder
) throws IOException
     {
-        if( handler == null )
-        {
-            throw new NullPointerException( "handler" );
-        }
-
         RegistrationRequest request = new RegistrationRequest( address, handler, filterChainBuilder
);
 
         synchronized( this )
@@ -150,11 +145,6 @@
     
     public void unbind( IoAddress address )
     {
-        if( address == null )
-        {
-            throw new NullPointerException( "address" );
-        }
-
         final Set managedSessions = ( Set ) sessions.get( address );
         CancellationRequest request = new CancellationRequest( address );
         synchronized( this )

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnector.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnector.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnector.java
Fri Jan 20 19:03:16 2006
@@ -64,9 +64,6 @@
     public ConnectFuture connect( IoAddress address, IoAddress localAddress,
                                   IoHandler handler, IoFilterChainBuilder filterChainBuilder
)
     {
-        if( handler == null )
-            throw new NullPointerException( "handler" );
-        
         SocketChannel ch = null;
         boolean success = false;
         try

Modified: directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSession.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSession.java?rev=370972&r1=370971&r2=370972&view=diff
==============================================================================
--- directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSession.java
(original)
+++ directory/sandbox/trustin/mina-spi/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSession.java
Fri Jan 20 19:03:16 2006
@@ -18,13 +18,13 @@
  */
 package org.apache.mina.transport.socket.nio.support;
 
-import java.net.SocketAddress;
 import java.net.SocketException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 import java.util.Set;
 
 import org.apache.mina.common.CloseFuture;
+import org.apache.mina.common.IoAddress;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
@@ -48,8 +48,8 @@
     private final SocketChannel ch;
     private final Queue writeRequestQueue;
     private final IoHandler handler;
-    private final SocketAddress remoteAddress;
-    private final SocketAddress localAddress;
+    private final IoAddress remoteAddress;
+    private final IoAddress localAddress;
     private final Set managedSessions;    
     private SelectionKey key;
     private int readBufferSize = DEFAULT_READ_BUFFER_SIZE;
@@ -67,8 +67,8 @@
         this.ch = ch;
         this.writeRequestQueue = new Queue();
         this.handler = defaultHandler;
-        this.remoteAddress = ch.socket().getRemoteSocketAddress();
-        this.localAddress = ch.socket().getLocalSocketAddress();
+        this.remoteAddress = SocketAddresses.compose( "socket", ch.socket().getRemoteSocketAddress()
);
+        this.localAddress = SocketAddresses.compose( "socket", ch.socket().getLocalSocketAddress()
);
     }
     
     SocketIoProcessor getIoProcessor()
@@ -134,12 +134,12 @@
         return TransportType.SOCKET;
     }
 
-    public SocketAddress getRemoteAddress()
+    public IoAddress getRemoteAddress()
     {
         return remoteAddress;
     }
 
-    public SocketAddress getLocalAddress()
+    public IoAddress getLocalAddress()
     {
         return localAddress;
     }



Mime
View raw message