directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r372471 - in /directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina: common/ common/support/ transport/socket/nio/ transport/socket/nio/support/ transport/vmpipe/ transport/vmpipe/support/
Date Thu, 26 Jan 2006 07:21:57 GMT
Author: trustin
Date: Wed Jan 25 23:21:47 2006
New Revision: 372471

URL: http://svn.apache.org/viewcvs?rev=372471&view=rev
Log:
Added clone() method to
* DefaultIoFilterChainBuilder
* IoServiceConfig and its implementations
* IoSessionConfig and its implementations

Added:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoSessionConfig.java
  (with props)
Modified:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.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/SocketSessionConfigImpl.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/VmPipeSessionImpl.java

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java
Wed Jan 25 23:21:47 2006
@@ -53,7 +53,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev: 350135 $, $Date: 2005-12-01 12:43:29 +0900 $
  */
-public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder
+public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder, Cloneable
 {
     private List entries = new ArrayList();
     private final Map entriesByName = new HashMap();
@@ -276,6 +276,17 @@
         buf.append( " }" );
         
         return buf.toString();
+    }
+    
+    public Object clone()
+    {
+        DefaultIoFilterChainBuilder ret = new DefaultIoFilterChainBuilder();
+        for( Iterator i = entries.iterator(); i.hasNext(); )
+        {
+            Entry e = ( Entry ) i.next();
+            ret.addLast( e.getName(), e.getFilter() );
+        }
+        return ret;
     }
 
     private void checkBaseName( String baseName )

Modified: 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=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoServiceConfig.java
Wed Jan 25 23:21:47 2006
@@ -59,4 +59,9 @@
      *                               not a {@link DefaultIoFilterChainBuilder}
      */
     DefaultIoFilterChainBuilder getFilterChain();
+    
+    /**
+     * Returns a deep clone of this configuration.
+     */
+    Object clone();
 }

Modified: 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=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoSessionConfig.java
Wed Jan 25 23:21:47 2006
@@ -26,4 +26,8 @@
  */
 public interface IoSessionConfig
 {
+    /**
+     * Returns a deep clone of this configuration.
+     */
+    Object clone();
 }

Modified: 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=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoServiceConfig.java
Wed Jan 25 23:21:47 2006
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.common.support;
 
+import java.lang.reflect.Method;
+
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoFilterChainBuilder;
 import org.apache.mina.common.IoServiceConfig;
@@ -69,13 +71,30 @@
     
     public Object clone()
     {
+        BaseIoServiceConfig ret;
         try
         {
-            return super.clone();
+            ret = ( BaseIoServiceConfig ) super.clone();
         }
         catch( CloneNotSupportedException e )
         {
             throw ( InternalError ) new InternalError().initCause( e );
         }
+        
+        
+        // Try to clone the chain builder.
+        try
+        {
+            Method cloneMethod = this.filterChainBuilder.getClass().getMethod( "clone", null
);
+            if( cloneMethod.isAccessible() )
+            {
+                ret.filterChainBuilder = ( IoFilterChainBuilder ) cloneMethod.invoke( this.filterChainBuilder,
null );
+            }
+        }
+        catch( Exception e )
+        {
+        }
+        
+        return ret;
     }
 }

