directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 6654 - in incubator/directory/eve/trunk/eve/frontend: input/merlin-impl/src/java/org/apache/eve/input input/pojo-impl/src/java/org/apache/eve/input input/spi/src/java/org/apache/eve/input listener/merlin-impl listener/merlin-impl/conf listener/merlin-impl/src/java/org/apache/eve/listener listener/pojo-impl/src/java/org/apache/eve/listener listener/spi/src/java/org/apache/eve/listener
Date Sun, 15 Feb 2004 05:31:44 GMT
Author: akarasulu
Date: Sat Feb 14 21:31:43 2004
New Revision: 6654

Added:
   incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.xml
   incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/DefaultServerListener.java
   incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/LdapServerListener.java
Modified:
   incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java
   incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/MerlinInputManager.java
   incubator/directory/eve/trunk/eve/frontend/input/pojo-impl/src/java/org/apache/eve/input/DefaultInputManager.java
   incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java
   incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java
   incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/conf/block.xml
   incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/project.xml
   incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/AvalonListenerManagerMonitor.java
   incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.java
   incubator/directory/eve/trunk/eve/frontend/listener/pojo-impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
   incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitor.java
   incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitorAdapter.java
   incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ServerListener.java
Log:
Fixed a few problems with the selector usage.  And just cleaning up.


Modified: incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/AvalonInputManagerMonitor.java	Sat Feb 14 21:31:43 2004
@@ -1,76 +1,213 @@
 /*
-
- ============================================================================
-                   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/>.
-
-*/
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
 package org.apache.eve.input ;
 
 
-import org.apache.avalon.framework.logger.Logger ; 
-import org.apache.avalon.framework.logger.LogEnabled ;
+import java.io.IOException ;
+import java.nio.channels.Selector ;
+import java.nio.channels.SocketChannel ;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled ;
+
+import org.apache.eve.ResourceException ;
+import org.apache.eve.buffer.BufferPool ;
+import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.listener.KeyExpiryException ;
 
 
 /**
  * A monitor that uses Avolon logging life-cycle an loggers to report events
  * in the InputManager.
  *
- * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
- * @author $Author: akarasulu $
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
  * @version $Rev: 6373 $
  */
-public class AvalonInputManagerMonitor extends InputManagerMonitorAdapter
-    implements LogEnabled
+public class AvalonInputManagerMonitor extends AbstractLogEnabled
+    implements InputManagerMonitor
 {
-    /** the logger used to log messages */
-    private Logger m_log ;
+    /* (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 )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( 
+                    "Failed to acquire buffer resource from buffer pool "
+                    + a_bp, 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 )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "Could not properly close socket channel " 
+                    + a_channel, 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 )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "Could not register socket channel " + a_channel 
+                    + " for selector " + a_selector 
+                    + " using selection key mode " + a_key, a_fault ) ;
+        }
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#disconnectedClient(
+     * org.apache.eve.listener.ClientKey)
+     */
+    public void disconnectedClient( ClientKey a_key )
+    {
+        if ( getLogger().isInfoEnabled() )
+        {    
+            getLogger().info( "Disconnected client with key: " + a_key ) ;
+        }
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#enteringSelect(
+     * java.nio.channels.Selector)
+     */
+    public void enteringSelect( Selector a_selector )
+    {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( "About to enter select() on selector " 
+                    + a_selector ) ;
+        }
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#inputRecieved(
+     * org.apache.eve.listener.ClientKey)
+     */
+    public void inputRecieved( ClientKey a_key )
+    {
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( "Got some input from " + a_key ) ;
+        }
+    }
+
     
+    /* (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 )
+    {
+        if ( getLogger().isInfoEnabled() )
+        {
+            getLogger().info( "While working with client key " + a_key 
+                    + " it was prematurely expired!", 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 )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {
+            getLogger().error( "Encountered failure while reading from " 
+                    + a_key, a_fault ) ;
+        }
+    }
+
+    
+    /* (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 )
+    {
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( "Succeeded in registering " + a_key 
+                    + " with selector " + a_selector ) ;
+        }
+    }
+
+    
+    /* (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 )
+    {
+        if ( getLogger().isErrorEnabled() )
+        {
+            getLogger().error( "Failed on select() of selector " + a_selector, 
+                    a_fault ) ;
+        }
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#selectorReturned(
+     * java.nio.channels.Selector)
+     */
+    public void selectorReturned( Selector a_selector )
+    {
+        if ( getLogger().isDebugEnabled() )
+        {
+            getLogger().debug( "Select on " + a_selector + " returned" ) ;
+        }
+    }
+
     
