Author: akarasulu
Date: Sat Sep 4 22:33:50 2004
New Revision: 43367
Removed:
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/LdapServerListener.java
Modified:
incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/listener/ServerListener.java
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultServerListener.java
Log:
Commit changes:
o service listener configuration bean now uses InetServiceEntry
o removed LDAP specific LdapServerListener
o cleaned up code expecting port and other information in listener config
Modified:
incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/listener/ServerListener.java
==============================================================================
---
incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/listener/ServerListener.java
(original)
+++
incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/listener/ServerListener.java
Sat Sep 4 22:33:50 2004
@@ -16,10 +16,11 @@
*/
package org.apache.eve.listener ;
+import org.apache.eve.protocol.InetServiceEntry;
/**
- * A server listener specification interface.
+ * A server listener configuration interface.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
* @author $Author$
@@ -27,9 +28,6 @@
*/
public interface ServerListener
{
- /** role of this service interface */
- public static final String ROLE = ServerListener.class.getName() ;
-
/**
* Gets the server socket backlog for this ServerListener
*
@@ -38,13 +36,6 @@
public int getBacklog() ;
/**
- * Gets the TCP port number this ServerListener listens on.
- *
- * @return the tcp port number
- */
- public int getPort() ;
-
- /**
* Gets the ip interface address this ServerListener listens on.
*
* @return the ip address octets i.e. { 127,0,0,1 } for 127.0.0.1
@@ -59,20 +50,6 @@
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 URL for this ServerListener using the specified ip address and
* the tcp port number listened to. The ipaddress is resolved to a host
* name.
@@ -80,4 +57,11 @@
* @return the URL with scheme like so ldap://localhost:389
*/
public String getURL() ;
+
+ /**
+ * Gets the InetServiceEntry associated with this ServerListener.
+ *
+ * @return the service entry for this listener
+ */
+ public InetServiceEntry getInetServiceEntry();
}
Modified:
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
==============================================================================
---
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
(original)
+++
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
Sat Sep 4 22:33:50 2004
@@ -118,8 +118,7 @@
/**
- * @see org.apache.eve.listener.ListenerManager#register(org.apache.eve.
- * listener.ServerListener)
+ * @see org.apache.eve.listener.ListenerManager#bind(ServerListener)
*/
public void bind( ServerListener listener ) throws IOException
{
@@ -133,8 +132,7 @@
/**
- * @see org.apache.eve.listener.ListenerManager#unregister(org.apache.eve.
- * listener.ServerListener)
+ * @see org.apache.eve.listener.ListenerManager#unbind(ServerListener)
*/
public void unbind( ServerListener listener ) throws IOException
{
@@ -166,7 +164,7 @@
ServerSocketChannel channel = ServerSocketChannel.open() ;
InetSocketAddress address = new InetSocketAddress(
InetAddress.getByAddress( listener.getAddress() ),
- listener.getPort() ) ;
+ listener.getInetServiceEntry().getPort() ) ;
channel.socket().bind( address, listener.getBacklog() ) ;
channel.configureBlocking( false ) ;
channel.register( selector, SelectionKey.OP_ACCEPT,
@@ -280,8 +278,6 @@
{
while ( hasStarted.booleanValue() )
{
- int count = 0 ;
-
try
{
monitor.enteringSelect( selector ) ;
@@ -289,7 +285,7 @@
bind() ;
unbind() ;
- if ( 0 == ( count = selector.select() ) )
+ if ( 0 == selector.select() )
{
monitor.selectTimedOut( selector ) ;
continue ;
Modified:
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultServerListener.java
==============================================================================
---
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultServerListener.java
(original)
+++
incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/listener/DefaultServerListener.java
Sat Sep 4 22:33:50 2004
@@ -14,7 +14,10 @@
* limitations under the License.
*
*/
-package org.apache.eve.listener ;
+package org.apache.eve.listener;
+
+
+import org.apache.eve.protocol.InetServiceEntry;
/**
@@ -26,40 +29,31 @@
*/
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 ;
+ private int backlog;
/** the interface address or hostname of the server */
- private byte[] m_address ;
+ private byte[] 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 ;
-
-
+ private boolean isSecure;
+ /** the inet service provided by this listener */
+ private InetServiceEntry servEnt;
+
/**
* 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)
+ * @param servEnt the inet service entry for the service this listner
+ * provides
*/
- 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 ;
+ public DefaultServerListener( byte[] a_address, int a_backlog,
+ boolean a_isSecure, InetServiceEntry servEnt
)
+ {
+ this.backlog = a_backlog;
+ this.address = a_address;
+ this.isSecure = a_isSecure;
+ this.servEnt = servEnt;
}
@@ -68,7 +62,7 @@
*/
public byte[] getAddress()
{
- return m_address ;
+ return this.address;
}
@@ -77,16 +71,7 @@
*/
public int getBacklog()
{
- return m_backlog ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#getPort()
- */
- public int getPort()
- {
- return m_port ;
+ return this.backlog;
}
@@ -95,7 +80,7 @@
*/
public boolean isSecure()
{
- return m_isSecure ;
+ return this.isSecure;
}
@@ -104,36 +89,30 @@
*/
public String getURL()
{
- StringBuffer l_buf = new StringBuffer() ;
+ 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 ) ;
+ l_buf.append( servEnt.getName() );
+ l_buf.append( "://" );
+ l_buf.append( this.address );
+ l_buf.append( ':' );
+ l_buf.append( servEnt.getPort() );
- return l_buf.toString() ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#getProtocolUrlScheme()
- */
- public String getProtocolUrlScheme()
- {
- return m_scheme ;
+ return l_buf.toString();
}
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#isReliable()
+
+ /**
+ * Gets the Inet service entry for the service this config's listner
+ * provides.
+ *
+ * @return the served service's entry
*/
- public boolean isReliable()
+ public InetServiceEntry getInetServiceEntry()
{
- return m_isReliable ;
+ return servEnt;
}
-
-
+
+
/**
* Sets the address for the
*
@@ -141,7 +120,7 @@
*/
protected void setAddress( byte[] a_address )
{
- m_address = a_address ;
+ this.address = a_address;
}
@@ -150,16 +129,7 @@
*/
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 ;
+ this.backlog = a_backlog;
}
@@ -168,24 +138,17 @@
*/
protected void setSecure( boolean a_isSecure )
{
- m_isSecure = a_isSecure ;
+ this.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.
+ * Set's the inet service entry.
+ *
+ * @param servEnt the service entry of the service this listener provides
*/
- protected void setScheme( String a_scheme )
+ protected void setInetServiceEntry( InetServiceEntry servEnt )
{
- m_scheme = a_scheme ;
+ this.servEnt = servEnt;
}
}