directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r379044 - in /directory/trunks/mina/core/src: main/java/org/apache/mina/common/ main/java/org/apache/mina/transport/socket/nio/support/ main/java/org/apache/mina/transport/vmpipe/support/ test/java/org/apache/mina/common/ test/java/org/apac...
Date Mon, 20 Feb 2006 07:40:40 GMT
Author: trustin
Date: Sun Feb 19 23:40:37 2006
New Revision: 379044

URL: http://svn.apache.org/viewcvs?rev=379044&view=rev
Log:
Added IoSession.getServiceAddress()

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/common/FutureTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java (original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoSession.java Sun Feb
19 23:40:37 2006
@@ -176,6 +176,16 @@
      * session.
      */
     SocketAddress getLocalAddress();
+    
+    /**
+     * Returns the socket address of the {@link IoService} listens to to manage
+     * this session.  If this session is managed by {@link IoAcceptor}, it
+     * returns the {@link SocketAddress} which is specified as a parameter of
+     * {@link IoAcceptor#bind(SocketAddress, IoHandler)}.  If this session is
+     * managed by {@link IoConnector}, this method returns the same address with
+     * that of {@link #getRemoteAddress()}.  
+     */
+    SocketAddress getServiceAddress();
 
     /**
      * Returns idle time for the specified type of idleness in seconds.

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
Sun Feb 19 23:40:37 2006
@@ -194,7 +194,8 @@
         RegistrationRequest req = ( RegistrationRequest ) key.attachment();
         DatagramSessionImpl s = new DatagramSessionImpl(
                 wrapper, this,
-                req.config.getSessionConfig(), ch, req.handler );
+                req.config.getSessionConfig(), ch, req.handler,
+                req.address );
         s.setRemoteAddress( remoteAddress );
         s.setSelectionKey( key );
         
@@ -330,7 +331,8 @@
             DatagramSessionImpl session = new DatagramSessionImpl(
                     wrapper, this,
                     req.config.getSessionConfig(),
-                    ch, req.handler );
+                    ch, req.handler,
+                    req.address );
             session.setSelectionKey( key );
             
             try

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
Sun Feb 19 23:40:37 2006
@@ -540,7 +540,8 @@
             DatagramSessionImpl session = new DatagramSessionImpl(
                     wrapper, this,
                     req.config.getSessionConfig(),
-                    req.channel, req.handler );
+                    req.channel, req.handler,
+                    req.channel.socket().getRemoteSocketAddress() );
 
             boolean success = false;
             try

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Sun Feb 19 23:40:37 2006
@@ -53,6 +53,7 @@
     private final Queue writeRequestQueue;
     private final IoHandler handler;
     private final SocketAddress localAddress;
+    private final SocketAddress serviceAddress;
     private SocketAddress remoteAddress;
     private SelectionKey key;
     private int readBufferSize;
@@ -63,7 +64,8 @@
     DatagramSessionImpl( IoService wrapperManager,
                          DatagramService managerDelegate,
                          IoSessionConfig config,
-                         DatagramChannel ch, IoHandler defaultHandler )
+                         DatagramChannel ch, IoHandler defaultHandler,
+                         SocketAddress serviceAddress )
     {
         this.wrapperManager = wrapperManager;
         this.managerDelegate = managerDelegate;
@@ -73,6 +75,7 @@
         this.handler = defaultHandler;
         this.remoteAddress = ch.socket().getRemoteSocketAddress();
         this.localAddress = ch.socket().getLocalSocketAddress();
+        this.serviceAddress = serviceAddress;
         
         // Apply the initial session settings
         if( config instanceof DatagramSessionConfig )
@@ -168,6 +171,11 @@
     public SocketAddress getLocalAddress()
     {
         return localAddress;
+    }
+    
+    public SocketAddress getServiceAddress()
+    {
+        return serviceAddress;
     }
 
     protected void updateTrafficMask()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
Sun Feb 19 23:40:37 2006
@@ -382,7 +382,8 @@
                             SocketAcceptorDelegate.this.wrapper,
                             ( Set ) sessions.get( req.address ),
                             ( SocketSessionConfig ) req.config.getSessionConfig(),
-                            ch, req.handler );
+                            ch, req.handler,
+                            req.address );
                     getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
                     req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()
);
                     ( ( SocketFilterChain ) session.getFilterChain() ).sessionCreated( session
);

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
Sun Feb 19 23:40:37 2006
@@ -282,7 +282,7 @@
         SocketSessionImpl session = new SocketSessionImpl(
                 wrapper, managedSessions,
                 config.getSessionConfig(),
-                ch, handler );
+                ch, handler, ch.socket().getRemoteSocketAddress() );
         try
         {
             getFilterChainBuilder().buildFilterChain( session.getFilterChain() );

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
Sun Feb 19 23:40:37 2006
@@ -55,6 +55,7 @@
     private final IoHandler handler;
     private final SocketAddress remoteAddress;
     private final SocketAddress localAddress;
+    private final SocketAddress serviceAddress;
     private final Set managedSessions;    
     private SelectionKey key;
     private int readBufferSize;
@@ -65,7 +66,8 @@
     public SocketSessionImpl(
             IoService manager, Set managedSessions,
             IoSessionConfig config,
-            SocketChannel ch, IoHandler defaultHandler )
+            SocketChannel ch, IoHandler defaultHandler,
+            SocketAddress serviceAddress )
     {
         this.manager = manager;
         this.managedSessions = managedSessions;
@@ -76,6 +78,7 @@
         this.handler = defaultHandler;
         this.remoteAddress = ch.socket().getRemoteSocketAddress();
         this.localAddress = ch.socket().getLocalSocketAddress();
+        this.serviceAddress = serviceAddress;
         
         // Apply the initial session settings
         if( config instanceof SocketSessionConfig )
@@ -174,6 +177,11 @@
     public SocketAddress getLocalAddress()
     {
         return localAddress;
+    }
+    
+    public SocketAddress getServiceAddress()
+    {
+        return serviceAddress;
     }
     
     protected void updateTrafficMask()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
Sun Feb 19 23:40:37 2006
@@ -36,6 +36,7 @@
     private final IoService manager;
     private final SocketAddress localAddress;
     private final SocketAddress remoteAddress;
+    private final SocketAddress serviceAddress;
     private final IoHandler handler;
     private final VmPipeFilterChain filterChain;
     private final Set managedSessions;
@@ -53,7 +54,7 @@
         this.manager = manager;
         this.lock = lock;
         this.localAddress = localAddress;
-        this.remoteAddress = remoteEntry.getAddress();
+        this.remoteAddress = this.serviceAddress = remoteEntry.getAddress();
         this.handler = handler;
         this.filterChain = new VmPipeFilterChain( this );
         this.pendingDataQueue = new Queue();
@@ -106,7 +107,7 @@
     {
         this.manager = manager;
         this.lock = remoteSession.lock;
-        this.localAddress = remoteSession.remoteAddress;
+        this.localAddress = this.serviceAddress = remoteSession.remoteAddress;
         this.remoteAddress = remoteSession.localAddress;
         this.handler = entry.getHandler();
         this.filterChain = new VmPipeFilterChain( this );
@@ -178,6 +179,11 @@
     public SocketAddress getLocalAddress()
     {
         return localAddress;
+    }
+    
+    public SocketAddress getServiceAddress()
+    {
+        return serviceAddress;
     }
 
     protected void updateTrafficMask()

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/common/FutureTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/common/FutureTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/common/FutureTest.java (original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/common/FutureTest.java Sun Feb
19 23:40:37 2006
@@ -111,6 +111,10 @@
             {
                 return null;
             }
+
+            public SocketAddress getServiceAddress() {
+                return null;
+            }
         };
         
         future.setSession( session );

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
Sun Feb 19 23:40:37 2006
@@ -304,6 +304,10 @@
         {
             return null;
         }
+
+        public SocketAddress getServiceAddress() {
+            return null;
+        }
     }
 
     private class EventOrderTestFilter extends IoFilterAdapter
@@ -423,6 +427,10 @@
 
                 public IoSessionConfig getConfig()
                 {
+                    return null;
+                }
+
+                public SocketAddress getServiceAddress() {
                     return null;
                 }
             } );

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
Sun Feb 19 23:40:37 2006
@@ -196,6 +196,10 @@
         {
             return null;
         }
+
+        public SocketAddress getServiceAddress() {
+            return null;
+        }
     }
     
     private static class EventOrderChecker implements NextFilter
@@ -303,6 +307,10 @@
 
         public IoSessionConfig getConfig()
         {
+            return null;
+        }
+
+        public SocketAddress getServiceAddress() {
             return null;
         }
     }

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
Sun Feb 19 23:40:37 2006
@@ -238,5 +238,9 @@
         {
             return null;
         }
+
+        public SocketAddress getServiceAddress() {
+            return null;
+        }
     }
 }

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
Sun Feb 19 23:40:37 2006
@@ -224,5 +224,9 @@
         {
             return null;
         }
+
+        public SocketAddress getServiceAddress() {
+            return null;
+        }
     }
 }

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
Sun Feb 19 23:40:37 2006
@@ -118,5 +118,9 @@
         {
             return null;
         }
+
+        public SocketAddress getServiceAddress() {
+            return null;
+        }
     }
 }

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java?rev=379044&r1=379043&r2=379044&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
Sun Feb 19 23:40:37 2006
@@ -98,6 +98,10 @@
                     {
                         return null;
                     }
+
+                    public SocketAddress getServiceAddress() {
+                        return null;
+                    }
                 }, null );
         
         Assert.assertEquals( "ABC", buf.toString() );



Mime
View raw message