-    public void enableLogging( Logger a_logger )
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#selectTimedOut(
+     * java.nio.channels.Selector)
+     */
+    public void selectTimedOut( Selector a_selector )
     {
-        m_log = a_logger ;
+        if ( getLogger().isWarnEnabled() )
+        {
+            getLogger().warn( "Select on " + a_selector + " timed out" ) ;
+        }
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/MerlinInputManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/MerlinInputManager.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/input/merlin-impl/src/java/org/apache/eve/input/MerlinInputManager.java	Sat Feb 14 21:31:43 2004
@@ -1,52 +1,19 @@
 /*
-
- ============================================================================
-                   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/>.
-
-*/
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
 package org.apache.eve.input ;
 
 
@@ -73,9 +40,9 @@
  * @avalon.component name="input-manager" lifestyle="singleton"
  * @avalon.service type="org.apache.eve.input.InputManager" version="1.0"
  * 
- * @author <a href="mailto:aok123@bellsouth.net">Alex Karasulu</a>
- * @author $Author: akarasulu $
- * @version $Revision$
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
  */
 public class MerlinInputManager extends AbstractLogEnabled 
     implements

Modified: incubator/directory/eve/trunk/eve/frontend/input/pojo-impl/src/java/org/apache/eve/input/DefaultInputManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/input/pojo-impl/src/java/org/apache/eve/input/DefaultInputManager.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/input/pojo-impl/src/java/org/apache/eve/input/DefaultInputManager.java	Sat Feb 14 21:31:43 2004
@@ -1,52 +1,19 @@
 /*
-
- ============================================================================
-                   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/>.
-
-*/
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
 package org.apache.eve.input ;
 
 
@@ -72,8 +39,8 @@
 /**
  * Default InputManager implementation based on NIO selectors and channels.
  *
- * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
- * @author $Author: akarasulu $
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
  * @version $Rev: 1452 $
  */
 public class DefaultInputManager implements InputManager
@@ -139,9 +106,10 @@
                  */
                 try
                 {
-                    if ( 0 == ( l_count = m_selector.select( 100 ) ) )
+                    m_monitor.enteringSelect( m_selector ) ;
+                    if ( 0 == ( l_count = m_selector.select() ) )
                     {
-                        m_monitor.selectorReturned( m_selector ) ;
+                        m_monitor.selectTimedOut( m_selector ) ;
                         continue ;
                     }
                 } 
@@ -184,6 +152,7 @@
         synchronized( m_hasStarted )
         {
             m_hasStarted = new Boolean( false ) ;
+            m_selector.wakeup() ;
             
             while ( m_thread.isAlive() )
             {

Modified: incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitor.java	Sat Feb 14 21:31:43 2004
@@ -157,4 +157,18 @@
      * @param a_fault the faulting exception
      */
     void channelCloseFailure( SocketChannel a_channel, IOException a_fault ) ;
+    
+    /**
+     * Monitors the occurrence of successful select timeouts on a selector
+     * 
+     * @param a_selector
+     */
+    void selectTimedOut( Selector a_selector ) ;
+    
+    /**
+     * A select call is about to be made.
+     *
+     * @param a_selector the selector on which the select is called
+     */
+    void enteringSelect( Selector a_selector ) ;
 }

Modified: incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/input/spi/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java	Sat Feb 14 21:31:43 2004
@@ -163,4 +163,22 @@
                                      IOException a_fault )
     {
     }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#enteringSelect(
+     * java.nio.channels.Selector)
+     */
+    public void enteringSelect( Selector a_selector )
+    {
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.input.InputManagerMonitor#selectTimedOut(
+     * java.nio.channels.Selector)
+     */
+    public void selectTimedOut( Selector a_selector )
+    {
+    }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/conf/block.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/conf/block.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/conf/block.xml	Sat Feb 14 21:31:43 2004
@@ -5,6 +5,7 @@
   <classloader>
     <classpath>
       <repository>
