You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2003/12/10 00:53:00 UTC

svn commit: rev 1394 - in incubator/directory/ldap/trunk/eve/frontend: common common/api/src/java/org/apache/eve/event input input/impl input/impl/conf input/impl/src input/impl/src/java input/impl/src/java/org input/impl/src/java/org/apache input/impl/src/java/org/apache/eve input/impl/src/java/org/apache/eve/input input/spi input/spi/src input/spi/src/java input/spi/src/java/org input/spi/src/java/org/apache input/spi/src/java/org/apache/eve input/spi/src/java/org/apache/eve/input listener/impl

Author: akarasulu
Date: Tue Dec  9 15:52:59 2003
New Revision: 1394

Added:
   incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/event/InputEvent.java
   incubator/directory/ldap/trunk/eve/frontend/input/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/   (props changed)
   incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/block.xml
   incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/config.xml
   incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/debug.xml
   incubator/directory/ldap/trunk/eve/frontend/input/impl/maven.xml
   incubator/directory/ldap/trunk/eve/frontend/input/impl/project.properties
   incubator/directory/ldap/trunk/eve/frontend/input/impl/project.xml
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/DefaultInputManager.java
   incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/MerlinInputManager.java
   incubator/directory/ldap/trunk/eve/frontend/input/spi/   (props changed)
   incubator/directory/ldap/trunk/eve/frontend/input/spi/project.xml
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManager.java
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java
   incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java
Modified:
   incubator/directory/ldap/trunk/eve/frontend/common/   (props changed)
   incubator/directory/ldap/trunk/eve/frontend/listener/impl/project.xml
Log:
Added input manager component using the new POJO component
scheme.  Started using the buffer pool here and it came out
very nicely.  Using an abstract InputEvent is the key to
expose interest releasing and claiming functionality without
compromising the writable buffer and not creating cyclic
package dependencies.

NONE OF THIS CODE IS YET TESTED!



