directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r372449 [1/2] - in /directory/sandbox/trustin/dirmina-158/core/src: main/java/org/apache/mina/common/ main/java/org/apache/mina/common/support/ main/java/org/apache/mina/registry/ main/java/org/apache/mina/transport/socket/nio/ main/java/or...
Date Thu, 26 Jan 2006 05:26:05 GMT
Author: trustin
Date: Wed Jan 25 21:24:58 2006
New Revision: 372449

URL: http://svn.apache.org/viewcvs?rev=372449&view=rev
Log:
* Added IoSessionConfig and its implementations
* Added IoServiceConfig and its implementations
* Added IoAcceptorConfig and its implementations
* Added IoConnectorConfig and its implementations
* Replaced all transport-type specific properties with the Config classes above

Added:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java   (with props)
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java   (with props)
Removed:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/registry/
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramService.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSession.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSession.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java
Modified:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoService.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSession.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoService.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramService.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketIoProcessor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/util/IdentityHashSet.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/util/SessionUtil.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/common/FutureTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/filter/ThreadPoolFilterRegressionTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineDecoderTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/filter/codec/textline/TextLineEncoderTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/handler/chain/ChainedIoHandlerTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/transport/AbstractBindTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramTrafficControlTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/transport/socket/nio/SocketTrafficControlTest.java
    directory/sandbox/trustin/dirmina-158/core/src/test/java/org/apache/mina/transport/vmpipe/VmPipeTrafficControlTest.java

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java Wed Jan 25 21:24:58 2006
@@ -20,7 +20,6 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.util.Collection;
 
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
@@ -55,12 +54,10 @@
      * Binds to the specified <code>address</code> and handles incoming
      * connections with the specified <code>handler</code>.
      *
-     * @param filterChainBuilder
-     *            an {@link IoFilterChainBuilder} that will modify the
-     *            {@link IoFilterChain} of a newly created {@link IoSession}
+     * @param config the configuration
      * @throws IOException if failed to bind
      */
-    void bind( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder ) throws IOException;
+    void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config ) throws IOException;
 
     /**
      * Unbinds from the specified <code>address</code> and disconnects all clients
@@ -69,20 +66,6 @@
     void unbind( SocketAddress address );
     
     /**
-     * Returns all sessions currently connected to the specified local address.
-     * 
-     * @param address the local address to return all sessions for. Must have
-     *        been bound previously.
-     * @return the sessions.
-     * @throws IllegalArgumentException if the specified <tt>address</tt> has 
-     *         not been bound.
-     * @throws UnsupportedOperationException if this operation isn't supported
-     *         for the particular transport type implemented by this 
-     *         {@link IoAcceptor}.
-     */
-    Collection getManagedSessions( SocketAddress address );
-    
-    /**
      * (Optional) Returns an {@link IoSession} that is bound to the specified
      * <tt>localAddress</tt> and <tt>remoteAddress</tt> which reuses
      * the <tt>localAddress</tt> that is already bound by {@link IoAcceptor}
@@ -97,16 +80,4 @@
      *                                  not bound yet. (see {@link #bind(SocketAddress, IoHandler)})
      */
     IoSession newSession( SocketAddress remoteAddress, SocketAddress localAddress );
-    
-    /**
-     * Returns <tt>true</tt> if and only if all clients are disconnected
-     * when this acceptor unbinds the related local address.
-     */
-    boolean isDisconnectClientsOnUnbind();
-    
-    /**
-     * Sets whether all clients are disconnected when this acceptor unbinds the
-     * related local address.  The default value is <tt>true</tt>.
-     */
-    void setDisconnectClientsOnUnbind( boolean disconnectClientsOnUnbind );
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,40 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common;
+
+/**
+ * A configuration which is used to configure {@link IoAcceptor}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface IoAcceptorConfig extends IoServiceConfig
+{
+    /**
+     * Returns <tt>true</tt> if and only if all clients are disconnected
+     * when this acceptor unbinds the related local address.
+     */
+    boolean isDisconnectOnUnbind();
+    
+    /**
+     * Sets whether all clients are disconnected when this acceptor unbinds the
+     * related local address.  The default value is <tt>true</tt>.
+     */
+    void setDisconnectOnUnbind( boolean disconnectOnUnbind );
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java Wed Jan 25 21:24:58 2006
@@ -55,13 +55,11 @@
      * successfully, events are fired to the specified
      * <code>handler</code>.
      * 
-     * @param filterChainBuilder
-     *            an {@link IoFilterChainBuilder} that will modify the
-     *            {@link IoFilterChain} of a newly created {@link IoSession}
+     * @param config the configuration
      * @return {@link ConnectFuture} that will tell the result of the connection attempt
      */
     ConnectFuture connect( SocketAddress address, IoHandler handler,
-                           IoFilterChainBuilder filterChainBuilder );
+                           IoConnectorConfig config );
 
     /**
      * Connects to the specified <code>address</code>.  If communication starts
@@ -79,26 +77,9 @@
      * successfully, events are fired to the specified
      * <code>handler</code>.
      * 
-     * @param filterChainBuilder
-     *            an {@link IoFilterChainBuilder} that will modify the
-     *            {@link IoFilterChain} of a newly created {@link IoSession}
+     * @param config the configuration
      * @return {@link ConnectFuture} that will tell the result of the connection attempt
      */
     ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                           IoHandler handler, IoFilterChainBuilder filterChainBuilder );