+        <resource id="commons-lang:commons-lang" version="2.0"/>
         <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"/>

Modified: incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/project.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/project.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/project.xml	Sat Feb 14 21:31:43 2004
@@ -22,6 +22,13 @@
   	
     <dependencies>
         <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.0</version>
+            <url>http://jakarata.apache.org/commons/lang</url>
+        </dependency>
+
+        <dependency>
             <groupId>avalon-framework</groupId>
             <artifactId>avalon-framework-api</artifactId>
             <version>4.1.5</version>

Modified: incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/AvalonListenerManagerMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/AvalonListenerManagerMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/AvalonListenerManagerMonitor.java	Sat Feb 14 21:31:43 2004
@@ -91,7 +91,10 @@
      */
     public void bindOccured( ServerListener a_listener )
     {
-        getLogger().info( "binding " + a_listener ) ;
+        if ( getLogger().isInfoEnabled() )
+        {    
+            getLogger().info( "binding " + a_listener ) ;
+        }
     }
 
     
@@ -101,7 +104,10 @@
      */
     public void unbindOccured( ServerListener a_listener )
     {
-        getLogger().info( "unbinding " + a_listener ) ;
+        if ( getLogger().isInfoEnabled() )
+        {    
+            getLogger().info( "unbinding " + a_listener ) ;
+        }
     }
 
     
@@ -143,8 +149,11 @@
      */
     public void failedToBind( ServerListener a_listener, IOException a_failure )
     {
-        getLogger().error( "failed to bind listener to " + a_listener
-                + " encountered exception: " + a_failure.getMessage() ) ;
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "failed to bind listener to " + a_listener
+                    + " encountered exception: " + a_failure.getMessage() ) ;
+        }
     }
 
 
@@ -155,8 +164,11 @@
     public void failedToUnbind( ServerListener a_listener, 
                                 IOException a_failure )
     {
-        getLogger().error( "failed to unbind listener from " + a_listener 
-            + " encountered exception: " + a_failure.getMessage() ) ;
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "failed to unbind listener from " + a_listener 
+                + " encountered exception: " + a_failure.getMessage() ) ;
+        }
     }
 
     
@@ -166,8 +178,11 @@
      */
     public void failedToExpire( ClientKey a_key, IOException a_failure )
     {
-        getLogger().error( "failed to expire client key " + a_key 
-                + " encountered exception: " + a_failure.getMessage() ) ;
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "failed to expire client key " + a_key 
+                    + " encountered exception: " + a_failure.getMessage() ) ;
+        }
     }
 
     
@@ -177,8 +192,11 @@
      */
     public void failedToAccept( SelectionKey a_key, IOException a_failure )
     {
-        getLogger().error( "failed to accept on selection key " + a_key 
-                + " encountered exception: " + a_failure.getMessage() ) ;
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "failed to accept on selection key " + a_key 
+                    + " encountered exception: " + a_failure.getMessage() ) ;
+        }
     }
 
     
