directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r151508 - in incubator/directory/network/trunk/mina/src: java/org/apache/mina/io/ java/org/apache/mina/io/datagram/ java/org/apache/mina/io/socket/ java/org/apache/mina/protocol/ java/org/apache/mina/protocol/io/ java/org/apache/mina/protocol/vmpipe/ java/org/apache/mina/util/ test/org/apache/mina/util/
Date Sat, 05 Feb 2005 16:28:00 GMT
Author: trustin
Date: Sat Feb  5 08:27:56 2005
New Revision: 151508

URL: http://svn.apache.org/viewcvs?view=rev&rev=151508
Log:
Fixed: DIRMINA-1 Acceptors and Connectors doesn't provide filter iterator and clearAllFilters().

Modified:
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoAdapter.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
    incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ProtocolHandlerFilterManager.java
    incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/IoHandlerFilterManagerTest.java
    incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/ProtocolHandlerFilterManagerTest.java

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoAcceptor.java (original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoAcceptor.java Sat
Feb  5 08:27:56 2005
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
@@ -74,6 +75,18 @@
      */
     void removeFilter( IoHandlerFilter filter );
 
+    /**
+     * Removes all filters added to this acceptor.
+     */
+    void removeAllFilters();
+    
+    /**
+     * Returns the list of all filters ordered by priority (higher first).
+     * The returned list is clone of internal filter chain, and thus you
+     * cannot add or remove filters using it. 
+     */
+    List getAllFilters();
+    
     /**
      * Returns the current exception monitor.
      */

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoConnector.java (original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoConnector.java Sat
Feb  5 08:27:56 2005
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 /**
  * Connects to endpoint, communicates with the server, and fires events to
@@ -80,6 +81,18 @@
      * Removes the specified filter from the filter list.
      */
     void removeFilter( IoHandlerFilter filter );
+
+    /**
+     * Removes all filters added to this connector.
+     */
+    void removeAllFilters();
+    
+    /**
+     * Returns the list of all filters ordered by priority (higher first).
+     * The returned list is clone of internal filter chain, and thus you
+     * cannot add or remove filters using it. 
+     */
+    List getAllFilters();
 
     /**
      * Returns the current exception monitor.

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
Sat Feb  5 08:27:56 2005
@@ -27,6 +27,7 @@
 import java.nio.channels.Selector;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -411,6 +412,16 @@
     public void removeFilter( IoHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+    
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     private static class RegistrationRequest

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramConnector.java
Sat Feb  5 08:27:56 2005
@@ -26,6 +26,7 @@
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.mina.common.ByteBuffer;
@@ -422,6 +423,16 @@
     public void removeFilter( IoHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     private static class RegistrationRequest

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketAcceptor.java
Sat Feb  5 08:27:56 2005
@@ -28,6 +28,7 @@
 import java.nio.channels.SocketChannel;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.mina.io.IoAcceptor;
@@ -283,6 +284,16 @@
     public void removeFilter( IoHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+    
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     private static class RegistrationRequest

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketConnector.java
Sat Feb  5 08:27:56 2005
@@ -26,6 +26,7 @@
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.mina.io.DefaultExceptionMonitor;
@@ -290,6 +291,16 @@
     public void removeFilter( IoHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     public ExceptionMonitor getExceptionMonitor()

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
Sat Feb  5 08:27:56 2005
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
@@ -70,4 +71,16 @@
      * Removes the specified filter from the filter list.
      */
     void removeFilter( ProtocolHandlerFilter filter );
+
+    /**
+     * Removes all filters added to this acceptor.
+     */
+    void removeAllFilters();
+
+    /**
+     * Returns the list of all filters ordered by priority (higher first).
+     * The returned list is clone of internal filter chain, and thus you
+     * cannot add or remove filters using it. 
+     */
+    List getAllFilters();
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolConnector.java
Sat Feb  5 08:27:56 2005
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 /**
  * Connects to endpoint, communicates with the server, and fires events to
@@ -78,4 +79,16 @@
      * Removes the specified filter from the filter list.
      */
     void removeFilter( ProtocolHandlerFilter filter );
+
+    /**
+     * Removes all filters added to this connector.
+     */
+    void removeAllFilters();
+
+    /**
+     * Returns the list of all filters ordered by priority (higher first).
+     * The returned list is clone of internal filter chain, and thus you
+     * cannot add or remove filters using it. 
+     */
+    List getAllFilters();
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoAdapter.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoAdapter.java
Sat Feb  5 08:27:56 2005
@@ -19,6 +19,7 @@
 package org.apache.mina.protocol.io;
 
 import java.net.SocketAddress;
+import java.util.List;
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
@@ -78,6 +79,19 @@
     public void removeFilter( ProtocolHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+
+    /**
+     * Removes all filters added to this adapter.
+     */
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     /**

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
Sat Feb  5 08:27:56 2005
@@ -5,6 +5,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 import org.apache.mina.io.IoAcceptor;
 import org.apache.mina.protocol.ProtocolAcceptor;
@@ -63,5 +64,15 @@
     public void removeFilter( ProtocolHandlerFilter filter )
     {
         adapter.removeFilter( filter );
+    }
+
+    public void removeAllFilters()
+    {
+    	adapter.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return adapter.getAllFilters();
     }
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
Sat Feb  5 08:27:56 2005
@@ -5,6 +5,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 import org.apache.mina.io.IoConnector;
 import org.apache.mina.io.IoSession;
@@ -73,4 +74,13 @@
         adapter.removeFilter( filter );
     }
 
+    public void removeAllFilters()
+    {
+    	adapter.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return adapter.getAllFilters();
+    }
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
Sat Feb  5 08:27:56 2005
@@ -6,6 +6,7 @@
 import java.io.IOException;
 import java.net.SocketAddress;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.mina.protocol.ProtocolAcceptor;
@@ -79,6 +80,16 @@
     public void removeFilter( ProtocolHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+    
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
+    }
+
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
     }
 
     static class Entry

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
Sat Feb  5 08:27:56 2005
@@ -5,6 +5,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.List;
 
 import org.apache.mina.protocol.ProtocolConnector;
 import org.apache.mina.protocol.ProtocolHandlerFilter;
@@ -40,6 +41,16 @@
     public void removeFilter( ProtocolHandlerFilter filter )
     {
         filterManager.removeFilter( filter );
+    }
+
+    public void removeAllFilters()
+    {
+    	filterManager.removeAllFilters();
+    }
+
+    public List getAllFilters()
+    {
+    	return filterManager.filters();
     }
 
     public ProtocolSession connect( SocketAddress address,

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
Sat Feb  5 08:27:56 2005
@@ -155,6 +155,12 @@
             e = e.nextEntry;
         }
     }
+    
+    public synchronized void removeAllFilters() {
+    	tail.prevEntry = null;
+    	tail.nextEntry = null;
+    	head = tail;
+    }
 
     public void fireSessionOpened( IoSession session )
     {
@@ -248,7 +254,7 @@
         cmd.execute( buf, marker );
     }
 
-    List filters()
+    public List filters()
     {
         List list = new ArrayList();
         Entry e = head;
@@ -262,7 +268,7 @@
         return list;
     }
 
-    List filtersReversed()
+    public List filtersReversed()
     {
         List list = new ArrayList();
         Entry e = tail;

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ProtocolHandlerFilterManager.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ProtocolHandlerFilterManager.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ProtocolHandlerFilterManager.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/ProtocolHandlerFilterManager.java
Sat Feb  5 08:27:56 2005
@@ -151,6 +151,12 @@
         }
     }
 
+    public synchronized void removeAllFilters() {
+    	tail.prevEntry = null;
+    	tail.nextEntry = null;
+    	head = tail;
+    }
+
     public void fireSessionOpened( ProtocolSession session )
     {
         Entry head = this.head;
@@ -242,7 +248,7 @@
         cmd.execute( message );
     }
 
-    List filters()
+    public List filters()
     {
         List list = new ArrayList();
         Entry e = head;
@@ -256,7 +262,7 @@
         return list;
     }
 
-    List filtersReversed()
+    public List filtersReversed()
     {
         List list = new ArrayList();
         Entry e = tail;

Modified: incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/IoHandlerFilterManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/IoHandlerFilterManagerTest.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/IoHandlerFilterManagerTest.java
(original)
+++ incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/IoHandlerFilterManagerTest.java
Sat Feb  5 08:27:56 2005
@@ -121,6 +121,12 @@
         assertSame( filterD, list.get( 2 ) );
         assertSame( filterB, list.get( 1 ) );
     }
+    
+    public void removeAll()
+    {
+    	manager.removeAllFilters();
+    	assertEquals( 1, manager.filters().size() );
+    }
 
     public static void main( String[] args )
     {

Modified: incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/ProtocolHandlerFilterManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/ProtocolHandlerFilterManagerTest.java?view=diff&r1=151507&r2=151508
==============================================================================
--- incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/ProtocolHandlerFilterManagerTest.java
(original)
+++ incubator/directory/network/trunk/mina/src/test/org/apache/mina/util/ProtocolHandlerFilterManagerTest.java
Sat Feb  5 08:27:56 2005
@@ -122,6 +122,12 @@
         assertSame( filterB, list.get( 1 ) );
     }
 
+    public void removeAll()
+    {
+    	manager.removeAllFilters();
+    	assertEquals( 1, manager.filters().size() );
+    }
+
     public static void main( String[] args )
     {
         junit.textui.TestRunner.run( ProtocolHandlerFilterManagerTest.class );



Mime
View raw message