-    
-    /**
-     * Returns the connect timeout in seconds.
-     */
-    int getConnectTimeout();
-
-    /**
-     * Returns the connect timeout in milliseconds.
-     */
-    long getConnectTimeoutMillis();
-
-    /**
-     * Sets the connect timeout in seconds.
-     */
-    void setConnectTimeout( int connectTimeout );
+                           IoHandler handler, IoConnectorConfig config );
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,43 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common;
+
+/**
+ * A configuration which is used to configure {@link IoConnector}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface IoConnectorConfig extends IoServiceConfig
+{
+    /**
+     * Returns the connect timeout in seconds.
+     */
+    int getConnectTimeout();
+
+    /**
+     * Returns the connect timeout in milliseconds.
+     */
+    long getConnectTimeoutMillis();
+
+    /**
+     * Sets the connect timeout in seconds.
+     */
+    void setConnectTimeout( int connectTimeout );
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnectorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoService.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoService.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoService.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoService.java Wed Jan 25 21:24:58 2006
@@ -18,6 +18,9 @@
  */
 package org.apache.mina.common;
 
+import java.net.SocketAddress;
+import java.util.Set;
+
 
 /**
  * Base interface for all {@link IoAcceptor}s and {@link IoConnector}s
@@ -26,34 +29,26 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public interface IoService {
-    
-    /**
-     * Returns the {@link IoFilterChainBuilder} which will modify the
-     * {@link IoFilterChain} of all {@link IoSession}s which is managed
-     * by this manager.
-     * The default value is an empty {@link DefaultIoFilterChainBuilder}.
-     */
-    IoFilterChainBuilder getFilterChainBuilder();
-    
+public interface IoService
+{
     /**
-     * Sets the {@link IoFilterChainBuilder} which will modify the
-     * {@link IoFilterChain} of all {@link IoSession}s which is managed
-     * by this manager.
-     * If you specify <tt>null</tt> this property will be set to
-     * an empty {@link DefaultIoFilterChainBuilder}.
+     * Returns all sessions with the specified remote or local address,
+     * which are currently managed by this service.
+     * {@link IoAcceptor} will assume the specified <tt>address</tt> is a local
+     * address, and {@link IoConnector} will assume it's a remote address.
+     * 
+     * @param address the address to return all sessions for.
+     * @return the sessions. An empty collection if there's no session.
+     * @throws IllegalArgumentException if the specified <tt>address</tt> has 
+     *         not been bound.
+     * @throws UnsupportedOperationException if this operation isn't supported
+     *         for the particular transport type implemented by this {@link IoService}.
      */
-    void setFilterChainBuilder( IoFilterChainBuilder builder );
-    
+    Set getManagedSessions( SocketAddress address );
+
     /**
-     * A shortcut for <tt>( ( DefaultIoFilterChainBuilder ) </tt>{@link #getFilterChainBuilder()}<tt> )</tt>.
-     * Please note that the returned object is not a <b>real</b> {@link IoFilterChain}
-     * but a {@link DefaultIoFilterChainBuilder}.  Modifying the returned builder
-     * won't affect the existing {@link IoSession}s at all, because
-     * {@link IoFilterChainBuilder}s affect only newly created {@link IoSession}s.
-     *
-     * @throws IllegalStateException if the current {@link IoFilterChainBuilder} is
-     *                               not a {@link DefaultIoFilterChainBuilder}
+     * Returns the default configuration which is used when you didn't specify
+     * any configuration.
      */
-    DefaultIoFilterChainBuilder getFilterChain();
+    IoServiceConfig getDefaultConfig();
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,62 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common;
+
+/**
+ * A configuration which is used to configure {@link IoService}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface IoServiceConfig
+{
+    /**
+     * Resturns the default configuration of the new {@link IoSession}s.
+     */
+    IoSessionConfig getSessionConfig();
+    
+    /**
+     * Returns the {@link IoFilterChainBuilder} which will modify the
+     * {@link IoFilterChain} of all {@link IoSession}s which is managed
+     * by this manager.
+     * The default value is an empty {@link DefaultIoFilterChainBuilder}.
+     */
+    IoFilterChainBuilder getFilterChainBuilder();
+    
+    /**
+     * Sets the {@link IoFilterChainBuilder} which will modify the
+     * {@link IoFilterChain} of all {@link IoSession}s which is managed
+     * by this manager.
+     * If you specify <tt>null</tt> this property will be set to
+     * an empty {@link DefaultIoFilterChainBuilder}.
+     */
+    void setFilterChainBuilder( IoFilterChainBuilder builder );
+    
+    /**
+     * A shortcut for <tt>( ( DefaultIoFilterChainBuilder ) </tt>{@link #getFilterChainBuilder()}<tt> )</tt>.
+     * Please note that the returned object is not a <b>real</b> {@link IoFilterChain}
+     * but a {@link DefaultIoFilterChainBuilder}.  Modifying the returned builder
+     * won't affect the existing {@link IoSession}s at all, because
+     * {@link IoFilterChainBuilder}s affect only newly created {@link IoSession}s.
+     *
+     * @throws IllegalStateException if the current {@link IoFilterChainBuilder} is
+     *                               not a {@link DefaultIoFilterChainBuilder}
+     */
+    DefaultIoFilterChainBuilder getFilterChain();
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSession.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSession.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSession.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSession.java Wed Jan 25 21:24:58 2006
@@ -60,6 +60,11 @@
     IoHandler getHandler();
 
     /**
+     * Returns the configuration of this session.
+     */
+    IoSessionConfig getConfig();
+    
+    /**
      * Returns the filter chain that only affects this session.
      */
     IoFilterChain getFilterChain();

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,29 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common;
+
+/**
+ * The configuration of {@link IoSession}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface IoSessionConfig
+{
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,50 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common;
+
+/**
+ * A unchecked version of {@link java.io.IOException}.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class RuntimeIOException extends RuntimeException
+{
+    private static final long serialVersionUID = 9029092241311939548L;
+
+    public RuntimeIOException()
+    {
+        super();
+    }
+
+    public RuntimeIOException( String message )
+    {
+        super( message );
+    }
+
+    public RuntimeIOException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public RuntimeIOException( Throwable cause )
+    {
+        super( cause );
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/RuntimeIOException.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java Wed Jan 25 21:24:58 2006
@@ -20,10 +20,9 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.util.Collection;
 
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 
@@ -35,30 +34,13 @@
  */
 public abstract class BaseIoAcceptor extends BaseIoService implements IoAcceptor
 {
-    private boolean disconnectClientsOnUnbind = true;
-    
     protected BaseIoAcceptor()
     {
     }
     
     public void bind( SocketAddress address, IoHandler handler ) throws IOException
     {
-        this.bind( address, handler, IoFilterChainBuilder.NOOP );
-    }
-
-    public Collection getManagedSessions( SocketAddress address )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean isDisconnectClientsOnUnbind()
-    {
-        return disconnectClientsOnUnbind;
-    }
-
-    public void setDisconnectClientsOnUnbind( boolean disconnectClientsOnUnbind )
-    {
-        this.disconnectClientsOnUnbind = disconnectClientsOnUnbind;
+        this.bind( address, handler, ( IoAcceptorConfig ) getDefaultConfig() );
     }
     
     public IoSession newSession( SocketAddress remoteAddress, SocketAddress localAddress )

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,48 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common.support;
+
+import org.apache.mina.common.IoAcceptorConfig;
+
+/**
+ * A base implementation of {@link IoAcceptorConfig}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseIoAcceptorConfig extends BaseIoServiceConfig implements IoAcceptorConfig
+{
+    private boolean disconnectOnUnbind = true;
+    
+    protected BaseIoAcceptorConfig()
+    {
+        super();
+    }
+
+
+    public boolean isDisconnectOnUnbind()
+    {
+        return disconnectOnUnbind;
+    }
+
+    public void setDisconnectOnUnbind( boolean disconnectClientsOnUnbind )
+    {
+        this.disconnectOnUnbind = disconnectClientsOnUnbind;
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java Wed Jan 25 21:24:58 2006
@@ -22,7 +22,7 @@
 
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
 
 /**
@@ -33,38 +33,17 @@
  */
 public abstract class BaseIoConnector extends BaseIoService implements IoConnector
 {
-    private int defaultConnectTimeout = 60; // 1 minute
-
     protected BaseIoConnector()
     {
     }
     
     public ConnectFuture connect( SocketAddress address, IoHandler handler )
     {
-        return connect( address, handler, IoFilterChainBuilder.NOOP );
+        return connect( address, handler, ( IoConnectorConfig ) getDefaultConfig() );
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress, IoHandler handler )
     {
-        return connect( address, localAddress, handler, IoFilterChainBuilder.NOOP );
+        return connect( address, localAddress, handler, ( IoConnectorConfig ) getDefaultConfig() );
     }
-
-    public int getConnectTimeout()
-    {
-        return defaultConnectTimeout;
-    }
-
-    public long getConnectTimeoutMillis()
-    {
-        return defaultConnectTimeout * 1000L;
-    }
-
-    public void setConnectTimeout( int defaultConnectTimeout )
-    {
-        if( defaultConnectTimeout <= 0 )
-        {
-            throw new IllegalArgumentException( "defaultConnectTimeout: " + defaultConnectTimeout );
-        }
-        this.defaultConnectTimeout = defaultConnectTimeout;
-    }    
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,56 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common.support;
+
+import org.apache.mina.common.IoConnectorConfig;
+
+/**
+ * A base implementation of {@link IoConnectorConfig}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseIoConnectorConfig extends BaseIoServiceConfig implements IoConnectorConfig
+{
+    private int connectTimeout = 60; // 1 minute
+
+    protected BaseIoConnectorConfig()
+    {
+        super();
+    }
+
+    public int getConnectTimeout()
+    {
+        return connectTimeout;
+    }
+
+    public long getConnectTimeoutMillis()
+    {
+        return connectTimeout * 1000L;
+    }
+
+    public void setConnectTimeout( int connectTimeout )
+    {
+        if( connectTimeout <= 0 )
+        {
+            throw new IllegalArgumentException( "connectTimeout: " + connectTimeout );
+        }
+        this.connectTimeout = connectTimeout;
+    }    
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnectorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoService.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoService.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoService.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoService.java Wed Jan 25 21:24:58 2006
@@ -18,8 +18,9 @@
  */
 package org.apache.mina.common.support;
 
-import org.apache.mina.common.DefaultIoFilterChainBuilder;
-import org.apache.mina.common.IoFilterChainBuilder;
+import java.net.SocketAddress;
+import java.util.Set;
+
 import org.apache.mina.common.IoService;
 
 /**
@@ -30,39 +31,12 @@
  */
 public abstract class BaseIoService implements IoService {
 
-    /**
-     * Current filter chain builder.
-     */
-    protected IoFilterChainBuilder filterChainBuilder = new DefaultIoFilterChainBuilder();
-
     protected BaseIoService()
     {
     }
     
-    public IoFilterChainBuilder getFilterChainBuilder()
-    {
-        return filterChainBuilder;
-    }
-
-    public void setFilterChainBuilder( IoFilterChainBuilder builder )
-    {
-        if( builder == null )
-        {
-            builder = new DefaultIoFilterChainBuilder();
-        }
-        filterChainBuilder = builder;
-    }
-    
-    public DefaultIoFilterChainBuilder getFilterChain()
+    public Set getManagedSessions( SocketAddress address )
     {
-        if( filterChainBuilder instanceof DefaultIoFilterChainBuilder )
-        {
-            return ( DefaultIoFilterChainBuilder ) filterChainBuilder;
-        }
-        else
-        {
-            throw new IllegalStateException(
-                    "Current filter chain builder is not a DefaultIoFilterChainBuilder." );
-        }
+        throw new UnsupportedOperationException();
     }
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,81 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.common.support;
+
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
+import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoServiceConfig;
+
+/**
+ * A base implementation of {@link IoServiceConfig}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseIoServiceConfig implements IoServiceConfig, Cloneable
+{
+    /**
+     * Current filter chain builder.
+     */
+    private IoFilterChainBuilder filterChainBuilder = new DefaultIoFilterChainBuilder();
+
+    public BaseIoServiceConfig()
+    {
+        super();
+    }
+
+    public IoFilterChainBuilder getFilterChainBuilder()
+    {
+        return filterChainBuilder;
+    }
+
+    public void setFilterChainBuilder( IoFilterChainBuilder builder )
+    {
+        if( builder == null )
+        {
+            builder = new DefaultIoFilterChainBuilder();
+        }
+        filterChainBuilder = builder;
+    }
+    
+    public DefaultIoFilterChainBuilder getFilterChain()
+    {
+        if( filterChainBuilder instanceof DefaultIoFilterChainBuilder )
+        {
+            return ( DefaultIoFilterChainBuilder ) filterChainBuilder;
+        }
+        else
+        {
+            throw new IllegalStateException(
+                    "Current filter chain builder is not a DefaultIoFilterChainBuilder." );
+        }
+    }
+    
+    public Object clone()
+    {
+        try
+        {
+            return super.clone();
+        }
+        catch( CloneNotSupportedException e )
+        {
+            throw ( InternalError ) new InternalError().initCause( e );
+        }
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java Wed Jan 25 21:24:58 2006
@@ -20,12 +20,12 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.util.Collection;
+import java.util.Set;
 
-import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
 
 /**
@@ -59,9 +59,9 @@
         delegate.bind( address, handler );
     }
 
-    public void bind( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder ) throws IOException
+    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config ) throws IOException
     {
-        delegate.bind( address, handler, filterChainBuilder );
+        delegate.bind( address, handler, config );
     }
 
     public void unbind( SocketAddress address )
@@ -69,7 +69,7 @@
         delegate.unbind( address );
     }
 
-    public Collection getManagedSessions( SocketAddress address )
+    public Set getManagedSessions( SocketAddress address )
     {
         return delegate.getManagedSessions( address );
     }
@@ -79,28 +79,8 @@
         return delegate.newSession( remoteAddress, localAddress );
     }
 
-    public IoFilterChainBuilder getFilterChainBuilder()
+    public IoServiceConfig getDefaultConfig()
     {
-        return delegate.getFilterChainBuilder();
-    }
-
-    public void setFilterChainBuilder( IoFilterChainBuilder builder )
-    {
-        delegate.setFilterChainBuilder( builder );
-    }
-    
-    public DefaultIoFilterChainBuilder getFilterChain()
-    {
-        return delegate.getFilterChain();
-    }
-
-    public boolean isDisconnectClientsOnUnbind()
-    {
-        return delegate.isDisconnectClientsOnUnbind();
-    }
-
-    public void setDisconnectClientsOnUnbind( boolean disconnectClientsOnUnbind )
-    {
-        delegate.setDisconnectClientsOnUnbind( disconnectClientsOnUnbind );
+        return delegate.getDefaultConfig();
     }
 }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java Wed Jan 25 21:24:58 2006
@@ -19,12 +19,13 @@
 package org.apache.mina.common.support;
 
 import java.net.SocketAddress;
+import java.util.Set;
 
 import org.apache.mina.common.ConnectFuture;
-import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
 
 /**
  * A delegated {@link IoConnector} that wraps the other {@link IoConnector}.
@@ -57,9 +58,9 @@
         return delegate.connect( address, handler );
     }
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder )
+    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoConnectorConfig config )
     {
-        return delegate.connect( address, handler, filterChainBuilder );
+        return delegate.connect( address, handler, config );
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
@@ -69,38 +70,18 @@
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                                  IoHandler handler, IoFilterChainBuilder filterChainBuilder )
+                                  IoHandler handler, IoConnectorConfig config )
     {
-        return delegate.connect( address, localAddress, handler, filterChainBuilder );
+        return delegate.connect( address, localAddress, handler, config );
     }
 
-    public int getConnectTimeout()
+    public Set getManagedSessions( SocketAddress address )
     {
-        return delegate.getConnectTimeout();
+        return delegate.getManagedSessions( address );
     }
-
-    public long getConnectTimeoutMillis()
-    {
-        return delegate.getConnectTimeoutMillis();
-    }
-
-    public void setConnectTimeout( int connectTimeout )
-    {
-        delegate.setConnectTimeout( connectTimeout );
-    }
-
-    public IoFilterChainBuilder getFilterChainBuilder()
-    {
-        return delegate.getFilterChainBuilder();
-    }
-
-    public void setFilterChainBuilder( IoFilterChainBuilder builder )
-    {
-        delegate.setFilterChainBuilder( builder );
-    }
-
-    public DefaultIoFilterChainBuilder getFilterChain()
+    
+    public IoServiceConfig getDefaultConfig()
     {
-        return delegate.getFilterChain();
+        return delegate.getDefaultConfig();
     }
 }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java Wed Jan 25 21:24:58 2006
@@ -28,7 +28,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class DatagramAcceptor extends DelegatedIoAcceptor implements DatagramService
+public class DatagramAcceptor extends DelegatedIoAcceptor
 {
     /**
      * Creates a new instance.
@@ -36,55 +36,5 @@
     public DatagramAcceptor()
     {
         init( new DatagramAcceptorDelegate( this ) );
-    }
-
-    public int getReceiveBufferSize()
-    {
-        return ( ( DatagramAcceptorDelegate ) delegate ).getReceiveBufferSize();
-    }
-
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        ( ( DatagramAcceptorDelegate ) delegate ).setReceiveBufferSize( receiveBufferSize );
-    }
-
-    public boolean getBroadcast()
-    {
-        return ( ( DatagramAcceptorDelegate ) delegate ).getBroadcast();
-    }
-
-    public void setBroadcast( boolean broadcast )
-    {
-        ( ( DatagramAcceptorDelegate ) delegate ).setBroadcast( broadcast );
-    }
-
-    public int getSendBufferSize()
-    {
-        return ( ( DatagramAcceptorDelegate ) delegate ).getSendBufferSize();
-    }
-
-    public void setSendBufferSize( int sendBufferSize )
-    {
-        ( ( DatagramAcceptorDelegate ) delegate ).setSendBufferSize( sendBufferSize );
-    }
-
-    public int getTrafficClass()
-    {
-        return ( ( DatagramAcceptorDelegate ) delegate ).getTrafficClass();
-    }
-
-    public void setTrafficClass( int trafficClass )
-    {
-        ( ( DatagramAcceptorDelegate ) delegate ).setTrafficClass( trafficClass );
-    }
-
-    public boolean getReuseAddress()
-    {
-        return ( ( DatagramAcceptorDelegate ) delegate ).getReuseAddress();
-    }
-
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        ( ( DatagramAcceptorDelegate ) delegate ).setReuseAddress( reuseAddress );
     }
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,52 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+
+import org.apache.mina.common.IoAcceptorConfig;
+import org.apache.mina.common.IoSessionConfig;
+import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoAcceptorConfig;
+import org.apache.mina.transport.socket.nio.support.DatagramSessionConfigImpl;
+
+/**
+ * An {@link IoAcceptorConfig} for {@link DatagramAcceptor}.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class DatagramAcceptorConfig extends BaseIoAcceptorConfig implements IoAcceptorConfig
+{
+    private final DatagramSessionConfig sessionConfig = new DatagramSessionConfigImpl();
+
+    /**
+     * Creates a new instance.
+     * 
+     * @throws RuntimeIOException if failed to get the default configuration
+     */
+    public DatagramAcceptorConfig()
+    {
+        super();
+    }
+
+    public IoSessionConfig getSessionConfig()
+    {
+        return sessionConfig;
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnector.java Wed Jan 25 21:24:58 2006
@@ -28,7 +28,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class DatagramConnector extends DelegatedIoConnector implements DatagramService
+public class DatagramConnector extends DelegatedIoConnector
 {
     /**
      * Creates a new instance.
@@ -36,56 +36,5 @@
     public DatagramConnector()
     {
         init( new DatagramConnectorDelegate( this ) );
-    }
-
-    public int getReceiveBufferSize()
-    {
-        return ( ( DatagramConnectorDelegate ) delegate ).getReceiveBufferSize();
-    }
-
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        ( ( DatagramConnectorDelegate ) delegate ).setReceiveBufferSize( receiveBufferSize );
-    }
-
-    public boolean getBroadcast()
-    {
-        return ( ( DatagramConnectorDelegate ) delegate ).getBroadcast();
-    }
-
-    public void setBroadcast( boolean broadcast )
-    {
-        ( ( DatagramConnectorDelegate ) delegate ).setBroadcast( broadcast );
-    }
-
-    public int getSendBufferSize()
-    {
-        return ( ( DatagramConnectorDelegate ) delegate ).getSendBufferSize();
-    }
-
-    public void setSendBufferSize( int sendBufferSize )
-    {
-        ( ( DatagramConnectorDelegate ) delegate ).setSendBufferSize( sendBufferSize );
-    }
-
-    public int getTrafficClass()
-    {
-        return ( ( DatagramConnectorDelegate ) delegate ).getTrafficClass();
-    }
-
-    public void setTrafficClass( int trafficClass )
-    {
-        ( ( DatagramConnectorDelegate ) delegate ).setTrafficClass( trafficClass );
-    }
-
-
-    public boolean getReuseAddress()
-    {
-        return ( ( DatagramConnectorDelegate ) delegate ).getReuseAddress();
-    }
-
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        ( ( DatagramConnectorDelegate ) delegate ).setReuseAddress( reuseAddress );
     }
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,52 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+import org.apache.mina.common.IoConnectorConfig;
+import org.apache.mina.common.IoSessionConfig;
+import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoConnectorConfig;
+import org.apache.mina.transport.socket.nio.support.DatagramSessionConfigImpl;
+
+/**
+ * An {@link IoConnectorConfig} for {@link DatagramConnector}.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class DatagramConnectorConfig extends BaseIoConnectorConfig
+{
+    private final DatagramSessionConfig sessionConfig = new DatagramSessionConfigImpl();
+
+    /**
+     * Creates a new instance.
+     * 
+     * @throws RuntimeIOException if failed to get the default configuration
+     */
+    public DatagramConnectorConfig()
+    {
+        super();
+    }
+
+
+    public IoSessionConfig getSessionConfig()
+    {
+        return sessionConfig;
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramConnectorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,82 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+import java.net.DatagramSocket;
+
+import org.apache.mina.common.IoSessionConfig;
+
+/**
+ * An {@link IoSessionConfig} for datagram transport type.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface DatagramSessionConfig extends IoSessionConfig
+{
+    /**
+     * @see DatagramSocket#getBroadcast()
+     */
+    boolean isBroadcast();
+    
+    /**
+     * @see DatagramSocket#setBroadcast(boolean)
+     */
+    void setBroadcast( boolean broadcast );
+    
+    /**
+     * @see DatagramSocket#getReuseAddress()
+     */
+    boolean isReuseAddress();
+    
+    /**
+     * @see DatagramSocket#setReuseAddress(boolean)
+     */
+    void setReuseAddress( boolean reuseAddress );
+
+    /**
+     * @see DatagramSocket#getReceiveBufferSize()
+     */
+    int getReceiveBufferSize();
+
+    /**
+     * @see DatagramSocket#setReceiveBufferSize(int)
+     */
+    void setReceiveBufferSize( int receiveBufferSize );
+
+    /**
+     * @see DatagramSocket#getSendBufferSize()
+     */
+    int getSendBufferSize();
+
+    /**
+     * @see DatagramSocket#setSendBufferSize(int)
+     */
+    void setSendBufferSize( int sendBufferSize );
+
+    /**
+     * @see DatagramSocket#getTrafficClass()
+     */
+    int getTrafficClass();
+
+    /**
+     * @see DatagramSocket#setTrafficClass(int)
+     */
+    void setTrafficClass( int trafficClass );
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java Wed Jan 25 21:24:58 2006
@@ -37,37 +37,4 @@
     {
         init( new SocketAcceptorDelegate( this ) );
     }
-
-    public int getReceiveBufferSize()
-    {
-        return ( ( SocketAcceptorDelegate ) delegate ).getReceiveBufferSize();
-    }
-
-    /**
-     * @param receiveBufferSize <tt>-1</tt> to use the default value.
-     */
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        ( ( SocketAcceptorDelegate ) delegate ).setReceiveBufferSize( receiveBufferSize );
-    }
-
-    public boolean isReuseAddress()
-    {
-        return ( ( SocketAcceptorDelegate ) delegate ).isReuseAddress();
-    }
-
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        ( ( SocketAcceptorDelegate ) delegate ).setReuseAddress( reuseAddress );
-    }
-
-    public int getBacklog()
-    {
-        return ( ( SocketAcceptorDelegate ) delegate ).getBacklog();
-    }
-
-    public void setBacklog( int backlog )
-    {
-        ( ( SocketAcceptorDelegate ) delegate ).setBacklog( backlog );
-    }
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,106 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+import org.apache.mina.common.ExceptionMonitor;
+import org.apache.mina.common.IoAcceptorConfig;
+import org.apache.mina.common.IoSessionConfig;
+import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoAcceptorConfig;
+import org.apache.mina.transport.socket.nio.support.SocketSessionConfigImpl;
+
+/**
+ * An {@link IoAcceptorConfig} for {@link SocketAcceptor}.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class SocketAcceptorConfig extends BaseIoAcceptorConfig
+{
+    private IoSessionConfig sessionConfig = new SocketSessionConfigImpl();
+    private int backlog = 50;
+    private boolean reuseAddress;
+    
+    /**
+     * Creates a new instance.
+     * 
+     * @throws RuntimeIOException if failed to get the default configuration
+     */
+    public SocketAcceptorConfig()
+    {
+        ServerSocket s = null;
+        try
+        {
+            s = new ServerSocket();
+            reuseAddress = s.getReuseAddress();
+        }
+        catch( IOException e )
+        {
+            throw new RuntimeIOException( "Failed to get the default configuration.", e );
+        }
+        finally
+        {
+            if( s != null )
+            {
+                try
+                {
+                    s.close();
+                }
+                catch( IOException e )
+                {
+                    ExceptionMonitor.getInstance().exceptionCaught( e );
+                }
+            }
+        }
+    }
+
+    public IoSessionConfig getSessionConfig()
+    {
+        return sessionConfig;
+    }
+
+    /**
+     * @see ServerSocket#getReuseAddress()
+     */
+    public boolean isReuseAddress()
+    {
+        return reuseAddress;
+    }
+    
+    /**
+     * @see ServerSocket#setReuseAddress(boolean)
+     */
+    public void setReuseAddress( boolean reuseAddress )
+    {
+        this.reuseAddress = reuseAddress;
+    }
+    
+    public int getBacklog()
+    {
+        return backlog;
+    }
+    
+    public void setBacklog( int backlog )
+    {
+        this.backlog = backlog;
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,50 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+import org.apache.mina.common.IoConnectorConfig;
+import org.apache.mina.common.IoSessionConfig;
+import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoConnectorConfig;
+import org.apache.mina.transport.socket.nio.support.SocketSessionConfigImpl;
+
+/**
+ * An {@link IoConnectorConfig} for {@link SocketConnector}.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class SocketConnectorConfig extends BaseIoConnectorConfig
+{
+    private IoSessionConfig sessionConfig = new SocketSessionConfigImpl();
+
+    /**
+     * Creates a new instance.
+     * 
+     * @throws RuntimeIOException if failed to get the default configuration
+     */
+    public SocketConnectorConfig()
+    {
+    }
+
+    public IoSessionConfig getSessionConfig()
+    {
+        return sessionConfig;
+    }
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnectorConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java?rev=372449&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java (added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java Wed Jan 25 21:24:58 2006
@@ -0,0 +1,114 @@
+/*
+ *   @(#) $Id$
+ *
+ *   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.mina.transport.socket.nio;
+
+import java.net.Socket;
+
+import org.apache.mina.common.IoSessionConfig;
+
+/**
+ * An {@link IoSessionConfig} for socket transport type.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface SocketSessionConfig extends IoSessionConfig
+{
+    /**
+     * @see Socket#getReuseAddress()
+     */
+    boolean isReuseAddress();
+    
+    /**
+     * @see Socket#setReuseAddress(boolean)
+     */
+    void setReuseAddress( boolean reuseAddress );
+
+    /**
+     * @see Socket#getReceiveBufferSize()
+     */
+    int getReceiveBufferSize();
+
+    /**
+     * @see Socket#setReceiveBufferSize(int)
+     */
+    void setReceiveBufferSize( int receiveBufferSize );
+
+    /**
+     * @see Socket#getSendBufferSize()
+     */
+    int getSendBufferSize();
+
+    /**
+     * @see Socket#setSendBufferSize(int)
+     */
+    void setSendBufferSize( int sendBufferSize );
+
+    /**
+     * @see Socket#getTrafficClass()
+     */
+    int getTrafficClass();
+
+    /**
+     * @see Socket#setTrafficClass(int)
+     */
+    void setTrafficClass( int trafficClass );
+
+    /**
+     * @see Socket#getKeepAlive()
+     */
+    boolean isKeepAlive();
+
+    /**
+     * @see Socket#setKeepAlive(boolean)
+     */
+    void setKeepAlive( boolean keepAlive );
+
+    /**
+     * @see Socket#getOOBInline()
+     */
+    boolean isOobInline();
+
+    /**
+     * @see Socket#setOOBInline(boolean)
+     */
+    void setOobInline( boolean oobInline );
+
+    /**
+     * @see Socket#getSoLinger()
+     */
+    int getSoLinger();
+
+    /**
+     * @param soLinger Please specify a negative value to disable <tt>SO_LINGER</tt>.
+     * 
+     * @see Socket#setSoLinger(boolean, int)
+     */
+    void setSoLinger( int soLinger );
+
+    /**
+     * @see Socket#getTcpNoDelay()
+     */
+    boolean isTcpNoDelay();
+
+    /**
+     * @see Socket#setTcpNoDelay(boolean)
+     */
+    void setTcpNoDelay( boolean tcpNoDelay );
+}

Propchange: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?rev=372449&r1=372448&r2=372449&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java (original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java Wed Jan 25 21:24:58 2006
@@ -32,11 +32,14 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoFilterChainBuilder;
+import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoAcceptor;
+import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
+import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
 import org.apache.mina.util.Queue;
 
 /**
@@ -52,11 +55,7 @@
     private final IoAcceptor wrapper;
     private final int id = nextId ++ ;
     private Selector selector;
-    private boolean broadcast;
-    private boolean reuseAddress;
-    private int receiveBufferSize = -1;
-    private int sendBufferSize = -1;
-    private int trafficClass = -1;
+    private final DatagramAcceptorConfig defaultConfig = new DatagramAcceptorConfig();
     private final Map channels = new HashMap();
     private final Queue registerQueue = new Queue();
     private final Queue cancelQueue = new Queue();
@@ -71,13 +70,17 @@
         this.wrapper = wrapper;
     }
 
-    public void bind( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder )
+    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
             throws IOException
     {
         if( address == null )
             throw new NullPointerException( "address" );
         if( handler == null )
             throw new NullPointerException( "handler" );
+        if( config == null )
+        {
+            config = ( IoAcceptorConfig ) getDefaultConfig();
+        }
 
         if( !( address instanceof InetSocketAddress ) )
             throw new IllegalArgumentException( "Unexpected address type: "
@@ -85,12 +88,7 @@
         if( ( ( InetSocketAddress ) address ).getPort() == 0 )
             throw new IllegalArgumentException( "Unsupported port number: 0" );
         
-        if( filterChainBuilder == null )
-        {
-            filterChainBuilder = IoFilterChainBuilder.NOOP;
-        }
-
-        RegistrationRequest request = new RegistrationRequest( address, handler, filterChainBuilder );
+        RegistrationRequest request = new RegistrationRequest( address, handler, config );
         synchronized( this )
         {
             synchronized( registerQueue )
@@ -195,14 +193,15 @@
         }
 
         RegistrationRequest req = ( RegistrationRequest ) key.attachment();
-        DatagramSessionImpl s = new DatagramSessionImpl( wrapper, this, ch, req.handler );
+        DatagramSessionImpl s = new DatagramSessionImpl(
+                wrapper, this,
+                ( DatagramSessionConfig ) req.config, ch, req.handler );
         s.setRemoteAddress( remoteAddress );
         s.setSelectionKey( key );
         
         try
         {
-            this.filterChainBuilder.buildFilterChain( s.getFilterChain() );
-            req.filterChainBuilder.buildFilterChain( s.getFilterChain() );
+            req.config.getFilterChainBuilder().buildFilterChain( s.getFilterChain() );
             ( ( DatagramFilterChain ) s.getFilterChain() ).sessionCreated( s );
         }
         catch( Throwable t )
@@ -213,57 +212,11 @@
         return s;
     }
     
-    public boolean getBroadcast()
+    public IoServiceConfig getDefaultConfig()
     {
-        return broadcast;
+        return defaultConfig;
     }
     
-    public void setBroadcast( boolean broadcast )
-    {
-        this.broadcast = broadcast;
-    }
-    
-    public boolean getReuseAddress()
-    {
-        return reuseAddress;
-    }
-    
-    public void setReuseAddress( boolean reuseAddress )
-    {
-        this.reuseAddress = reuseAddress;
-    }
-
-
-    public int getReceiveBufferSize()
-    {
-        return receiveBufferSize;
-    }
-
-    public void setReceiveBufferSize( int receiveBufferSize )
-    {
-        this.receiveBufferSize = receiveBufferSize;
-    }
-
-    public int getSendBufferSize()
-    {
-        return sendBufferSize;
-    }
-
-    public void setSendBufferSize( int sendBufferSize )
-    {
-        this.sendBufferSize = sendBufferSize;
-    }
-
-    public int getTrafficClass()
-    {
-        return trafficClass;
-    }
-
-    public void setTrafficClass( int trafficClass )
-    {
-        this.trafficClass = trafficClass;
-    }
-
     private synchronized void startupWorker() throws IOException
     {
         if( worker == null )
@@ -374,8 +327,10 @@
             DatagramChannel ch = ( DatagramChannel ) key.channel();
 
             RegistrationRequest req = ( RegistrationRequest ) key.attachment();
-            DatagramSessionImpl session =
-                new DatagramSessionImpl( wrapper, this, ch, req.handler );
+            DatagramSessionImpl session = new DatagramSessionImpl(
+                    wrapper, this,
+                    ( DatagramSessionConfig ) req.config.getSessionConfig(),
+                    ch, req.handler );
             session.setSelectionKey( key );
             
             try
@@ -402,7 +357,7 @@
     private void readSession( DatagramSessionImpl session )
     {
 
-        ByteBuffer readBuf = ByteBuffer.allocate( 2048 );
+        ByteBuffer readBuf = ByteBuffer.allocate( session.getReadBufferSize() );
         try
         {
             SocketAddress remoteAddress = session.getChannel().receive(
@@ -549,20 +504,22 @@
             try
             {
                 ch = DatagramChannel.open();
-                ch.socket().setReuseAddress( reuseAddress );
-                ch.socket().setBroadcast( broadcast );
-                if( receiveBufferSize > 0 )
+                DatagramSessionConfig cfg;
+                if( req.config.getSessionConfig() instanceof DatagramSessionConfig )
                 {
-                    ch.socket().setReceiveBufferSize( receiveBufferSize );
+                    cfg = ( DatagramSessionConfig ) req.config.getSessionConfig();
                 }
-                if( sendBufferSize > 0 )
-                {
-                    ch.socket().setSendBufferSize( sendBufferSize );
-                }
-                if( trafficClass > 0 )
+                else
                 {
-                    ch.socket().setTrafficClass( trafficClass );
+                    cfg = ( DatagramSessionConfig ) getDefaultConfig().getSessionConfig();
                 }
+
+                ch.socket().setReuseAddress( cfg.isReuseAddress() );
+                ch.socket().setBroadcast( cfg.isBroadcast() );
+                ch.socket().setReceiveBufferSize( cfg.getReceiveBufferSize() );
+                ch.socket().setSendBufferSize( cfg.getSendBufferSize() );
+                ch.socket().setTrafficClass( cfg.getTrafficClass() );
+                
                 ch.configureBlocking( false );
                 ch.socket().bind( req.address );
                 ch.register( selector, SelectionKey.OP_READ, req );
@@ -658,16 +615,16 @@
     {
         private final SocketAddress address;
         private final IoHandler handler;
-        private final IoFilterChainBuilder filterChainBuilder;
+        private final IoAcceptorConfig config;
 
         private Throwable exception; 
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, IoHandler handler, IoFilterChainBuilder filterChainBuilder )
+        private RegistrationRequest( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
         {
             this.address = address;
             this.handler = handler;
-            this.filterChainBuilder = filterChainBuilder;
+            this.config = config;
         }
     }
 



Mime
View raw message