Added: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoSessionConfig.java?rev=372471&view=auto
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoSessionConfig.java
(added)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoSessionConfig.java
Wed Jan 25 23:21:47 2006
@@ -0,0 +1,49 @@
+/*
+ *   @(#) $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.IoSessionConfig;
+
+/**
+ * A base implementation of {@link IoSessionConfig}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseIoSessionConfig implements IoSessionConfig, Cloneable
+{
+    protected BaseIoSessionConfig()
+    {
+    }
+
+    public Object clone()
+    {
+        BaseIoSessionConfig ret;
+        try
+        {
+            ret = ( BaseIoSessionConfig ) super.clone();
+        }
+        catch( CloneNotSupportedException e )
+        {
+            throw ( InternalError ) new InternalError().initCause( e );
+        }
+        
+        return ret;
+    }
+}

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

Modified: 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=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/DatagramAcceptorConfig.java
Wed Jan 25 23:21:47 2006
@@ -33,7 +33,7 @@
  */
 public class DatagramAcceptorConfig extends BaseIoAcceptorConfig implements IoAcceptorConfig
 {
-    private final DatagramSessionConfig sessionConfig = new DatagramSessionConfigImpl();
+    private DatagramSessionConfig sessionConfig = new DatagramSessionConfigImpl();
 
     /**
      * Creates a new instance.
@@ -48,5 +48,12 @@
     public IoSessionConfig getSessionConfig()
     {
         return sessionConfig;
+    }
+    
+    public Object clone()
+    {
+        DatagramAcceptorConfig ret = ( DatagramAcceptorConfig ) super.clone();
+        ret.sessionConfig = ( DatagramSessionConfig ) this.sessionConfig.clone();
+        return ret;
     }
 }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionConfigImpl.java
Wed Jan 25 23:21:47 2006
@@ -7,9 +7,10 @@
 import java.net.SocketException;
 
 import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
 
-public class DatagramSessionConfigImpl implements DatagramSessionConfig
+public class DatagramSessionConfigImpl extends BaseIoSessionConfig implements DatagramSessionConfig
 {
     private boolean broadcast;
     private boolean reuseAddress;

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Wed Jan 25 23:21:47 2006
@@ -33,6 +33,7 @@
 import org.apache.mina.common.TransportType;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoSession;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
 import org.apache.mina.util.Queue;
 
@@ -179,7 +180,7 @@
         return readBufferSize;
     }
     
-    private class DatagramSessionConfigImpl implements DatagramSessionConfig
+    private class DatagramSessionConfigImpl extends BaseIoSessionConfig implements DatagramSessionConfig
     {
         public int getReceiveBufferSize()
         {

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionConfigImpl.java
Wed Jan 25 23:21:47 2006
@@ -25,6 +25,7 @@
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.RuntimeIOException;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.socket.nio.SocketConnector;
 import org.apache.mina.transport.socket.nio.SocketSessionConfig;
 
@@ -34,7 +35,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class SocketSessionConfigImpl implements SocketSessionConfig
+public class SocketSessionConfigImpl extends BaseIoSessionConfig implements SocketSessionConfig
 {
     private boolean reuseAddress;
     private int receiveBufferSize;

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
Wed Jan 25 23:21:47 2006
@@ -34,6 +34,7 @@
 import org.apache.mina.common.TransportType;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoSession;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.socket.nio.SocketSessionConfig;
 import org.apache.mina.util.Queue;
 
@@ -185,7 +186,7 @@
         return readBufferSize;
     }
 
-    private class SocketSessionConfigImpl implements SocketSessionConfig
+    private class SocketSessionConfigImpl extends BaseIoSessionConfig implements SocketSessionConfig
     {
         public boolean isKeepAlive()
         {

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Wed Jan 25 23:21:47 2006
@@ -19,6 +19,7 @@
 import org.apache.mina.common.IoSessionConfig;
 import org.apache.mina.common.support.BaseIoAcceptor;
 import org.apache.mina.common.support.BaseIoAcceptorConfig;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.vmpipe.support.VmPipe;
 import org.apache.mina.util.IdentityHashSet;
 
@@ -33,7 +34,7 @@
 {
     static final Map boundHandlers = new HashMap();
     
-    private static final IoSessionConfig CONFIG = new IoSessionConfig() {};
+    private static final IoSessionConfig CONFIG = new BaseIoSessionConfig() {};
     private final IoServiceConfig defaultConfig = new BaseIoAcceptorConfig()
     {
         public IoSessionConfig getSessionConfig()

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
Wed Jan 25 23:21:47 2006
@@ -12,6 +12,7 @@
 import org.apache.mina.common.IoSessionConfig;
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.common.support.BaseIoConnectorConfig;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.transport.vmpipe.support.VmPipe;
 import org.apache.mina.transport.vmpipe.support.VmPipeSessionImpl;
 import org.apache.mina.util.AnonymousSocketAddress;
@@ -25,7 +26,7 @@
  */
 public class VmPipeConnector extends BaseIoConnector
 {
-    private static final IoSessionConfig CONFIG = new IoSessionConfig() {};
+    private static final IoSessionConfig CONFIG = new BaseIoSessionConfig() {};
     private final IoServiceConfig defaultConfig = new BaseIoConnectorConfig()
     {
         public IoSessionConfig getSessionConfig()

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java?rev=372471&r1=372470&r2=372471&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
Wed Jan 25 23:21:47 2006
@@ -18,6 +18,7 @@
 import org.apache.mina.common.TransportType;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoSession;
+import org.apache.mina.common.support.BaseIoSessionConfig;
 import org.apache.mina.filter.codec.ProtocolDecoder;
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.util.Queue;
@@ -30,7 +31,7 @@
  */
 public class VmPipeSessionImpl extends BaseIoSession
 {
-    private static final IoSessionConfig CONFIG = new IoSessionConfig() {};
+    private static final IoSessionConfig CONFIG = new BaseIoSessionConfig() {};
     
     private final IoService manager;
     private final SocketAddress localAddress;



Mime
View raw message