@@ -188,7 +206,37 @@
      */
     public void failedToSelect( Selector a_selector, IOException a_failure )
     {
-        getLogger().error( "failed on select of selector " + a_selector 
-                + " encountered exception: " + a_failure.getMessage() ) ;
+        if ( getLogger().isErrorEnabled() )
+        {    
+            getLogger().error( "failed on select of selector " + a_selector 
+                    + " encountered exception: " + a_failure.getMessage() ) ;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ListenerManagerMonitor#selectTimedOut(
+     * java.nio.channels.Selector)
+     */
+    public void selectTimedOut( Selector a_selector )
+    {
+        if ( getLogger().isWarnEnabled() )
+        {    
+            getLogger().warn( "Timed out on selector " + a_selector 
+                    + " select()" ) ;
+        }
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ListenerManagerMonitor#
+     * enteringSelect(java.nio.channels.Selector)
+     */
+    public void enteringSelect( Selector a_selector ) 
+    {
+        if ( getLogger().isDebugEnabled() )
+        {    
+            getLogger().debug( "About to select on selector " + a_selector ) ;
+        }
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.java	Sat Feb 14 21:31:43 2004
@@ -51,14 +51,25 @@
 
 
 import java.io.IOException ;
+
+import java.net.InetAddress ;
+import java.net.UnknownHostException ;
+
+import java.util.ArrayList ;
 import java.util.EventObject ;
 
+import org.apache.avalon.framework.logger.Logger ;
 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.avalon.framework.configuration.Configurable ;
+import org.apache.avalon.framework.configuration.Configuration ;
+import org.apache.avalon.framework.configuration.ConfigurationException ;
+
+import org.apache.commons.lang.StringUtils ;
 
 import org.apache.eve.event.EventRouter ;
 import org.apache.eve.event.DisconnectEvent ;
@@ -79,13 +90,18 @@
     implements 
     ListenerManager,
     Initializable, 
+    Configurable,
     Serviceable,
     Startable
 {
+    /** the listener manager's avalon based monitor */
+    private AvalonListenerManagerMonitor m_monitor ;
     /** the listener manager implementation wrapped by this service */
     private DefaultListenerManager m_manager ;
     /** a temporary handle on the event router to bridge life-cycle methods */
     private EventRouter m_router ;
+    /** the set of listeners */
+    private ArrayList m_listeners ;
     
     
     // ------------------------------------------------------------------------
@@ -140,13 +156,35 @@
     
     
     /**
+     * Set's up the monitor with a logger.
+     * 
+     * @param a_logger a logger.
+     */
+    public void enableLogging( Logger a_logger ) 
+    {
+        super.enableLogging( a_logger ) ;
+        m_monitor = new AvalonListenerManagerMonitor() ;
+        m_monitor.enableLogging( a_logger ) ;
+    }
+    
+    
+    /**
      * Starts up this module.
      * 
      * @see org.apache.avalon.framework.activity.Startable#start()
      */
     public void start() throws Exception
     {
+        getLogger().debug( 
+                "About to call delegate start() from merlin wrapper!" ) ;
         m_manager.start() ;
+        getLogger().debug( 
+                "Completed call to delegate start() from merlin wrapper!" ) ;
+
+        for( int ii = 0; ii < m_listeners.size(); ii++ )
+        {    
+            m_manager.bind( ( ServerListener ) m_listeners.get( ii ) ) ;
+        }
     }
     
     
@@ -157,7 +195,16 @@
      */
     public void stop() throws Exception
     {
-        m_manager.stop() ;
+        getLogger().debug( 
+                "About to call delegate stop() from merlin wrapper!" ) ;
+        
+        if ( m_manager != null )
+        {    
+            m_manager.stop() ;
+        }
+        
+        getLogger().debug( 
+                "Completed call to delegate stop() from merlin wrapper!" ) ;
     }
     
     
@@ -180,5 +227,88 @@
     public void initialize() throws Exception
     {
         m_manager = new DefaultListenerManager( m_router ) ;
+        m_manager.setMonitor( m_monitor ) ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.configuration.Configurable#
+     * configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure( Configuration a_config ) 
+        throws ConfigurationException
+    {
+        if ( a_config.getChild( "listeners" ).getChildren().length == 0 )
+        {
+            m_listeners = new ArrayList( 1 ) ;
+            
+            try 
+            {
+                m_listeners.add( new LdapServerListener() ) ;
+            }
+            catch ( UnknownHostException e )
+            {
+                throw new ConfigurationException( "No configuration provided "
+                        + "for listener configuration and default listener "
+                        + "failed due to exception", e ) ;
+            }
+        }
+        
+        Configuration[] l_listeners = a_config
+            .getChild( "listeners" ).getChildren() ;
+        for ( int ii = 0; ii < l_listeners.length; ii++ )
+        {
+            int l_port = l_listeners[ii].getChild( "port" )
+                .getValueAsInteger( 389 ) ;
+            int l_backlog = l_listeners[ii].getChild( "backlog" )
+                .getValueAsInteger( 50 ) ;
+            boolean l_isSecure = l_listeners[ii].getChild( "isSecure" )
+                .getValueAsBoolean( false ) ;
+            String l_host = null ;
+            Configuration l_hostConf = l_listeners[ii]
+                .getChild( "host", false ) ;
+            Configuration l_addressConf = l_listeners[ii]
+                .getChild( "address", false ) ;
+            
+            if ( l_hostConf == null && l_addressConf == null )
+            {
+                try 
+                {
+                    l_host = InetAddress.getLocalHost().getHostName() ;
+                }
+                catch ( UnknownHostException e )
+                {
+                    throw new ConfigurationException( "No configuration address"
+                            + " or hostname provided and using localhost "
+                            + "failed due to exception", e ) ;
+                }
+            }
+            else if ( l_hostConf != null ) 
+            {
+                l_host = l_hostConf.getValue() ;
+            }
+            else if ( l_addressConf != null )
+            {
+                String l_addrStr = l_addressConf.getValue() ;
+                // split appart and build byte array
+                String[] l_octets = StringUtils.split( l_addrStr, '.' ) ;
+                byte[] l_address = new byte[ l_octets.length ] ;
+                for ( int jj =0; jj < l_octets.length; jj++ )
+                {
+                    l_address[jj] = Byte.parseByte( l_octets[jj] ) ;
+                }
+
+                try
+                {
+                    l_host = InetAddress.getByAddress( l_address )
+                        .getHostName() ;
+                }
+                catch ( UnknownHostException e )
+                {
+                    throw new ConfigurationException( "Could not find hostname "
+                            + "for address " + l_addrStr, e ) ;
+                }
+            }
+        }
     }
 }

Added: incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/listener/merlin-impl/src/java/org/apache/eve/listener/MerlinListenerManager.xml	Sat Feb 14 21:31:43 2004
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+  <listeners>
+    <listener>
+      <port>389</port>
+      <address>127.0.0.1</address>
+      <backlog>50</backlog>
+      <isSecure>false</isSecure>
+    </listener>
+
+    <listener>
+      <port>636</port>
+      <hostname>localhost</hostname>
+      <backlog>50</backlog>
+      <isSecure>false</isSecure>
+    </listener>
+  </listeners>
+</configuration>
\ No newline at end of file

Modified: incubator/directory/eve/trunk/eve/frontend/listener/pojo-impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/pojo-impl/src/java/org/apache/eve/listener/DefaultListenerManager.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/pojo-impl/src/java/org/apache/eve/listener/DefaultListenerManager.java	Sat Feb 14 21:31:43 2004
@@ -56,6 +56,7 @@
 import java.util.EventObject ;
 
 import java.io.IOException ;
+import java.net.InetAddress ;
 import java.net.InetSocketAddress ;
 
 import java.nio.channels.Selector ;
@@ -73,8 +74,6 @@
  * A listener manager that uses non-blocking NIO based constructs to detect
  * client connections on server socket listeners.
  * 
- * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
- * @author $Author$
  * @version $Rev$
  */
 public class DefaultListenerManager 
@@ -97,8 +96,8 @@
     /** the listner manager's monitor */
     private ListenerManagerMonitor m_monitor = 
         new ListenerManagerMonitorAdapter() ;
-    
 
+    
     /**
      * Creates a default listener manager using an event router.
      * 
@@ -120,7 +119,7 @@
      * 
      * @return Returns the monitor.
      */
-    ListenerManagerMonitor getMonitor()
+    public ListenerManagerMonitor getMonitor()
     {
         return m_monitor ;
     }
@@ -131,7 +130,7 @@
      * 
      * @param a_monitor The monitor to set.
      */
-    void setMonitor( ListenerManagerMonitor a_monitor )
+    public void setMonitor( ListenerManagerMonitor a_monitor )
     {
         m_monitor = a_monitor ;
     }
@@ -147,7 +146,7 @@
         {
             ServerSocketChannel l_channel = ServerSocketChannel.open() ;
             InetSocketAddress l_address = new InetSocketAddress( 
-                    a_listener.getAddress(), 
+                    InetAddress.getByAddress( a_listener.getAddress() ), 
                     a_listener.getPort() ) ;
             l_channel.socket().bind( l_address, a_listener.getBacklog() ) ;
             l_channel.configureBlocking( false ) ;
@@ -248,9 +247,10 @@
             
             try
             {
+                m_monitor.enteringSelect( m_selector ) ;
                 if ( 0 == ( l_count = m_selector.select() ) )
                 {
-                    m_monitor.selectOccured( m_selector ) ;
+                    m_monitor.selectTimedOut( m_selector ) ;
                     continue ;
                 }
             } 
@@ -275,6 +275,7 @@
                     try
                     {
                         l_channel = l_server.accept() ;
+                        l_list.remove() ;
                         m_monitor.acceptOccured( l_key ) ;
                     }
                     catch ( IOException e )
@@ -329,6 +330,7 @@
         synchronized( m_hasStarted )
         {
             m_hasStarted = new Boolean( false ) ;
+            m_selector.wakeup() ;
             
             while ( m_thread.isAlive() )
             {

Added: incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/DefaultServerListener.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/DefaultServerListener.java	Sat Feb 14 21:31:43 2004
@@ -0,0 +1,224 @@
+/*
+
+ ============================================================================
+                   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.listener ;
+
+
+/**
+ * A default server listener.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $LastChangedBy$
+ * @version $LastChangedRevision$
+ */
+public class DefaultServerListener implements ServerListener
+{
+    /** the port used for the connection */
+    private int m_port ;
+    /** the connection backlog */
+    private int m_backlog ;
+    /** the protocol's URL scheme */
+    private String m_scheme ;
+    /** the interface address or hostname of the server */
+    private byte[] m_address ;
+    /** whether or not ssl is used to secure connections */
+    private boolean m_isSecure ;
+    /** whether or not the transport is reliable (TCP or UDP) */
+    private boolean m_isReliable ;
+    
+    
+    /**
+     * Creates a default listener with all the supplied properties.
+     * 
+     * @param a_address the interface address or hostname of the server
+     * @param a_scheme the URL scheme for the protocol
+     * @param a_port the port used for the connection
+     * @param a_backlog the connection backlog
+     * @param a_isSecure whether or not ssl is used to secure connections
+     * @param a_isReliable whether or not the transport is reliable (TCP or UDP)
+     */
+    public DefaultServerListener( byte[] a_address, String a_scheme, int a_port,
+                                  int a_backlog, boolean a_isSecure, 
+                                  boolean a_isReliable )
+    {
+        m_port = a_port ;
+        m_scheme = a_scheme ;
+        m_backlog = a_backlog ;
+        m_address = a_address ;
+        m_isSecure = a_isSecure ;
+        m_isReliable = a_isReliable ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#getAddress()
+     */
+    public byte[] getAddress()
+    {
+        return m_address ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#getBacklog()
+     */
+    public int getBacklog()
+    {
+        return m_backlog ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#getPort()
+     */
+    public int getPort()
+    {
+        return m_port ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#isSecure()
+     */
+    public boolean isSecure()
+    {
+        return m_isSecure ;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#getURL()
+     */
+    public String getURL()
+    {
+        StringBuffer l_buf = new StringBuffer() ;
+        
+        l_buf.append( m_scheme ) ;
+        l_buf.append( "://" ) ;
+        l_buf.append( m_address ) ;
+        l_buf.append( ':' ) ;
+        l_buf.append( m_port ) ;
+        
+        return l_buf.toString() ;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#getProtocolUrlScheme()
+     */
+    public String getProtocolUrlScheme()
+    {
+        return m_scheme ;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ServerListener#isReliable()
+     */
+    public boolean isReliable()
+    {
+        return m_isReliable ;
+    }
+    
+    
+    /**
+     * Sets the address for the 
+     * 
+     * @param a_address The address to set.
+     */
+    protected void setAddress( byte[] a_address )
+    {
+        m_address = a_address ;
+    }
+    
+
+    /**
+     * @param a_backlog The backlog to set.
+     */
+    protected void setBacklog( int a_backlog )
+    {
+        m_backlog = a_backlog ;
+    }
+
+    
+    /**
+     * @param a_isReliable The isReliable to set.
+     */
+    protected void setReliable( boolean a_isReliable )
+    {
+        m_isReliable = a_isReliable ;
+    }
+
+    
+    /**
+     * @param a_isSecure The isSecure to set.
+     */
+    protected void setSecure( boolean a_isSecure )
+    {
+        m_isSecure = a_isSecure ;
+    }
+
+    
+    /**
+     * @param a_port The port to set.
+     */
+    protected void setPort( int a_port )
+    {
+        m_port = a_port ;
+    }
+
+    
+    /**
+     * @param a_scheme The scheme to set.
+     */
+    protected void setScheme( String a_scheme )
+    {
+        m_scheme = a_scheme ;
+    }
+}

Added: incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/LdapServerListener.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/LdapServerListener.java	Sat Feb 14 21:31:43 2004
@@ -0,0 +1,94 @@
+/*
+
+ ============================================================================
+                   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.listener ;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+
+/**
+ * An LDAP specific server listener.
+ *
+ * @author <a href="mailto:akarasulu@apache.org">Alex Karasulu</a>
+ * @author $LastChangedBy$
+ * @version $LastChangedRevision$
+ */
+public class LdapServerListener extends DefaultServerListener
+{
+    /**
+     * Creates an LDAP specific server listener.
+     *  
+     * @param a_hostname the hostname
+     * @param a_port the TCP port 
+     * @param a_backlog the connection backlog
+     * @param a_secure whether or not ssl is used
+     */
+    public LdapServerListener( String a_hostname, int a_port, int a_backlog,
+        boolean a_secure )
+        throws UnknownHostException
+    {
+        super( InetAddress.getByName( a_hostname ).getAddress(), 
+                a_secure ? "ldaps" : "ldap" , a_port, a_backlog,
+				a_secure, true ) ;
+    }
+
+
+    /**
+     * Creates a default LDAP specific server listener configured for TCP port 
+     * 389 using the address of the local host whatever that may be as defined 
+     * by the naming system.
+     */
+    public LdapServerListener()
+        throws UnknownHostException
+    {
+        super( InetAddress.getLocalHost().getAddress(), 
+                "ldap", 389, 0, false, true ) ;
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitor.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitor.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitor.java	Sat Feb 14 21:31:43 2004
@@ -107,6 +107,13 @@
     void selectOccured( Selector a_selector ) ;
     
     /**
+     * Monitors the occurrence of successful select timeouts on a selector
+     * 
+     * @param a_selector
+     */
+    void selectTimedOut( Selector a_selector ) ;
+    
+    /**
      * Monitors bind failures.
      * 
      * @param a_listener the listener whose bind attempt failed
@@ -145,4 +152,11 @@
      * @param a_failure the exception resulting from the failure
      */
     void failedToSelect( Selector a_selector, IOException a_failure ) ;
+    
+    /**
+     * A select call is about to be made.
+     *
+     * @param a_selector the selector on which the select is called
+     */
+    void enteringSelect( Selector a_selector ) ;
 }

Modified: incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitorAdapter.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ListenerManagerMonitorAdapter.java	Sat Feb 14 21:31:43 2004
@@ -164,4 +164,22 @@
     public void failedToSelect( Selector a_selector, IOException a_failure )
     {
     }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ListenerManagerMonitor#selectTimedOut(
+     * java.nio.channels.Selector)
+     */
+    public void selectTimedOut(Selector a_a_selector)
+    {
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.listener.ListenerManagerMonitor#enteringSelect(
+     * java.nio.channels.Selector)
+     */
+    public void enteringSelect( Selector a_selector )
+    {
+    }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ServerListener.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ServerListener.java	(original)
+++ incubator/directory/eve/trunk/eve/frontend/listener/spi/src/java/org/apache/eve/listener/ServerListener.java	Sat Feb 14 21:31:43 2004
@@ -82,11 +82,32 @@
      *
      * @return the ip address octets as a String i.e. 127.0.0.1
      */
-    public String getAddress() ;
+    public byte[] getAddress() ;
+    
+    /**
+     * Gets whether or not the listener is for establishing secure connections.
+     * 
+     * @return true if ssl is used to secure the connection, false otherwise.
+     */
+    public boolean isSecure() ;
+    
+    /**
+     * Get whether or not the transport is reliable or not.
+     * 
+     * @return true if it is reliable (TCP), false if it is not.
+     */
+    public boolean isReliable() ;
+    
+    /**
+     * Gets the protocol's URL scheme.
+     * 
+     * @return the URL scheme for the protocol
+     */
+    public String getProtocolUrlScheme() ;
 
     /**
-     * Gets the LDAP URL for this ServerListener using the specified ip address
-     * and the tcp port number listened to.  The ipaddress is resolved to a host
+     * Gets the URL for this ServerListener using the specified ip address and 
+     * the tcp port number listened to.  The ipaddress is resolved to a host 
      * name.
      *
      * @return the LDAP URL like so ldap://localhost:389

Mime
View raw message