You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2004/10/11 16:52:29 UTC
svn commit: rev 54594 - in incubator/directory/seda/branches/trustin_api_redesign/src: java/org/apache/seda java/org/apache/seda/impl java/org/apache/seda/stage/input java/org/apache/seda/stage/listener test/org/apache/seda test/org/apache/seda/listener
Author: trustin
Date: Mon Oct 11 07:52:28 2004
New Revision: 54594
Added:
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/SedaException.java (contents, props changed)
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/BindPoint.java
- copied, changed from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/ListenerConfig.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InetSocketBindPoint.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpBindPoint.java
- copied, changed from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPListenerConfig.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpInputManager.java
- copied, changed from rev 54585, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPInputManager.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UdpBindPoint.java
- copied, changed from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UDPListenerConfig.java
Removed:
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/ListenerConfig.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/SocketListenerConfig.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPInputManager.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPListenerConfig.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UDPListenerConfig.java
Modified:
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/ResourceException.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontend.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontendFactory.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InputManager.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManager.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitor.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitorAdapter.java
incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/TCPListenerManager.java
incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/ProtocolTestCase.java
incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/listener/TCPListenerManagerTest.java
Log:
Renamed ListenerConfigs to BindPoints to be more accurate.
Seperating org.apache.seda.protocol and org.apache.seda.stage.
- org.apache.seda.protocol package will be a kind of frontend, and we still should be able to use SEDA without it.
Replaced TCP with Tcp, UDP with Udp.
Added SedaException (RuntimeException) to replace IOExceptions
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/ResourceException.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/ResourceException.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/ResourceException.java Mon Oct 11 07:52:28 2004
@@ -24,7 +24,7 @@
* Directory Project</a>
* @version $Rev$
*/
-public class ResourceException extends Exception {
+public class ResourceException extends SedaException {
/**
* Creates a simple ResourceException without any details.
*/
Added: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/SedaException.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/SedaException.java Mon Oct 11 07:52:28 2004
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ */
+/*
+ * @(#) $Id$
+ */
+package org.apache.seda;
+
+
+/**
+ * A base exception for all SEDA failures.
+ *
+ * @author Trustin Lee (trustin@gmail.com)
+ * @version $Rev$, $Date$
+ */
+public class SedaException extends RuntimeException {
+ /**
+ * Creates a new instance.
+ */
+ public SedaException() {
+ super();
+ }
+
+ /**
+ * Creates a new instance with the specified message.
+ */
+ public SedaException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance with the specified cause.
+ */
+ public SedaException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new instance with the specified message and cause.
+ */
+ public SedaException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontend.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontend.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontend.java Mon Oct 11 07:52:28 2004
@@ -27,7 +27,7 @@
import org.apache.seda.stage.encode.DefaultEncoderManager;
import org.apache.seda.stage.encode.EncoderManager;
import org.apache.seda.stage.input.InputManager;
-import org.apache.seda.stage.input.TCPInputManager;
+import org.apache.seda.stage.input.TcpInputManager;
import org.apache.seda.stage.listener.ListenerManager;
import org.apache.seda.stage.listener.TCPListenerManager;
import org.apache.seda.stage.output.DefaultOutputManager;
@@ -82,7 +82,7 @@
public void stop() throws Exception {
((TCPListenerManager) srvMan).stop();
- ((TCPInputManager) inMan).stop();
+ ((TcpInputManager) inMan).stop();
((DefaultOutputManager) outMan).stop();
//( ( DefaultRequestProcessor ) reqProc ).stop();
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontendFactory.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontendFactory.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/impl/DefaultFrontendFactory.java Mon Oct 11 07:52:28 2004
@@ -38,7 +38,7 @@
import org.apache.seda.stage.encode.EncodeStageHandler;
import org.apache.seda.stage.encode.EncoderManager;
import org.apache.seda.stage.input.InputManager;
-import org.apache.seda.stage.input.TCPInputManager;
+import org.apache.seda.stage.input.TcpInputManager;
import org.apache.seda.stage.listener.ListenerManager;
import org.apache.seda.stage.listener.TCPListenerManager;
import org.apache.seda.stage.output.DefaultOutputManager;
@@ -165,7 +165,7 @@
private InputManager createInputManager(EventRouter router, BufferPool bp)
throws IOException {
- TCPInputManager inMan = new TCPInputManager(router, bp);
+ TcpInputManager inMan = new TcpInputManager(router, bp);
inMan.start();
return inMan;
Copied: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/BindPoint.java (from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/ListenerConfig.java)
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/ListenerConfig.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/BindPoint.java Mon Oct 11 07:52:28 2004
@@ -23,19 +23,5 @@
* @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public abstract class ListenerConfig {
- /**
- * Empty default constructor.
- */
- protected ListenerConfig() {
- }
-
- /**
- * Gets the URI for this ListenerConfig using the specified ip address and
- * the tcp port number listened to. The ipaddress is resolved to a host
- * name.
- *
- * @return the URI with scheme like so ldap://localhost:389
- */
- public abstract String getURI();
+public interface BindPoint {
}
Added: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InetSocketBindPoint.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InetSocketBindPoint.java Mon Oct 11 07:52:28 2004
@@ -0,0 +1,49 @@
+/*
+ * 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.seda.stage.input;
+
+import java.net.InetSocketAddress;
+
+
+/**
+ * The configuration base class for socket based listeners.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory Project</a>
+ * @version $Rev$
+ */
+public abstract class InetSocketBindPoint implements BindPoint {
+ /** the InetSocketAddress associated with this server socket configuration */
+ private final InetSocketAddress socketAddress;
+
+ /**
+ * Creates a socket listener config with all the supplied properties.
+ *
+ * @param inetAddress the inetAddress for the server listener
+ */
+ protected InetSocketBindPoint(InetSocketAddress inetAddress) {
+ this.socketAddress = inetAddress;
+ }
+
+ /**
+ * Gets the InetAddress associated with this server socket configuration.
+ *
+ * @return the address for the server socket associated with this config
+ */
+ public InetSocketAddress getAddress() {
+ return socketAddress;
+ }
+}
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InputManager.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InputManager.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/InputManager.java Mon Oct 11 07:52:28 2004
@@ -16,6 +16,10 @@
*/
package org.apache.seda.stage.input;
+import org.apache.seda.Subscriber;
+
+import java.io.IOException;
+
/**
* Service interface for server modules that monitor incomming PDU requests on
@@ -24,5 +28,23 @@
* @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public interface InputManager {
+public interface InputManager extends Subscriber {
+ /**
+ * Binds and registers a server listener.
+ *
+ * @param listenerConfig the listener to register and bind
+ */
+ void bind(BindPoint listenerConfig) throws IOException;
+
+ /**
+ * Unbinds and unregisters a server listener.
+ *
+ * @param listenerConfig the listener to unregister and unbind
+ * @throws IOException if there is a problem unbinding a listener
+ */
+ void unbind(BindPoint listenerConfig) throws IOException;
+
+ InputManagerMonitor getMonitor();
+
+ void setMonitor(InputManagerMonitor monitor);
}
Copied: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpBindPoint.java (from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPListenerConfig.java)
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPListenerConfig.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpBindPoint.java Mon Oct 11 07:52:28 2004
@@ -16,9 +16,7 @@
*/
package org.apache.seda.stage.input;
-import org.apache.seda.protocol.InetServiceEntry;
-
-import java.net.InetAddress;
+import java.net.InetSocketAddress;
/**
@@ -28,32 +26,23 @@
* @author $LastChangedBy$
* @version $LastChangedRevision$
*/
-public class TCPListenerConfig extends SocketListenerConfig {
+public class TcpBindPoint extends InetSocketBindPoint {
/** the connection backlog */
- private int backlog;
+ private final int backlog;
/**
- * Creates a default listener with all the supplied properties.
- *
- * @param inetAddress the inetAddress for the server listener
- * @param servEnt the inet service entry for the service this listner
- * provides
+ * Creates a new instance.
*/
- public TCPListenerConfig(InetAddress inetAddress, InetServiceEntry servEnt) {
- super(inetAddress, servEnt);
+ public TcpBindPoint(InetSocketAddress socketAddress) {
+ this(socketAddress, 50);
}
-
- /* (non-Javadoc)
- * @see org.apache.seda.listener.ServerListener#getBacklog()
- */
- public int getBacklog() {
- return this.backlog;
+
+ public TcpBindPoint(InetSocketAddress socketAddress, int backlog) {
+ super(socketAddress);
+ this.backlog = backlog;
}
- /**
- * @param a_backlog The backlog to set.
- */
- protected void setBacklog(int a_backlog) {
- this.backlog = a_backlog;
+ public int getBacklog() {
+ return backlog;
}
}
Copied: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpInputManager.java (from rev 54585, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPInputManager.java)
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TCPInputManager.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/TcpInputManager.java Mon Oct 11 07:52:28 2004
@@ -41,7 +41,7 @@
* @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
* @version $Rev: 1452 $
*/
-public class TCPInputManager extends AbstractSubscriber implements InputManager,
+public class TcpInputManager extends AbstractSubscriber implements InputManager,
ConnectSubscriber,
DisconnectSubscriber,
Runnable {
@@ -79,7 +79,7 @@
* @param router an event router service
* @param bp a buffer pool service
*/
- public TCPInputManager(EventRouter router, BufferPool bp)
+ public TcpInputManager(EventRouter router, BufferPool bp)
throws IOException {
this.bp = bp;
hasStarted = new Boolean(false);
@@ -395,7 +395,7 @@
*/
class ConcreteInputEvent extends InputEvent {
ConcreteInputEvent(ClientKey key, ByteBuffer buffer) {
- super(TCPInputManager.this, key, buffer);
+ super(TcpInputManager.this, key, buffer);
}
public ByteBuffer claimInterest(Object party) {
Copied: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UdpBindPoint.java (from rev 54586, incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UDPListenerConfig.java)
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UDPListenerConfig.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/input/UdpBindPoint.java Mon Oct 11 07:52:28 2004
@@ -16,9 +16,7 @@
*/
package org.apache.seda.stage.input;
-import org.apache.seda.protocol.InetServiceEntry;
-
-import java.net.InetAddress;
+import java.net.InetSocketAddress;
/**
@@ -28,15 +26,11 @@
* @author $LastChangedBy$
* @version $LastChangedRevision$
*/
-public class UDPListenerConfig extends SocketListenerConfig {
+public class UdpBindPoint extends InetSocketBindPoint {
/**
- * Creates a default listener with all the supplied properties.
- *
- * @param a_address the interface address or hostname of the server
- * @param servEnt the inet service entry for the service this listner
- * provides
+ * Creates a new instance.
*/
- public UDPListenerConfig(InetAddress a_address, InetServiceEntry servEnt) {
- super(a_address, servEnt);
+ public UdpBindPoint(InetSocketAddress socketAddress) {
+ super(socketAddress);
}
}
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManager.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManager.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManager.java Mon Oct 11 07:52:28 2004
@@ -18,7 +18,7 @@
import java.io.IOException;
-import org.apache.seda.stage.input.ListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
/**
@@ -34,7 +34,7 @@
*
* @param listenerConfig the listener to register and bind
*/
- public void bind(ListenerConfig listenerConfig) throws IOException;
+ public void bind(BindPoint listenerConfig) throws IOException;
/**
* Unbinds and unregisters a server listener.
@@ -42,5 +42,5 @@
* @param listenerConfig the listener to unregister and unbind
* @throws IOException if there is a problem unbinding a listener
*/
- public void unbind(ListenerConfig listenerConfig) throws IOException;
+ public void unbind(BindPoint listenerConfig) throws IOException;
}
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitor.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitor.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitor.java Mon Oct 11 07:52:28 2004
@@ -21,7 +21,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
-import org.apache.seda.stage.input.ListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
/**
@@ -50,14 +50,14 @@
*
* @param listenerConfig the listener just bound to a port
*/
- void bindOccured(ListenerConfig listenerConfig);
+ void bindOccured(BindPoint listenerConfig);
/**
* Monitors unbind occurences.
*
* @param listenerConfig the listener just unbound from a port
*/
- void unbindOccured(ListenerConfig listenerConfig);
+ void unbindOccured(BindPoint listenerConfig);
/**
* Monitors the occurrence of successful socket accept attempts
@@ -86,7 +86,7 @@
* @param listenerConfig the listener whose bind attempt failed
* @param failure the exception resulting from the failure
*/
- void failedToBind(ListenerConfig listenerConfig, IOException failure);
+ void failedToBind(BindPoint listenerConfig, IOException failure);
/**
* Monitors unbind failures.
@@ -94,7 +94,7 @@
* @param listenerConfig the listener whose unbind attempt failed
* @param failure the exception resulting from the failure
*/
- void failedToUnbind(ListenerConfig listenerConfig, IOException failure);
+ void failedToUnbind(BindPoint listenerConfig, IOException failure);
/**
* Monitors expiration failures on client keys.
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitorAdapter.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitorAdapter.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/ListenerManagerMonitorAdapter.java Mon Oct 11 07:52:28 2004
@@ -21,7 +21,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
-import org.apache.seda.stage.input.ListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
/**
@@ -37,10 +37,10 @@
public void stopped() {
}
- public void bindOccured(ListenerConfig listenerConfig) {
+ public void bindOccured(BindPoint listenerConfig) {
}
- public void unbindOccured(ListenerConfig listenerConfig) {
+ public void unbindOccured(BindPoint listenerConfig) {
}
public void acceptOccured(SelectionKey key) {
@@ -52,13 +52,13 @@
public void selectTimedOut(Selector selector) {
}
- public void failedToBind(ListenerConfig listenerConfig, IOException failure) {
+ public void failedToBind(BindPoint listenerConfig, IOException failure) {
if (failure != null) {
failure.printStackTrace();
}
}
- public void failedToUnbind(ListenerConfig listenerConfig,
+ public void failedToUnbind(BindPoint listenerConfig,
IOException failure
) {
if (failure != null) {
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/TCPListenerManager.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/TCPListenerManager.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/java/org/apache/seda/stage/listener/TCPListenerManager.java Mon Oct 11 07:52:28 2004
@@ -17,8 +17,8 @@
package org.apache.seda.stage.listener;
import org.apache.seda.EventRouter;
-import org.apache.seda.stage.input.ListenerConfig;
-import org.apache.seda.stage.input.TCPListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
+import org.apache.seda.stage.input.TcpBindPoint;
import java.io.IOException;
@@ -119,7 +119,7 @@
/**
* @see org.apache.seda.stage.listener.ListenerManager#bind(ListenerConfig)
*/
- public void bind(ListenerConfig listener) throws IOException {
+ public void bind(BindPoint listener) throws IOException {
ensureListenerConfigType(listener);
synchronized (bindListeners) {
@@ -132,7 +132,7 @@
/**
* @see org.apache.seda.stage.listener.ListenerManager#unbind(ListenerConfig)
*/
- public void unbind(ListenerConfig listener) throws IOException {
+ public void unbind(BindPoint listener) throws IOException {
ensureListenerConfigType(listener);
synchronized (unbindListeners) {
@@ -142,12 +142,12 @@
selector.wakeup();
}
- private void ensureListenerConfigType(ListenerConfig listener) {
+ private void ensureListenerConfigType(BindPoint listener) {
if (listener == null) {
throw new NullPointerException();
}
- if (!(listener instanceof TCPListenerConfig)) {
+ if (!(listener instanceof TcpBindPoint)) {
throw new IllegalArgumentException();
}
}
@@ -162,12 +162,12 @@
Iterator list = bindListeners.iterator();
while (list.hasNext()) {
- TCPListenerConfig listener = (TCPListenerConfig) list.next();
+ TcpBindPoint listener = (TcpBindPoint) list.next();
try {
ServerSocketChannel channel = ServerSocketChannel.open();
InetSocketAddress address =
- new InetSocketAddress(listener.getInetAddress(),
+ new InetSocketAddress(listener.getSocketAddress(),
listener.getInetServiceEntry()
.getPort()
);
@@ -203,7 +203,7 @@
while (keys.hasNext()) {
key = (SelectionKey) keys.next();
- ListenerConfig listener = (ListenerConfig) key.attachment();
+ BindPoint listener = (BindPoint) key.attachment();
if (unbindListeners.contains(listener)) {
try {
@@ -350,7 +350,7 @@
Iterator list = listeners.iterator();
while (list.hasNext()) {
- ListenerConfig listener = (ListenerConfig) list.next();
+ BindPoint listener = (BindPoint) list.next();
try {
/*
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/DefaultFrontendFactoryTest.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/DefaultFrontendFactoryTest.java Mon Oct 11 07:52:28 2004
@@ -25,8 +25,8 @@
import org.apache.seda.impl.DefaultFrontendFactory;
import org.apache.seda.protocol.DefaultInetServicesDatabase;
import org.apache.seda.protocol.InetServiceEntry;
-import org.apache.seda.stage.input.ListenerConfig;
-import org.apache.seda.stage.input.TCPListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
+import org.apache.seda.stage.input.TcpBindPoint;
import org.apache.seda.stage.listener.AvailablePortFinder;
import java.io.IOException;
@@ -89,9 +89,9 @@
*/
public void testBind() throws IOException {
int port = AvailablePortFinder.getNextAvailable();
- ListenerConfig config = null;
+ BindPoint config = null;
config =
- new TCPListenerConfig(InetAddress.getLocalHost(),
+ new TcpBindPoint(InetAddress.getLocalHost(),
new InetServiceEntry("ldap", port)
);
fe.getListenerManager().bind(config);
@@ -105,8 +105,8 @@
);
((DefaultInetServicesDatabase) fe.getInetServicesDatabase()).addEntry(srvEntry);
- ListenerConfig config = null;
- config = new TCPListenerConfig(InetAddress.getLocalHost(), srvEntry);
+ BindPoint config = null;
+ config = new TcpBindPoint(InetAddress.getLocalHost(), srvEntry);
fe.getListenerManager().bind(config);
fe.register(new EchoProtocolProvider());
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/ProtocolTestCase.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/ProtocolTestCase.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/ProtocolTestCase.java Mon Oct 11 07:52:28 2004
@@ -23,8 +23,8 @@
import org.apache.seda.protocol.DefaultInetServicesDatabase;
import org.apache.seda.protocol.InetServiceEntry;
import org.apache.seda.protocol.ProtocolProvider;
-import org.apache.seda.stage.input.ListenerConfig;
-import org.apache.seda.stage.input.TCPListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
+import org.apache.seda.stage.input.TcpBindPoint;
import org.apache.seda.stage.listener.AvailablePortFinder;
import java.net.InetAddress;
@@ -46,7 +46,7 @@
protected ProtocolProvider proto = null;
/** the listener configuration for the protocol */
- protected ListenerConfig config = null;
+ protected BindPoint config = null;
public ProtocolTestCase(ProtocolProvider proto) {
this.proto = proto;
@@ -78,7 +78,7 @@
AvailablePortFinder.getNextAvailable(6666)
);
((DefaultInetServicesDatabase) fe.getInetServicesDatabase()).addEntry(srvEntry);
- config = new TCPListenerConfig(InetAddress.getLocalHost(), srvEntry);
+ config = new TcpBindPoint(InetAddress.getLocalHost(), srvEntry);
fe.getListenerManager().bind(config);
fe.register(proto);
}
Modified: incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/listener/TCPListenerManagerTest.java
==============================================================================
--- incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/listener/TCPListenerManagerTest.java (original)
+++ incubator/directory/seda/branches/trustin_api_redesign/src/test/org/apache/seda/listener/TCPListenerManagerTest.java Mon Oct 11 07:52:28 2004
@@ -21,8 +21,8 @@
import org.apache.seda.EventRouter;
import org.apache.seda.impl.DefaultEventRouter;
import org.apache.seda.protocol.InetServiceEntry;
-import org.apache.seda.stage.input.ListenerConfig;
-import org.apache.seda.stage.input.TCPListenerConfig;
+import org.apache.seda.stage.input.BindPoint;
+import org.apache.seda.stage.input.TcpBindPoint;
import org.apache.seda.stage.listener.AvailablePortFinder;
import org.apache.seda.stage.listener.TCPListenerManager;
@@ -74,8 +74,8 @@
public void testBind() throws Exception {
int port = AvailablePortFinder.getNextAvailable();
- ListenerConfig config =
- new TCPListenerConfig(InetAddress.getLocalHost(),
+ BindPoint config =
+ new TcpBindPoint(InetAddress.getLocalHost(),
new InetServiceEntry("ldap", port)
);
listener.bind(config);
@@ -84,8 +84,8 @@
public void testUnbind() throws Exception {
int port = AvailablePortFinder.getNextAvailable();
- ListenerConfig config =
- new TCPListenerConfig(InetAddress.getLocalHost(),
+ BindPoint config =
+ new TcpBindPoint(InetAddress.getLocalHost(),
new InetServiceEntry("ldap", port)
);
listener.bind(config);