Added: incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/event/InputEvent.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/common/api/src/java/org/apache/eve/event/InputEvent.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,111 @@
+/*
+
+ ============================================================================
+				   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+	this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+	this list of conditions and the following disclaimer in the documentation
+	and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+	include  the following  acknowledgment:  "This product includes  software
+	developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+	Alternately, this  acknowledgment may  appear in the software itself,  if
+	and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+	products derived  from this  software without  prior written
+	permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+	"Apache" appear  in their name,  without prior written permission  of the
+	Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.event ;
+
+
+import java.nio.ByteBuffer ;
+import java.util.EventObject ;
+
+import org.apache.eve.listener.ClientKey ;
+
+
+/**
+ * Input event used to indicate the availability of more data from the client.
+ * The data has already been read in from the client.
+ * 
+ * Note that this is an abstract event whose methods to claim and release 
+ * interest in the buffer payload are abstract.  This has purposefully been 
+ * left that way so concrete subclasses created by stages can manage the 
+ * interactions required with the buffer pool without creating a dependency
+ * on the BufferPool spi or its implementation.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public abstract class InputEvent extends EventObject
+{
+    /** the buffer used to store the read input */
+    protected final ByteBuffer m_buffer ;
+    
+
+    /**
+     * Creates an InputEvent 
+     * 
+     * @param a_client
+     * @param a_buffer
+     */
+    public InputEvent( ClientKey a_client, ByteBuffer a_buffer )
+    {
+        super( a_client ) ;
+        m_buffer = a_buffer ;
+    }
+
+    
+    /**
+     * Gets a handle on a read-only buffer using the original as the backing 
+     * store and registers the accessing party as interested in the buffer.
+     * 
+     * @param a_party the party interested in the buffer
+     * @return the buffer with the partial input data
+     */
+    public abstract ByteBuffer claimInterest( Object a_party ) ;
+
+    
+    /**
+     * Releases the interest for the ByteBuffer held within this InputEvent.  
+     * Once all interested parties have released their interest in the buffer it
+     * is reclaimed.
+     * 
+     * @param a_party the party that originally claimed interest
+     */
+    public abstract void releaseInterest( Object a_party ) ;
+}
+

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/block.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/block.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<container name="server">
+
+  <classloader>
+    <classpath>
+      <repository>
+        <resource id="avalon-framework:avalon-framework-api" version="4.1.5"/>
+        <resource id="directory:eve-frontend-common-api" version="SNAPSHOT"/>
+        <resource id="directory:eve-frontend-event-spi" version="SNAPSHOT"/>
+        <resource id="directory:eve-frontend-event-impl" version="SNAPSHOT"/>
+        <resource id="directory:eve-frontend-buffer-spi" version="SNAPSHOT"/>
+        <resource id="directory:eve-frontend-buffer-impl" version="SNAPSHOT"/>
+      </repository>
+    </classpath>
+  </classloader>
+
+  <component
+    name="event-router" 
+    class="org.apache.eve.event.MerlinEventRouter"/>
+  <component
+    name="listener-manager" 
+    class="org.apache.eve.listener.MerlinListenerManager"/>
+</container>

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/config.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/config.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<targets>
+  <target path="/server/input-manager">
+    <categories priority="DEBUG"/>
+  </target>
+</targets>

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/debug.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/conf/debug.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<kernel>
+
+  <!-- logging system parameters -->
+  <logging target="default" priority="DEBUG" name="kernel">
+  </logging>
+
+</kernel>
+

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/maven.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,38 @@
+<project default="java:compile"
+    xmlns:j="jelly:core"
+    xmlns:u="jelly:util"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven"
+    xmlns:m="maven"
+    xmlns:deploy="deploy">
+    
+    <preGoal name="site">
+        <attainGoal name="docbook:transform"/>
+    </preGoal>
+
+    <postGoal name="site">
+        <attainGoal name="server:copy-images"/>
+    </postGoal>
+
+    <goal name="server:copy-images">
+        <copy toDir="target/docs/images">
+            <fileSet dir="${basedir}/src/images">
+                <include name="*.gif"/>
+            </fileSet>
+        </copy>
+    </goal>
+    
+    <goal name="cleanall">
+    	<attainGoal name="clean"/>
+    	<delete dir="home"/>
+    </goal>
+    
+    <postGoal name="java:compile">
+    	<attainGoal name="avalon:meta"/>
+    </postGoal>
+    
+    <postGoal name="aspectj:compile">
+    	<attainGoal name="avalon:meta"/>
+    </postGoal>
+    
+</project>

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/project.properties
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/project.properties	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,3 @@
+maven.xdoc.date=left
+maven.xdoc.version=${pom.currentVersion}
+merlin.debug=true

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/project.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+    <extend>${basedir}/../../../project.xml</extend>
+    <groupId>directory</groupId>
+    <id>eve-frontend-input-impl</id>
+  
+    <name>Eve Frontend Input Manager Implementation</name>
+    <package>org.apache.eve.input</package>
+    <currentVersion>SNAPSHOT</currentVersion>
+    <inceptionYear>2003</inceptionYear>
+  	
+    <shortDescription>
+	Eve's Frontend InputManager Implementation
+    </shortDescription>
+
+    <description>
+        Eve's frontend input manager reads input from client sockets bound to
+        the server.  The input manager responds to input events enqueued by
+        the listener modules which detects io to read from the socket channel.
+    </description>
+  	
+    <dependencies>
+        <dependency>
+            <groupId>avalon-framework</groupId>
+            <artifactId>avalon-framework-api</artifactId>
+            <version>4.1.5</version>
+            <url>http://avalon.apache.org/framework</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-common-api</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-event-spi</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-event-impl</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-input-spi</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-buffer-spi</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-buffer-impl</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org</url>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <url>http://junit.org</url>
+        </dependency>
+    </dependencies>
+</project>
+

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,76 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import org.apache.avalon.framework.logger.LogEnabled ;
+import org.apache.avalon.framework.logger.Logger;
+
+
+/**
+ * A monitor that uses Avolon logging life-cycle an loggers to report events
+ * in the InputManager.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class AvalonInputManagerMonitor extends InputManagerMonitorAdapter
+	implements LogEnabled
+{
+    /** the logger used to log messages */
+    private Logger m_log ;
+    
+    
+    public void enableLogging( Logger a_logger )
+    {
+        m_log = a_logger ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/DefaultInputManager.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/DefaultInputManager.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,399 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import java.util.Iterator ;
+import java.util.EventObject ;
+
+import java.io.IOException ;
+import java.nio.ByteBuffer ;
+import java.nio.channels.Selector ;
+import java.nio.channels.SelectionKey ;
+import java.nio.channels.SocketChannel ;
+
+import org.apache.eve.event.InputEvent ;
+import org.apache.eve.ResourceException ;
+import org.apache.eve.buffer.BufferPool ;
+import org.apache.eve.event.EventRouter ;
+import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.event.ConnectEvent ;
+import org.apache.eve.event.DisconnectEvent ;
+import org.apache.eve.listener.KeyExpiryException ;
+
+
+/**
+ * Default InputManager implementation based on NIO selectors and channels.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class DefaultInputManager implements InputManager
+{
+	/** the thread driving this Runnable */ 
+	private Thread m_thread = null ;
+	/** parameter used to politely stop running thread */
+	private Boolean m_hasStarted = null ;
+    /** the buffer pool we get direct buffers from */
+	private BufferPool m_bp = null ;
+	/** event router used to decouple source to sink relationships */
+	private EventRouter m_router = null ;
+	/** selector used to select a ready socket channel */
+	private Selector m_selector = null ;
+	/** the input manager's monitor */
+	private InputManagerMonitor m_monitor = new InputManagerMonitorAdapter() ;
+
+	
+	// ------------------------------------------------------------------------
+	// C O N S T R U C T O R S
+	// ------------------------------------------------------------------------
+    
+    
+	/**
+	 * Creates a default InputManager implementation
+	 *  
+	 * @param a_router an event router service
+	 * @param a_bp a buffer pool service
+	 */
+	public DefaultInputManager( EventRouter a_router, BufferPool a_bp )
+		throws IOException
+	{
+	    m_bp = a_bp ;
+	    m_router = a_router ;
+		m_hasStarted = new Boolean( false ) ;
+		m_selector = Selector.open() ;
+	}
+	
+
+	// ------------------------------------------------------------------------
+	// start, stop and runnable code
+	// ------------------------------------------------------------------------
+    
+    
+	/**
+	 * Runnable used to drive the selection loop. 
+	 *
+	 * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+	 * @author $Author$
+	 * @version $Revision$
+	 */
+	class SelectionDriver implements Runnable
+	{
+		public void run()
+		{
+			while ( m_hasStarted.booleanValue() ) 
+			{
+				int l_count = 0 ;
+	            
+				/*
+				 * check if we have input waiting and continue if there is
+				 * nothing to read from any of the registered channels  
+				 */
+				try
+				{
+					if ( 0 == ( l_count = m_selector.select( 100 ) ) )
+					{
+					    m_monitor.selectorReturned( m_selector ) ;
+						continue ;
+					}
+				} 
+				catch( IOException e )
+				{
+				    m_monitor.selectFailure( m_selector, e ) ;
+					continue ;
+				}
+	            
+				processInput() ;
+			}
+		}
+	}
+
+
+	/**
+	 * Starts up this module.
+	 */
+	public void start() 
+	{
+		synchronized( m_hasStarted )
+		{
+			if ( m_hasStarted.booleanValue() )
+			{
+				throw new IllegalStateException( "Already started!" ) ;
+			}
+            
+			m_hasStarted = new Boolean( true ) ;
+			m_thread = new Thread( new SelectionDriver() ) ;
+			m_thread.start() ;
+		}
+	}
+    
+    
+	/**
+	 * Blocks calling thread until this module gracefully stops.
+	 */
+	public void stop() throws InterruptedException
+	{
+		synchronized( m_hasStarted )
+		{
+			m_hasStarted = new Boolean( false ) ;
+            
+			while ( m_thread.isAlive() )
+			{
+				Thread.sleep( 100 ) ;
+			}
+		}
+	}
+    
+    
+	// ------------------------------------------------------------------------
+	// subscriber methods
+	// ------------------------------------------------------------------------
+    
+    
+	/**
+	 * @see org.apache.eve.event.ConnectListener#
+	 * connectPerformed(org.apache.eve.event.ConnectEvent)
+	 */
+	public void inform( ConnectEvent an_event )
+	{
+		ClientKey l_key = null ;
+		SocketChannel l_channel = null ;
+		
+		try
+		{
+			l_key = an_event.getClientKey() ;
+			l_channel = l_key.getSocket().getChannel() ;
+            
+			// hands-off blocking sockets!
+			if ( null == l_channel )
+			{
+				return ;
+			}
+            
+			l_channel.configureBlocking( false ) ;
+			l_channel.register( m_selector, SelectionKey.OP_READ, l_key ) ;
+			m_monitor.registeredChannel( l_key, m_selector ) ;
+		}
+		catch ( KeyExpiryException e )
+		{
+			String l_msg = "Attempting session creation using expired key for "
+				+ an_event.getClientKey() ;
+			m_monitor.keyExpiryFailure( l_key, e ) ;
+		}
+		catch ( IOException e )
+		{
+			String l_msg = "Input managmer registration failure for " +
+				an_event.getClientKey() + " due to exception." ;
+			m_monitor.channelRegistrationFailure( m_selector, l_channel, 
+			        SelectionKey.OP_READ, e ) ;
+		}
+	}
+
+    
+	/**
+	 * @see org.apache.eve.event.DisconnectListener#
+	 * inform(org.apache.eve.event.DisconnectEvent)
+	 */
+	public void inform( DisconnectEvent an_event )
+	{
+		SelectionKey l_key = null ;
+		Iterator l_keys = m_selector.keys().iterator() ;
+        
+		while ( l_keys.hasNext() )
+		{
+			l_key = ( SelectionKey ) l_keys.next() ;
+			if ( l_key.attachment().equals( an_event.getClientKey() ) )
+			{
+				break ;
+			}
+		}
+
+		if ( null == l_key )
+		{
+			return ;
+		}
+        
+		try
+		{
+			l_key.channel().close() ;
+		}
+		catch ( IOException e )
+		{
+			m_monitor.channelCloseFailure( 
+			        ( SocketChannel ) l_key.channel(), e ) ;
+		}
+        
+		l_key.cancel() ;
+		m_monitor.disconnectedClient( an_event.getClientKey() ) ;
+	}
+    
+
+	/**
+	 * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
+	 */
+	public void inform( EventObject an_event )
+	{
+		Class l_clazz = an_event.getClass() ;
+	    
+		if ( l_clazz.isAssignableFrom( ConnectEvent.class ) )
+		{
+			inform( ( ConnectEvent ) an_event ) ;
+		}
+		else if ( l_clazz.isAssignableFrom( DisconnectEvent.class ) ) ;
+		{
+			inform( ( DisconnectEvent ) an_event ) ;
+		}
+	}
+	
+	
+	// ------------------------------------------------------------------------
+	// private utilities
+	// ------------------------------------------------------------------------
+	
+	
+	/**
+	 * Processes input on channels of the read ready selected keys.
+	 */
+	void processInput()
+	{
+		/*
+		 * Process the selectors that are ready.  For each selector that
+		 * is ready we read some data into a buffer we claim from a buffer
+		 * pool.  Next we create an InputEvent using the buffer and publish
+		 * it using the event notifier/router.
+		 */
+		Iterator l_list = m_selector.selectedKeys().iterator() ;
+		while ( l_list.hasNext() )
+		{
+			SelectionKey l_key = ( SelectionKey ) l_list.next() ;
+			ClientKey l_client = ( ClientKey ) l_key.attachment() ; 
+                
+			if ( l_key.isReadable() )
+			{
+				ByteBuffer l_buf = null ;
+				SocketChannel l_channel = ( SocketChannel ) l_key.channel() ;
+
+				// claim a buffer and read & return buffer on errors 
+				try
+				{
+					l_buf = m_bp.getBuffer( this ) ;
+					l_channel.read( l_buf ) ;
+				}
+				catch ( ResourceException e )
+				{
+					m_monitor.bufferUnavailable( m_bp, e ) ;
+					continue ;
+				}
+				catch ( IOException e )
+				{
+					m_monitor.readFailed( l_client, e ) ;
+					m_bp.releaseClaim( l_buf, this ) ;
+					continue ;
+				}
+					
+				// report to monitor, create the event, and publish it
+				m_monitor.inputRecieved( l_client ) ;
+				InputEvent l_event = new ConcreteInputEvent( l_client, l_buf ) ;
+				m_router.publish( l_event ) ;
+			}
+		}
+	}
+	
+	
+	/**
+	 * A concrete InputEvent that uses the buffer pool to properly implement
+	 * the interest claim and release methods.
+	 *
+	 * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+	 * @author $Author$
+	 * @version $Revision$
+	 */
+	class ConcreteInputEvent extends InputEvent
+	{
+	    ConcreteInputEvent( ClientKey a_key, ByteBuffer a_buffer )
+	    {
+	        super( a_key, a_buffer ) ;
+	    }
+	    
+		public ByteBuffer claimInterest( Object a_party )
+		{
+			m_bp.claimInterest( m_buffer, a_party ) ;
+			return m_buffer.asReadOnlyBuffer() ;
+		}
+		
+		public void releaseInterest( Object a_party )
+		{
+			m_bp.releaseClaim( m_buffer, a_party ) ;
+		}
+	}
+	
+	
+    /**
+     * Gets the monitor associated with this InputManager.
+     * 
+     * @return returns the monitor
+     */
+    public InputManagerMonitor getMonitor()
+    {
+        return m_monitor ;
+    }
+
+    
+    /**
+     * Sets the monitor associated with this InputManager.
+     * 
+     * @param a_monitor the monitor to set
+     */
+    public void setMonitor( InputManagerMonitor a_monitor )
+    {
+        m_monitor = a_monitor ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/MerlinInputManager.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/impl/src/java/org/apache/eve/input/MerlinInputManager.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,170 @@
+/*
+
+ ============================================================================
+				   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+	this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+	this list of conditions and the following disclaimer in the documentation
+	and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+	include  the following  acknowledgment:  "This product includes  software
+	developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+	Alternately, this  acknowledgment may  appear in the software itself,  if
+	and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+	products derived  from this  software without  prior written
+	permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+	"Apache" appear  in their name,  without prior written permission  of the
+	Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import java.util.EventObject ;
+
+import java.nio.channels.Selector ;
+
+import org.apache.avalon.framework.activity.Startable ;
+import org.apache.avalon.framework.service.Serviceable ;
+import org.apache.avalon.framework.activity.Initializable ;
+import org.apache.avalon.framework.service.ServiceManager ;
+import org.apache.avalon.framework.service.ServiceException ;
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+
+import org.apache.eve.buffer.BufferPool ;
+import org.apache.eve.event.EventRouter ;
+import org.apache.eve.event.ConnectEvent ;
+import org.apache.eve.event.DisconnectEvent ;
+
+
+/**
+ * A non-blocking input manager.
+ * 
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class MerlinInputManager extends AbstractLogEnabled 
+    implements
+    InputManager,
+    Serviceable,
+    Startable,
+    Initializable
+{
+    /** the buffer pool to get buffers from */
+	private BufferPool m_bp = null ;
+    /** event router used to decouple source to sink relationships */
+    private EventRouter m_router = null ;
+    /** selector used to select a ready socket channel */
+    private Selector m_selector = null ;
+    /** the wrapped input manager implementation */
+    private DefaultInputManager m_inputManager = null ;
+    
+    
+    // ------------------------------------------------------------------------
+    // Listener Interfaces
+    // ------------------------------------------------------------------------
+    
+    
+    /**
+     * @see org.apache.eve.event.ConnectListener#
+     * connectPerformed(org.apache.eve.event.ConnectEvent)
+     */
+    public void inform( ConnectEvent an_event )
+    {
+    }
+
+    
+    /**
+     * @see org.apache.eve.event.DisconnectListener#
+     * inform(org.apache.eve.event.DisconnectEvent)
+     */
+    public void inform( DisconnectEvent an_event )
+    {
+    }
+    
+    
+    /**
+     * 
+     */
+	public void inform( EventObject an_event )
+	{
+	}
+    
+
+    // ------------------------------------------------------------------------
+    // Life Cycle Methods
+    // ------------------------------------------------------------------------
+    
+    
+    /**
+     * Starts up this module.
+     * 
+     * @see org.apache.avalon.framework.activity.Startable#start()
+     */
+    public void start() throws Exception
+    {
+        m_inputManager.start() ;
+    }
+    
+    
+    /**
+     * Blocks calling thread until this module gracefully stops.
+     * 
+     * @see org.apache.avalon.framework.activity.Startable#stop()
+     */
+    public void stop() throws Exception
+    {
+        m_inputManager.stop() ;
+    }
+    
+    
+    /**
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    public void initialize() throws Exception
+    {
+        m_inputManager = new DefaultInputManager( m_router, m_bp ) ;
+    }
+
+    
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(
+     * org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service( ServiceManager a_manager ) throws ServiceException
+    {
+        m_bp = ( BufferPool ) a_manager.lookup( "buffer-pool" ) ;
+        m_router = ( EventRouter ) a_manager.lookup( "event-router" ) ;
+    }
+}

Added: incubator/directory/ldap/trunk/eve/frontend/input/spi/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/spi/project.xml	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+    <extend>${basedir}/../../../project.xml</extend>
+    <groupId>directory</groupId>
+    <id>eve-frontend-input-spi</id>
+  
+    <name>Eve Frontend Input Manager SPI</name>
+    <package>org.apache.eve.event</package>
+    <currentVersion>SNAPSHOT</currentVersion>
+    <inceptionYear>2003</inceptionYear>
+  	
+    <shortDescription>
+	Client input manager SPI used by Eve's frontend
+    </shortDescription>
+
+    <description>
+	Service interfaces for building an input manager that reads client
+        input from a socket channel.
+    </description>
+  	
+    <dependencies>
+        <dependency>
+            <groupId>avalon-framework</groupId>
+            <artifactId>avalon-framework-api</artifactId>
+            <version>4.1.5</version>
+            <url>http://avalon.apache.org/framework</url>
+        </dependency>
+
+	<dependency>
+            <groupId>directory</groupId>
+            <artifactId>eve-frontend-common-api</artifactId>
+            <version>SNAPSHOT</version>
+            <url>http://directory.apache.org/eve/frontend/common/api</url>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <url>http://junit.org</url>
+        </dependency>
+    </dependencies>
+</project>
+

Added: incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManager.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManager.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,66 @@
+/*
+
+ ============================================================================
+				   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+	this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+	this list of conditions and the following disclaimer in the documentation
+	and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+	include  the following  acknowledgment:  "This product includes  software
+	developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+	Alternately, this  acknowledgment may  appear in the software itself,  if
+	and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+	products derived  from this  software without  prior written
+	permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+	"Apache" appear  in their name,  without prior written permission  of the
+	Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import org.apache.eve.event.ConnectSubscriber ;
+import org.apache.eve.event.DisconnectSubscriber ;
+
+
+/**
+ * Service interface for server modules that monitor incomming PDU requests on
+ * a client's inputs.
+ */
+public interface InputManager
+    extends ConnectSubscriber, DisconnectSubscriber
+{
+    /** Role played by this service as specified by Avalon */
+    public static final String ROLE = InputManager.class.getName() ;
+}

Added: incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,160 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import java.io.IOException ;
+import java.nio.channels.Selector ;
+import java.nio.channels.SocketChannel ;
+
+import org.apache.eve.ResourceException ;
+import org.apache.eve.buffer.BufferPool ;
+import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.listener.KeyExpiryException ;
+
+
+/**
+ * Monitors input activity managed by the the InputManager.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public interface InputManagerMonitor
+{
+    /**
+     * Monitors client disconnections.
+     * 
+     * @param a_key the key of the client that was disconnected
+     */
+	void disconnectedClient( ClientKey a_key ) ;
+    
+    /**
+     * Monitors channel registrations which occur on client sockets.
+     * 
+     * @param a_key the key of the client whose channel got registered
+     * @param a_selector the selector used to register the client's channel
+     */
+	void registeredChannel( ClientKey a_key, Selector a_selector ) ;
+    
+    /**
+     * Monitors returns from the selector denoting a timeout or a wakeup due to
+     * input availability.
+     *
+     * @param a_selector the selector that has returned
+     */
+    void selectorReturned( Selector a_selector ) ;
+    
+    /**
+     * Monitors input read from a client socket channel.
+     * 
+     * @param a_key the key of the client sending the request
+     */
+    void inputRecieved( ClientKey a_key ) ;
+
+    
+	// ------------------------------------------------------------------------
+    // failure monitoring methods
+	// ------------------------------------------------------------------------
+
+
+    /**
+     * Monitor method for handling selector select call failures.
+     * 
+     * @param a_selector the selector the select was called on
+     * @param a_fault the faulting exception
+     */
+    void selectFailure( Selector a_selector, IOException a_fault ) ;
+    
+    /**
+     * Monitors attempts to use client key's that have expired.
+     *  
+     * @param a_key the client key that expired
+     * @param a_fault the faulting exception
+     */
+    void keyExpiryFailure( ClientKey a_key, KeyExpiryException a_fault ) ;
+    
+    /**
+     * Monitors failed read attempts from client socket channel.
+     * 
+     * @param a_key the key of the client the read failed on
+     * @param a_fault the faulting exception
+     */
+    void readFailed( ClientKey a_key, IOException a_fault ) ;
+
+    /**
+     * Monitors failed attempts to acquire a buffer from the BufferPool.
+     * 
+     * @param a_bp the buffer pool a buffer was requested from
+     * @param a_fault the faulting exception
+     */
+    void bufferUnavailable( BufferPool a_bp, ResourceException a_fault ) ;
+    
+    /**
+     * Monitors failures to register channels with a selector.
+     * 
+     * @param a_selector the selector the register method was called on
+     * @param a_channel the channel that failed registeration
+     * @param a_selectionKey the selection key used to register
+     * @param a_fault the faulting exception
+     */
+    void channelRegistrationFailure( Selector a_selector, 
+									 SocketChannel a_channel,
+									 int a_selectionKey,
+									 IOException a_fault ) ;
+    
+    /**
+     * Monitors failures to close a client's socket channel.
+     * 
+     * @param a_channel the channel that failed to close
+     * @param a_fault the faulting exception
+     */
+    void channelCloseFailure( SocketChannel a_channel, IOException a_fault ) ;
+}

Added: incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java
==============================================================================
--- (empty file)
+++ incubator/directory/ldap/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java	Tue Dec  9 15:52:59 2003
@@ -0,0 +1,166 @@
+/*
+
+ ============================================================================
+                   The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of  source code must  retain the above copyright  notice,
+    this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+    include  the following  acknowledgment:  "This product includes  software
+    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
+    Alternately, this  acknowledgment may  appear in the software itself,  if
+    and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Eve Directory Server", "Apache Directory Project", "Apache Eve" 
+	and "Apache Software Foundation"  must not be used to endorse or promote
+    products derived  from this  software without  prior written
+    permission. For written permission, please contact apache@apache.org.
+
+ 5. Products  derived from this software may not  be called "Apache", nor may
+    "Apache" appear  in their name,  without prior written permission  of the
+    Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
+ APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
+ ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
+ (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software  consists of voluntary contributions made  by many individuals
+ on  behalf of the Apache Software  Foundation. For more  information on the
+ Apache Software Foundation, please see <http://www.apache.org/>.
+
+*/
+package org.apache.eve.input ;
+
+
+import java.io.IOException ;
+import java.nio.channels.Selector ; 
+import java.nio.channels.SocketChannel ;
+
+import org.apache.eve.ResourceException ;
+import org.apache.eve.buffer.BufferPool ;
+import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.listener.KeyExpiryException ;
+
+
+/**
+ * An adaptor for the InputManagerMonitor interface.
+ *
+ * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
+ * @author $Author$
+ * @version $Revision$
+ */
+public class InputManagerMonitorAdapter implements InputManagerMonitor
+{
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * disconnectedClient(org.apache.eve.listener.ClientKey)
+     */
+    public void disconnectedClient( ClientKey a_key )
+    {
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * registeredChannel(org.apache.eve.listener.ClientKey, 
+     * java.nio.channels.Selector)
+     */
+    public void registeredChannel( ClientKey a_key, Selector a_selector )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * selectorReturned(java.nio.channels.Selector)
+     */
+    public void selectorReturned( Selector a_selector )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * inputRecieved(org.apache.eve.listener.ClientKey)
+     */
+    public void inputRecieved( ClientKey a_key )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * selectFailure(java.nio.channels.Selector, java.io.IOException)
+     */
+    public void selectFailure( Selector a_selector, IOException a_fault )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#keyExpiryFailure(
+     * org.apache.eve.listener.ClientKey, 
+     * org.apache.eve.listener.KeyExpiryException)
+     */
+    public void keyExpiryFailure( ClientKey a_key, KeyExpiryException a_fault )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * readFailed(org.apache.eve.listener.ClientKey, java.io.IOException)
+     */
+    public void readFailed( ClientKey a_key, IOException a_fault ) 
+    {
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * bufferUnavailable(org.apache.eve.buffer.BufferPool, 
+     * org.apache.eve.ResourceException)
+     */
+    public void bufferUnavailable( BufferPool a_bp, ResourceException a_fault )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * channelRegistrationFailure(java.nio.channels.Selector, 
+     * java.nio.channels.SocketChannel, int, java.io.IOException)
+     */
+    public void channelRegistrationFailure( Selector a_selector,
+        SocketChannel a_channel, int a_key, IOException a_fault)
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#
+     * channelCloseFailure(java.nio.channels.SocketChannel, java.io.IOException)
+     */
+    public void channelCloseFailure( SocketChannel a_channel, 
+									 IOException a_fault )
+    {
+    }
+}

Modified: incubator/directory/ldap/trunk/eve/frontend/listener/impl/project.xml
==============================================================================
--- incubator/directory/ldap/trunk/eve/frontend/listener/impl/project.xml	(original)
+++ incubator/directory/ldap/trunk/eve/frontend/listener/impl/project.xml	Tue Dec  9 15:52:59 2003
@@ -4,7 +4,7 @@
     <groupId>directory</groupId>
     <id>eve-frontend-listener-impl</id>
   
-    <name>Eve's Frontend Listener Implementation</name>
+    <name>Eve Frontend Listener Implementation</name>
     <package>org.apache.eve.listener</package>
     <currentVersion>SNAPSHOT</currentVersion>
     <inceptionYear>2003</inceptionYear>