You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ad...@apache.org on 2011/07/31 19:32:01 UTC

svn commit: r1152600 [2/3] - in /mina/sandbox/adc/ahc: api/src/main/java/org/apache/ahc/ api/src/main/java/org/apache/ahc/api/ api/src/main/java/org/apache/ahc/api/listeners/ api/src/main/java/org/apache/ahc/api/mime/ api/src/test/java/com/acme/ahc/ ap...

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/AcceptMessage.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/AcceptMessage.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/AcceptMessage.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/AcceptMessage.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class AcceptMessage extends Message
+{
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/CommitMessage.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/CommitMessage.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/CommitMessage.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/CommitMessage.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class CommitMessage extends Message
+{
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/LocalDetectorListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/LocalDetectorListener.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/LocalDetectorListener.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/LocalDetectorListener.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+import java.util.List;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface LocalDetectorListener<T>
+{
+    public void changed(List<Member<T>> membership);
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Member.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Member.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Member.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Member.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface Member<T> extends Comparable<T>
+{
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Message.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Message.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Message.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/Message.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public abstract class Message
+{
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/MessageByteBufferTransformer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/MessageByteBufferTransformer.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/MessageByteBufferTransformer.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/MessageByteBufferTransformer.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.mina.core.IoTransformer;
+import org.apache.mina.core.IoTransformerException;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class MessageByteBufferTransformer implements IoTransformer<Message, ByteBuffer>
+{
+    static final Logger LOG = LoggerFactory.getLogger(MessageByteBufferTransformer.class);
+
+    public ByteBuffer there(Message message) throws IoTransformerException
+    {
+        if (message instanceof ProposeMessage)
+        {
+
+        }
+        else if (message instanceof RetryMessage)
+        {
+
+        }
+        else if (message instanceof AcceptMessage)
+        {
+
+        }
+        else if (message instanceof CommitMessage)
+        {
+
+        }
+
+        return null;  //Todo change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Message back(ByteBuffer byteBuffer) throws IoTransformerException
+    {
+        return null;  //Todo change body of implemented methods use File | Settings | File Templates.
+    }
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/ProposeMessage.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/ProposeMessage.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/ProposeMessage.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/ProposeMessage.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class ProposeMessage extends Message
+{
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/RetryMessage.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/RetryMessage.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/RetryMessage.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/group/RetryMessage.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.group;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class RetryMessage extends Message
+{
+}

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoChannel.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoChannel.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoChannel.java Sun Jul 31 17:31:47 2011
@@ -18,155 +18,16 @@
  */
 package org.apache.mina.core;
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
 import org.apache.mina.impl.EquipmentStack;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public abstract class AbstractIoChannel implements IoChannel
+public abstract class AbstractIoChannel<U, D> implements IoChannel<U, D>
 {
-    private final Set<IoUp> parents = new HashSet<IoUp>();
-    private final Set<IoDown> children = new HashSet<IoDown>();
     private final EquipmentStack stack = new EquipmentStack();
 
-    public Set<IoUp> getParents()
-    {
-        return new Set<IoUp>()
-        {
-            final Set<IoUp> p = parents;
-
-            public int size() { return p.size(); }
-
-            public boolean isEmpty() { return p.isEmpty(); }
-
-            public boolean contains(Object o) { return p.contains(o); }
-
-            public Iterator<IoUp> iterator() { return p.iterator(); }
-
-            public Object[] toArray() { return p.toArray(); }
-
-            public <T> T[] toArray(T[] a) { return p.toArray(a); }
-
-            public boolean add(IoUp o)
-            {
-                if (IoDown.class.isInstance(AbstractIoChannel.this)) o.getChildren().add((IoDown)AbstractIoChannel.this);
-                return p.add(o);
-            }
-
-            public boolean remove(Object o)
-            {
-                if (IoDown.class.isInstance(AbstractIoChannel.this)) ((AbstractIoChannel)o).getChildren().add((IoDown)AbstractIoChannel.this);
-                return p.remove(o);
-            }
-
-            public boolean containsAll(Collection<?> c) { return p.containsAll(c); }
-
-            public boolean addAll(Collection<? extends IoUp> c)
-            {
-                if (IoDown.class.isInstance(AbstractIoChannel.this)) for (IoUp parent : c) parent.getChildren().add((IoDown)AbstractIoChannel.this);
-                return p.addAll(c);
-            }
-
-            public boolean retainAll(Collection<?> c)
-            {
-                Set<IoUp> toBeRemoved = new HashSet<IoUp>(p);
-
-                toBeRemoved.removeAll(c);
-                for (IoUp parent : toBeRemoved) parent.getChildren().remove(AbstractIoChannel.this);
-
-                return p.retainAll(c);
-            }
-
-            public boolean removeAll(Collection<?> c)
-            {
-                for (AbstractIoChannel parent : (Collection<AbstractIoChannel>)c) parent.getChildren().remove(AbstractIoChannel.this);
-                return p.removeAll(c);
-            }
-
-            public void clear()
-            {
-                for (IoUp parent : p) parent.getChildren().remove(AbstractIoChannel.this);
-                p.clear();
-            }
-
-            public boolean equals(Object o) { return p.equals(o); }
-
-            public int hashCode() { return p.hashCode(); }
-        };
-    }
-
-    public Set<IoDown> getChildren()
-    {
-        return new Set<IoDown>()
-        {
-            final Set<IoDown> c = children;
-
-            public int size() { return c.size(); }
-
-            public boolean isEmpty() { return c.isEmpty(); }
-
-            public boolean contains(Object o) { return c.contains(o); }
-
-            public Iterator<IoDown> iterator() { return c.iterator(); }
-
-            public Object[] toArray() { return c.toArray(); }
-
-            public <T> T[] toArray(T[] a) { return c.toArray(a); }
-
-            public boolean add(IoDown o)
-            {
-                if (IoUp.class.isInstance(AbstractIoChannel.this)) o.getParents().add((IoUp)AbstractIoChannel.this);
-                return c.add(o);
-            }
-
-            public boolean remove(Object o)
-            {
-                if (IoUp.class.isInstance(AbstractIoChannel.this)) ((AbstractIoChannel)o).getParents().add((IoUp)AbstractIoChannel.this);
-                return c.remove(o);
-            }
-
-            public boolean containsAll(Collection<?> c) { return this.c.containsAll(c); }
-
-            public boolean addAll(Collection<? extends IoDown> c)
-            {
-                if (IoUp.class.isInstance(AbstractIoChannel.this)) for (IoDown parent : c) parent.getParents().add((IoUp)AbstractIoChannel.this);
-                return this.c.addAll(c);
-            }
-
-            public boolean retainAll(Collection<?> c)
-            {
-                Set<IoDown> toBeRemoved = new HashSet<IoDown>(this.c);
-
-                toBeRemoved.removeAll(c);
-                for (IoDown parent : toBeRemoved) parent.getParents().remove(AbstractIoChannel.this);
-
-                return this.c.retainAll(c);
-            }
-
-            public boolean removeAll(Collection<?> c)
-            {
-                for (IoDown parent : (Collection<IoDown>)c) parent.getParents().remove(AbstractIoChannel.this);
-                return this.c.removeAll(c);
-            }
-
-            public void clear()
-            {
-                for (IoDown parent : c) parent.getParents().remove(AbstractIoChannel.this);
-                c.clear();
-            }
-
-            public boolean equals(Object o) { return c.equals(o); }
-
-            public int hashCode() { return c.hashCode(); }
-        };
-    }
-
     public IoChannel equipWith(String key, Object value)
     {
         stack.equipWith(key, value);

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoFuture.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoFuture.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/AbstractIoFuture.java Sun Jul 31 17:31:47 2011
@@ -45,7 +45,8 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public abstract class AbstractIoFuture<V> implements IoFuture<V> {
+public abstract class AbstractIoFuture<V> implements IoFuture<V>
+{
 
     static final Logger LOG = LoggerFactory.getLogger(AbstractIoFuture.class);
     private final CountDownLatch latch = new CountDownLatch(1);
@@ -56,25 +57,32 @@ public abstract class AbstractIoFuture<V
      * {@inheritDoc}
      */
     @SuppressWarnings({"unchecked"})
-    public IoFuture<V> register(IoFutureListener<V> listener) {
+    public IoFuture<V> register(IoFutureListener<V> listener)
+    {
 
         LOG.debug("registering listener {}", listener);
 
-        synchronized (latch) {
-            if (!isDone()) {
+        synchronized (latch)
+        {
+            if (!isDone())
+            {
                 LOG.debug("future is not done, adding listener to listener set");
                 listeners.add(listener);
                 listener = null;
             }
         }
 
-        if (listener != null) {
+        if (listener != null)
+        {
             LOG.debug("future is done calling listener");
             Object object = result.get();
-            if (object instanceof Throwable) {
-                scheduleException(listener, (Throwable) object);
-            } else {
-                scheduleResult(listener, (V) object);
+            if (object instanceof Throwable)
+            {
+                scheduleException(listener, (Throwable)object);
+            }
+            else
+            {
+                scheduleResult(listener, (V)object);
             }
         }
 
@@ -84,28 +92,35 @@ public abstract class AbstractIoFuture<V
     /**
      * {@inheritDoc}
      */
-    public boolean cancel(boolean mayInterruptIfRunning) {
+    public boolean cancel(boolean mayInterruptIfRunning)
+    {
 
         LOG.debug("Attempting to cancel");
 
         CancellationException ce = null;
-        synchronized (latch) {
-            if (!isCancelled() && !isDone() && cancelOwner(mayInterruptIfRunning)) {
+        synchronized (latch)
+        {
+            if (!isCancelled() && !isDone() && cancelOwner(mayInterruptIfRunning))
+            {
 
                 LOG.debug("Successfully cancelled");
 
                 ce = new CancellationException();
                 result.set(ce);
-            } else {
+            }
+            else
+            {
                 LOG.debug("Unable to cancel");
             }
             latch.countDown();
         }
 
-        if (ce != null) {
+        if (ce != null)
+        {
             LOG.debug("Calling listeners");
 
-            for (IoFutureListener<V> listener : listeners) {
+            for (IoFutureListener<V> listener : listeners)
+            {
                 scheduleException(listener, ce);
             }
         }
@@ -116,14 +131,16 @@ public abstract class AbstractIoFuture<V
     /**
      * {@inheritDoc}
      */
-    public boolean isCancelled() {
+    public boolean isCancelled()
+    {
         return result.get() instanceof CancellationException;
     }
 
     /**
      * {@inheritDoc}
      */
-    public boolean isDone() {
+    public boolean isDone()
+    {
         return latch.getCount() == 0;
     }
 
@@ -131,7 +148,8 @@ public abstract class AbstractIoFuture<V
      * {@inheritDoc}
      */
     @SuppressWarnings({"unchecked"})
-    public V get() throws InterruptedException, ExecutionException {
+    public V get() throws InterruptedException, ExecutionException
+    {
 
         LOG.trace("Entering wait");
         latch.await();
@@ -140,10 +158,13 @@ public abstract class AbstractIoFuture<V
         if (isCancelled()) throw new CancellationException();
 
         Object object = result.get();
-        if (object instanceof ExecutionException) {
-            throw (ExecutionException) object;
-        } else {
-            return (V) object;
+        if (object instanceof ExecutionException)
+        {
+            throw (ExecutionException)object;
+        }
+        else
+        {
+            return (V)object;
         }
     }
 
@@ -151,7 +172,8 @@ public abstract class AbstractIoFuture<V
      * {@inheritDoc}
      */
     @SuppressWarnings({"unchecked"})
-    public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+    public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+    {
 
         LOG.trace("Entering wait");
         if (!latch.await(timeout, unit)) throw new TimeoutException();
@@ -160,10 +182,13 @@ public abstract class AbstractIoFuture<V
         if (isCancelled()) throw new CancellationException();
 
         Object object = result.get();
-        if (object instanceof ExecutionException) {
-            throw (ExecutionException) object;
-        } else {
-            return (V) object;
+        if (object instanceof ExecutionException)
+        {
+            throw (ExecutionException)object;
+        }
+        else
+        {
+            return (V)object;
         }
     }
 
@@ -200,11 +225,15 @@ public abstract class AbstractIoFuture<V
      * @param listener the listener to call
      * @param result   the result to pass to the listener
      */
-    protected void scheduleResult(IoFutureListener<V> listener, V result) {
+    protected void scheduleResult(IoFutureListener<V> listener, V result)
+    {
         LOG.debug("Calling the default result scheduler");
-        try {
+        try
+        {
             listener.completed(result);
-        } catch (Throwable t) {
+        }
+        catch (Throwable t)
+        {
             LOG.warn("Listener threw an exception", t);
         }
     }
@@ -217,11 +246,15 @@ public abstract class AbstractIoFuture<V
      * @param listener  the listener to call
      * @param throwable the exception to pass to the listener
      */
-    protected void scheduleException(IoFutureListener<V> listener, Throwable throwable) {
+    protected void scheduleException(IoFutureListener<V> listener, Throwable throwable)
+    {
         LOG.debug("Calling the default exception scheduler");
-        try {
+        try
+        {
             listener.exception(throwable);
-        } catch (Throwable t) {
+        }
+        catch (Throwable t)
+        {
             LOG.warn("Listener threw an exception", t);
         }
     }
@@ -233,15 +266,18 @@ public abstract class AbstractIoFuture<V
      *
      * @param value the value returned by the executing task.
      */
-    protected final void setResult(V value) {
+    protected final void setResult(V value)
+    {
         assert !isDone();
 
-        synchronized (latch) {
+        synchronized (latch)
+        {
             result.set(value);
             latch.countDown();
         }
 
-        for (IoFutureListener<V> listener : listeners) {
+        for (IoFutureListener<V> listener : listeners)
+        {
             scheduleResult(listener, value);
         }
 
@@ -257,17 +293,20 @@ public abstract class AbstractIoFuture<V
      *
      * @param t the throwable that was thrown while executing the task.
      */
-    protected final void setException(Throwable t) {
+    protected final void setException(Throwable t)
+    {
         assert !isDone();
 
         ExecutionException ee = new ExecutionException(t);
 
-        synchronized (latch) {
+        synchronized (latch)
+        {
             result.set(ee);
             latch.countDown();
         }
 
-        for (IoFutureListener<V> listener : listeners) {
+        for (IoFutureListener<V> listener : listeners)
+        {
             scheduleException(listener, ee);
         }
 

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/BaseChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/BaseChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/BaseChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/BaseChannelState.java Sun Jul 31 17:31:47 2011
@@ -23,9 +23,9 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class BaseChannelState<E extends Enum> implements IoChannelState<E>
+public abstract class BaseChannelState<R, P, E extends Enum> implements IoChannelState<R, P, E>
 {
     private final static Logger LOGGER = LoggerFactory.getLogger(BaseChannelState.class);
 
@@ -38,16 +38,4 @@ public class BaseChannelState<E extends 
     {
         LOGGER.trace("Do nothing base destroy");
     }
-
-    public Object send(StateMachineChannel<E> stateMachine, Object message) throws Exception
-    {
-        LOGGER.trace("Do nothing base send");
-        return message;
-    }
-
-    public Object receive(StateMachineChannel<E> stateMachine, Object message) throws Exception
-    {
-        LOGGER.trace("Do nothing base receive");
-        return message;
-    }
 }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/HeapByteBufferFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/HeapByteBufferFactory.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/HeapByteBufferFactory.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/HeapByteBufferFactory.java Sun Jul 31 17:31:47 2011
@@ -26,9 +26,9 @@ import java.util.concurrent.TimeoutExcep
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class HeapByteBufferFactory implements IoByteBufferFactory
+public class HeapByteBufferFactory implements IoBufferFactory
 {
     public Future<ByteBuffer> allocate(final int capacity)
     {

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoAsyncTransformer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoAsyncTransformer.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoAsyncTransformer.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoAsyncTransformer.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoAsyncTransformer<F extends IoBuffer, T extends IoBuffer>
+{
+    T load(F f) throws IoTransformerException;
+
+    F unload(T t) throws IoTransformerException;
+}
\ No newline at end of file

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBuffer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBuffer.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBuffer.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBuffer.java Sun Jul 31 17:31:47 2011
@@ -18,37 +18,14 @@
  */
 package org.apache.mina.core;
 
-import java.nio.ByteBuffer;
-
-
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoBuffer
+public interface IoBuffer<V>
 {
-    static final IoBuffer EMPTY = new IoBuffer()
-    {
-        final ByteBuffer[] messages = new ByteBuffer[]{ByteBuffer.allocate(0)};
-
-        public ByteBuffer[] getMessages()
-        {
-            return messages;
-        }
-
-        public void append(ByteBuffer header)
-        {
-            throw new UnsupportedOperationException("Cannot add headers to empty buffer");
-        }
-
-        public int capacity()
-        {
-            return 0;
-        }
-    };
-
-    ByteBuffer[] getMessages();
+    V[] getMessages();
 
-    void append(ByteBuffer header);
+    void append(V header);
 
     int capacity();
 }

Copied: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBufferFactory.java (from r1141810, mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoByteBufferFactory.java)
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBufferFactory.java?p2=mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBufferFactory.java&p1=mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoByteBufferFactory.java&r1=1141810&r2=1152600&rev=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoByteBufferFactory.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoBufferFactory.java Sun Jul 31 17:31:47 2011
@@ -18,16 +18,15 @@
  */
 package org.apache.mina.core;
 
-import java.nio.ByteBuffer;
 import java.util.concurrent.Future;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoByteBufferFactory extends IoConfig
+public interface IoBufferFactory<V extends IoBuffer> extends IoConfig
 {
-    Future<ByteBuffer> allocate(int capacity);
+    Future<V> allocate(int capacity);
 
-    void recycle(IoBuffer ioBuffer);
+    void recycle(V ioBuffer);
 }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannel.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannel.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannel.java Sun Jul 31 17:31:47 2011
@@ -19,9 +19,9 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoChannel
+public interface IoChannel<U, D> extends IoUp<U>, IoDown<D>
 {
     void init() throws Exception;
 

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoChannelState.java Sun Jul 31 17:31:47 2011
@@ -19,15 +19,15 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoChannelState<E extends Enum>
+public interface IoChannelState<R, P, E extends Enum>
 {
     void init();
 
     void destroy();
 
-    Object send(StateMachineChannel<E> stateMachine, Object message) throws Exception;
+    R send(StateMachineContext<E> context, P message) throws Exception;
 
-    Object receive(StateMachineChannel<E> stateMachine, Object message) throws Exception;
+    R receive(StateMachineContext<E> context, P message) throws Exception;
 }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConfig.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConfig.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConfig.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConfig.java Sun Jul 31 17:31:47 2011
@@ -21,7 +21,7 @@ package org.apache.mina.core;
 /**
  * A simple tag interface that marks a class as a configuration object.
  *
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoConfig
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConnector.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConnector.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConnector.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoConnector.java Sun Jul 31 17:31:47 2011
@@ -23,7 +23,7 @@ import java.net.SocketAddress;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoConnector
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoContext.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoContext.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoContext.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoContext.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class IoContext
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDown.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDown.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDown.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDown.java Sun Jul 31 17:31:47 2011
@@ -18,15 +18,10 @@
  */
 package org.apache.mina.core;
 
-import java.util.Set;
-
-
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoDown
+public interface IoDown<D>
 {
-    Set<IoUp> getParents();
-
-    void send(Object message) throws Exception;
+    void send(D message) throws Exception;
 }

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownMux.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownMux.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownMux.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownMux.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+import java.util.Map;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoDownMux<K, U, D> extends IoDown<D>
+{
+    Map<K, IoUp<U>> getParents();
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownSet.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownSet.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownSet.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoDownSet.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+import java.util.Set;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoDownSet<U, D> extends IoDown<D>
+{
+    Set<IoUp<U>> getParents();
+}
\ No newline at end of file

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFuture.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFuture.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFuture.java Sun Jul 31 17:31:47 2011
@@ -22,7 +22,7 @@ import java.util.concurrent.Future;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoFuture<V> extends Future<V>
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFutureListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFutureListener.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFutureListener.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoFutureListener.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoFutureListener<V>
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoListener.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoListener.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoListener.java Sun Jul 31 17:31:47 2011
@@ -22,7 +22,7 @@ import java.util.EventListener;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoListener extends EventListener
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoProperty.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoProperty.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoProperty.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoProperty.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD})
 @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoPropertyScope.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoPropertyScope.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoPropertyScope.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoPropertyScope.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package org.apache.mina.core;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public enum IoPropertyScope
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoSession.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoSession.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoSession.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoSession.java Sun Jul 31 17:31:47 2011
@@ -23,7 +23,7 @@ import java.util.Set;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public abstract class IoSession
 {

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformer.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformer.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformer.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoTransformer<F, T>
+{
+    T there(F f) throws IoTransformerException;
+
+    F back(T t) throws IoTransformerException;
+}

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformerException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformerException.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformerException.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoTransformerException.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class IoTransformerException extends Exception
+{
+
+    /**
+     * {@inheritDoc}
+     */
+    public IoTransformerException()
+    {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public IoTransformerException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public IoTransformerException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public IoTransformerException(Throwable cause)
+    {
+        super(cause);
+    }
+}

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java Sun Jul 31 17:31:47 2011
@@ -18,15 +18,10 @@
  */
 package org.apache.mina.core;
 
-import java.util.Set;
-
-
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoUp
+public interface IoUp<U>
 {
-    Set<IoDown> getChildren();
-
-    void receive(Object message) throws Exception;
+    void receive(U message) throws Exception;
 }

Copied: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpMux.java (from r1152489, mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java)
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpMux.java?p2=mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpMux.java&p1=mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java&r1=1152489&r2=1152600&rev=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUp.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpMux.java Sun Jul 31 17:31:47 2011
@@ -18,15 +18,13 @@
  */
 package org.apache.mina.core;
 
-import java.util.Set;
+import java.util.Map;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoUp
+public interface IoUpMux<K, U, D> extends IoUp<U>
 {
-    Set<IoDown> getChildren();
-
-    void receive(Object message) throws Exception;
+    Map<K, IoDown<D>> getChildren();
 }

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpSet.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpSet.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpSet.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/IoUpSet.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+import java.util.Set;
+
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface IoUpSet<U, D> extends IoUp<U>
+{
+    Set<IoDown<D>> getChildren();
+}
\ No newline at end of file

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/LimitedByteBufferFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/LimitedByteBufferFactory.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/LimitedByteBufferFactory.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/LimitedByteBufferFactory.java Sun Jul 31 17:31:47 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.mina.core;
 
-import java.nio.ByteBuffer;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.CountDownLatch;
@@ -33,18 +32,18 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class LimitedByteBufferFactory implements IoByteBufferFactory
+public class LimitedByteBufferFactory<V extends IoBuffer> implements IoBufferFactory<V>
 {
     private final static Logger LOGGER = LoggerFactory.getLogger(LimitedByteBufferFactory.class);
     private final Queue<FutureAllocation> futureAllocations = new ConcurrentLinkedQueue<FutureAllocation>();
     private final SerialExecutor executor;
-    private final IoByteBufferFactory factory;
+    private final IoBufferFactory<V> factory;
     private int capacity;
     private int counter;
 
-    public LimitedByteBufferFactory(Executor executor, IoByteBufferFactory factory)
+    public LimitedByteBufferFactory(Executor executor, IoBufferFactory<V> factory)
     {
         if (factory == null) throw new IllegalArgumentException("Factory cannot be null");
 
@@ -53,7 +52,7 @@ public class LimitedByteBufferFactory im
         this.capacity = Integer.MAX_VALUE;
     }
 
-    public LimitedByteBufferFactory(Executor executor, IoByteBufferFactory factory, int capacity)
+    public LimitedByteBufferFactory(Executor executor, IoBufferFactory<V> factory, int capacity)
     {
         if (factory == null) throw new IllegalArgumentException("Factory cannot be null");
         if (capacity < 1)
@@ -82,7 +81,7 @@ public class LimitedByteBufferFactory im
         return counter;
     }
 
-    public Future<ByteBuffer> allocate(int capacity)
+    public Future<V> allocate(int capacity)
     {
         FutureAllocation allocation = new FutureAllocation(capacity);
 
@@ -141,11 +140,11 @@ public class LimitedByteBufferFactory im
         }
     }
 
-    private class FutureAllocation implements Future<ByteBuffer>
+    private class FutureAllocation implements Future<V>
     {
         private final CountDownLatch latch = new CountDownLatch(1);
         private final int capacity;
-        private ByteBuffer byteBuffer;
+        private V byteBuffer;
 
         private FutureAllocation(int capacity)
         {
@@ -190,13 +189,13 @@ public class LimitedByteBufferFactory im
             return latch.getCount() == 0;
         }
 
-        public ByteBuffer get() throws InterruptedException, ExecutionException
+        public V get() throws InterruptedException, ExecutionException
         {
             latch.await();
             return byteBuffer;
         }
 
-        public ByteBuffer get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+        public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
         {
             latch.await(timeout, unit);
             return byteBuffer;

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineChannel.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineChannel.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineChannel.java Sun Jul 31 17:31:47 2011
@@ -27,9 +27,9 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author The Apache MINA Project (dev@mina.apache.org)
  */
-public class StateMachineChannel<E extends Enum> extends AbstractIoChannel implements IoDown, IoUp
+public abstract class StateMachineChannel<U, D, E extends Enum> extends AbstractIoChannel<U, D> implements IoDown<D>, IoUp<U>
 {
     private final static Logger LOGGER = LoggerFactory.getLogger(StateMachineChannel.class);
     private final Object lock = new Object();
@@ -60,38 +60,4 @@ public class StateMachineChannel<E exten
     {
         LOGGER.trace("destroy called");
     }
-
-    public final void send(Object message) throws Exception
-    {
-        Object ball = message;
-
-        synchronized (lock)
-        {
-            List<IoChannelState> chain = states.get(getState());
-            for (IoChannelState link : chain)
-            {
-                ball = link.send(this, ball);
-                if (ball == null) return;
-            }
-        }
-
-        for (IoDown child : getChildren()) child.send(ball);
-    }
-
-    public final void receive(Object message) throws Exception
-    {
-        Object ball = message;
-
-        synchronized (lock)
-        {
-            List<IoChannelState> chain = states.get(getState());
-            for (IoChannelState filter : chain)
-            {
-                ball = filter.receive(this, ball);
-                if (ball == null) return;
-            }
-        }
-
-        for (IoUp parent : getParents()) parent.receive(ball);
-    }
 }

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineContext.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineContext.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineContext.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/core/StateMachineContext.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.core;
+
+/**
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public interface StateMachineContext<E extends Enum>
+{
+    E getState();
+
+    void setState(E state);
+}

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/EquipmentStack.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/EquipmentStack.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/EquipmentStack.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/EquipmentStack.java Sun Jul 31 17:31:47 2011
@@ -33,7 +33,7 @@ import org.apache.mina.core.IoPropertySc
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class EquipmentStack implements Cloneable
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/InjectorEjector.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/InjectorEjector.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/InjectorEjector.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/impl/InjectorEjector.java Sun Jul 31 17:31:47 2011
@@ -34,7 +34,7 @@ import org.apache.mina.core.IoPropertySc
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class InjectorEjector
 {

Added: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/IoByteBuffer.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/IoByteBuffer.java?rev=1152600&view=auto
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/IoByteBuffer.java (added)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/IoByteBuffer.java Sun Jul 31 17:31:47 2011
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.nio;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.mina.core.IoBuffer;
+
+
+/**
+ *
+ */
+public class IoByteBuffer implements IoBuffer<ByteBuffer>
+{
+    private final static String CLASS_NAME = IoByteBuffer.class.getName();
+    private final static Logger LOGGER = Logger.getLogger(CLASS_NAME);
+    public static final IoByteBuffer EMPTY = new IoByteBuffer();
+
+    private final List<ByteBuffer> messages = new ArrayList<ByteBuffer>();
+
+    public IoByteBuffer()
+    {
+    }
+
+    public IoByteBuffer(ByteBuffer byteBuffer)
+    {
+        if (byteBuffer == null) throw new IllegalArgumentException("ByteBuffer cannot be null");
+        append(byteBuffer);
+    }
+
+    public ByteBuffer[] getMessages()
+    {
+        return messages.toArray(new ByteBuffer[messages.size()]);
+    }
+
+    public void append(ByteBuffer header)
+    {
+        messages.add(header);
+    }
+
+    public int capacity()
+    {
+        return 0;  //Todo change body of implemented methods use File | Settings | File Templates.
+    }
+}

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/NioSocketConnector.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/NioSocketConnector.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/NioSocketConnector.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/nio/NioSocketConnector.java Sun Jul 31 17:31:47 2011
@@ -29,7 +29,7 @@ import org.apache.mina.core.IoSession;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class NioSocketConnector implements IoConnector
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosedChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosedChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosedChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosedChannelState.java Sun Jul 31 17:31:47 2011
@@ -19,13 +19,13 @@
 package org.apache.mina.ssl;
 
 import org.apache.mina.core.IoChannelState;
-import org.apache.mina.core.StateMachineChannel;
+import org.apache.mina.core.StateMachineContext;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class ClosedChannelState implements IoChannelState
+public class ClosedChannelState<R, P> implements IoChannelState<R, P, SslStates>
 {
     public void init()
     {
@@ -37,12 +37,12 @@ public class ClosedChannelState implemen
         //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public Object send(StateMachineChannel stateMachine, Object message) throws Exception
+    public R send(StateMachineContext<SslStates> sslStatesStateMachineContext, P message) throws Exception
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public Object receive(StateMachineChannel stateMachine, Object message) throws Exception
+    public R receive(StateMachineContext<SslStates> sslStatesStateMachineContext, P message) throws Exception
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosingChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosingChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosingChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/ClosingChannelState.java Sun Jul 31 17:31:47 2011
@@ -19,13 +19,13 @@
 package org.apache.mina.ssl;
 
 import org.apache.mina.core.IoChannelState;
-import org.apache.mina.core.StateMachineChannel;
+import org.apache.mina.core.StateMachineContext;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class ClosingChannelState implements IoChannelState
+public class ClosingChannelState<R, P> implements IoChannelState<R, P, SslStates>
 {
     public void init()
     {
@@ -37,12 +37,12 @@ public class ClosingChannelState impleme
         //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public Object send(StateMachineChannel stateMachine, Object message) throws Exception
+    public R send(StateMachineContext<SslStates> stateMachine, P message) throws Exception
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public Object receive(StateMachineChannel stateMachine, Object message) throws Exception
+    public R receive(StateMachineContext<SslStates> stateMachine, P message) throws Exception
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/FinishedChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/FinishedChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/FinishedChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/FinishedChannelState.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,6 @@
 package org.apache.mina.ssl;
 
 import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
 import java.nio.ByteBuffer;
 
 import org.slf4j.Logger;
@@ -29,13 +28,14 @@ import org.apache.mina.core.BaseChannelS
 import org.apache.mina.core.IoBuffer;
 import org.apache.mina.core.IoProperty;
 import org.apache.mina.core.IoPropertyScope;
-import org.apache.mina.core.StateMachineChannel;
+import org.apache.mina.core.StateMachineContext;
+import org.apache.mina.nio.IoByteBuffer;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class FinishedChannelState extends BaseChannelState
+public class FinishedChannelState extends BaseChannelState<IoByteBuffer, IoByteBuffer, SslStates>
 {
     private final static Logger LOGGER = LoggerFactory.getLogger(FinishedChannelState.class);
     private ByteBuffer byteBuffer;
@@ -53,30 +53,28 @@ public class FinishedChannelState extend
         this.engine = engine;
     }
 
-    @Override
-    public Object send(StateMachineChannel stateMachine, Object message) throws Exception
+    public IoByteBuffer send(StateMachineContext<SslStates> stateMachine, IoByteBuffer message) throws Exception
     {
         IoBuffer ioBuffer = (IoBuffer)message;
 
-        engine.wrap(ioBuffer.getMessages(), byteBuffer);
+//        engine.wrap(ioBuffer.getMessages(), byteBuffer);
 
-        return byteBuffer;
+        return new IoByteBuffer(byteBuffer);
     }
 
-    @Override
-    public Object receive(StateMachineChannel stateMachine, Object message) throws Exception
+    public IoByteBuffer receive(StateMachineContext<SslStates> stateMachine, IoByteBuffer message) throws Exception
     {
         IoBuffer ioBuffer = (IoBuffer)message;
 
-        SSLEngineResult result = engine.unwrap(ioBuffer.getMessages()[0], byteBuffer);
-
-        if (result.getStatus() != SSLEngineResult.Status.BUFFER_UNDERFLOW)
-        {
-            return byteBuffer;
-        }
-        else
-        {
-            return null;
-        }
+//        SSLEngineResult result = engine.unwrap(ioBuffer.getMessages()[0], byteBuffer);
+//
+//        if (result.getStatus() != SSLEngineResult.Status.BUFFER_UNDERFLOW)
+//        {
+//            return new IoByteBuffer(byteBuffer);
+//        }
+//        else
+//        {
+        return null;
+//        }
     }
 }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/HandshakeChannelState.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/HandshakeChannelState.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/HandshakeChannelState.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/HandshakeChannelState.java Sun Jul 31 17:31:47 2011
@@ -19,31 +19,29 @@
 package org.apache.mina.ssl;
 
 import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLEngineResult;
-import java.nio.ByteBuffer;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.mina.core.BaseChannelState;
-import org.apache.mina.core.IoBuffer;
-import org.apache.mina.core.IoByteBufferFactory;
+import org.apache.mina.core.IoBufferFactory;
 import org.apache.mina.core.IoProperty;
 import org.apache.mina.core.IoPropertyScope;
-import org.apache.mina.core.StateMachineChannel;
+import org.apache.mina.core.StateMachineContext;
+import org.apache.mina.nio.IoByteBuffer;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class HandshakeChannelState extends BaseChannelState<SslStates>
+public class HandshakeChannelState extends BaseChannelState<IoByteBuffer, IoByteBuffer, SslStates>
 {
     private final static Logger LOGGER = LoggerFactory.getLogger(HandshakeChannelState.class);
-    private IoByteBufferFactory factory;
+    private IoBufferFactory<IoByteBuffer> factory;
     private SSLEngine engine;
 
     @IoProperty(name = "factory", scope = IoPropertyScope.GLOBAL)
-    public void setFactory(IoByteBufferFactory factory)
+    public void setFactory(IoBufferFactory<IoByteBuffer> factory)
     {
         this.factory = factory;
     }
@@ -54,69 +52,65 @@ public class HandshakeChannelState exten
         this.engine = engine;
     }
 
-    @Override
-    public Object send(StateMachineChannel<SslStates> stateMachine, Object message) throws Exception
+    public IoByteBuffer send(StateMachineContext<SslStates> context, IoByteBuffer message) throws Exception
     {
-        IoBuffer ioBuffer = (IoBuffer)message;
+        IoByteBuffer ioByteBuffer = (IoByteBuffer)message;
 
-        ByteBuffer byteBuffer = factory.allocate(engine.getSession().getPacketBufferSize()).get();
-        SSLEngineResult result = engine.wrap(ioBuffer.getMessages(), byteBuffer);
-        if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_TASK)
-        {
-            Runnable runnable;
-            while ((runnable = engine.getDelegatedTask()) != null)
-            {
-                LOGGER.trace("delegated task started");
-                runnable.run();
-                LOGGER.trace("delegated task completed");
-            }
-
-            SSLEngineResult.HandshakeStatus status = engine.getHandshakeStatus();
-            if (status == SSLEngineResult.HandshakeStatus.NEED_TASK)
-            {
-                throw new Exception("handshake shouldn't need additional tasks");
-            }
-            LOGGER.trace("handshake status: " + status);
-        }
-        factory.recycle(ioBuffer);
+        IoByteBuffer byteBuffer = factory.allocate(engine.getSession().getPacketBufferSize()).get();
+//        SSLEngineResult result = engine.wrap(ioByteBuffer.getMessages(), byteBuffer);
+//        if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_TASK)
+//        {
+//            Runnable runnable;
+//            while ((runnable = engine.getDelegatedTask()) != null)
+//            {
+//                LOGGER.trace("delegated task started");
+//                runnable.run();
+//                LOGGER.trace("delegated task completed");
+//            }
+//
+//            SSLEngineResult.HandshakeStatus status = engine.getHandshakeStatus();
+//            if (status == SSLEngineResult.HandshakeStatus.NEED_TASK)
+//            {
+//                throw new Exception("handshake shouldn't need additional tasks");
+//            }
+//            LOGGER.trace("handshake status: " + status);
+//        }
+//        factory.recycle(message);
 
         return byteBuffer;
     }
 
-    @Override
-    public Object receive(StateMachineChannel<SslStates> stateMachine, Object message) throws Exception
+    public IoByteBuffer receive(StateMachineContext<SslStates> context, IoByteBuffer message) throws Exception
     {
-        IoBuffer ioBuffer = (IoBuffer)message;
-
-        ByteBuffer byteBuffer = factory.allocate(engine.getSession().getPacketBufferSize()).get();
-        SSLEngineResult result = engine.unwrap(ioBuffer.getMessages()[0], byteBuffer);
-        if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_TASK)
-        {
-            Runnable runnable;
-            while ((runnable = engine.getDelegatedTask()) != null)
-            {
-                LOGGER.trace("delegated task started");
-                runnable.run();
-                LOGGER.trace("delegated task completed");
-            }
-
-            SSLEngineResult.HandshakeStatus status = engine.getHandshakeStatus();
-            if (status == SSLEngineResult.HandshakeStatus.NEED_TASK)
-            {
-                throw new Exception("handshake shouldn't need additional tasks");
-            }
-
-            LOGGER.trace("handshake status: " + status);
-        }
-        else if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_WRAP)
-        {
-            stateMachine.send(send(stateMachine, IoBuffer.EMPTY));
-        }
-        else if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.FINISHED)
-        {
-            stateMachine.setState(SslStates.FINISHED);
-        }
-        factory.recycle(ioBuffer);
+        IoByteBuffer byteBuffer = factory.allocate(engine.getSession().getPacketBufferSize()).get();
+//        SSLEngineResult result = engine.unwrap(message.getMessages()[0], byteBuffer);
+//        if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_TASK)
+//        {
+//            Runnable runnable;
+//            while ((runnable = engine.getDelegatedTask()) != null)
+//            {
+//                LOGGER.trace("delegated task started");
+//                runnable.run();
+//                LOGGER.trace("delegated task completed");
+//            }
+//
+//            SSLEngineResult.HandshakeStatus status = engine.getHandshakeStatus();
+//            if (status == SSLEngineResult.HandshakeStatus.NEED_TASK)
+//            {
+//                throw new Exception("handshake shouldn't need additional tasks");
+//            }
+//
+//            LOGGER.trace("handshake status: " + status);
+//        }
+//        else if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.NEED_WRAP)
+//        {
+//            stateMachine.send(send(stateMachine, IoByteBuffer.EMPTY));
+//        }
+//        else if (result.getHandshakeStatus() == SSLEngineResult.HandshakeStatus.FINISHED)
+//        {
+//            stateMachine.setState(SslStates.FINISHED);
+//        }
+//        factory.recycle(message);
 
         return byteBuffer;
     }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslChannel.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslChannel.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslChannel.java Sun Jul 31 17:31:47 2011
@@ -21,22 +21,21 @@ package org.apache.mina.ssl;
 import javax.net.ssl.SSLEngine;
 import java.util.Collections;
 
-import org.apache.mina.core.IoBuffer;
-import org.apache.mina.core.IoByteBufferFactory;
+import org.apache.mina.core.IoBufferFactory;
 import org.apache.mina.core.IoChannelState;
-import org.apache.mina.core.IoDown;
 import org.apache.mina.core.IoProperty;
 import org.apache.mina.core.IoPropertyScope;
 import org.apache.mina.core.StateMachineChannel;
+import org.apache.mina.nio.IoByteBuffer;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class SslChannel extends StateMachineChannel<SslStates>
+public class SslChannel extends StateMachineChannel<IoByteBuffer, IoByteBuffer, SslStates>
 {
     private SslConfig sslConfig;
-    private IoByteBufferFactory factory;
+    private IoBufferFactory factory;
     private SSLEngine engine;
 
     public SslChannel()
@@ -54,7 +53,7 @@ public class SslChannel extends StateMac
     }
 
     @IoProperty(name = "factory", scope = IoPropertyScope.GLOBAL)
-    public void setFactory(IoByteBufferFactory factory)
+    public void setFactory(IoBufferFactory factory)
     {
         this.factory = factory;
     }
@@ -80,9 +79,7 @@ public class SslChannel extends StateMac
             state.setFactory(factory);
             state.setEngine(engine);
 
-            IoBuffer message = (IoBuffer)state.send(this, IoBuffer.EMPTY);
-
-            for (IoDown down : getChildren()) down.send(message);
+            // TODO: NEED TO INITIATE HANDSHAKE HERE
         }
     }
 
@@ -98,4 +95,14 @@ public class SslChannel extends StateMac
     {
         return engine;
     }
+
+    public void send(IoByteBuffer message) throws Exception
+    {
+        //Todo change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void receive(IoByteBuffer message) throws Exception
+    {
+        //Todo change body of implemented methods use File | Settings | File Templates.
+    }
 }

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslConfig.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslConfig.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslConfig.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslConfig.java Sun Jul 31 17:31:47 2011
@@ -27,7 +27,7 @@ import org.apache.mina.core.IoConfig;
 
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class SslConfig implements IoConfig
 {

Modified: mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslStates.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslStates.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslStates.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/main/java/org/apache/mina/ssl/SslStates.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package org.apache.mina.ssl;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public enum SslStates
 {

Modified: mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpClient.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpClient.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpClient.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpClient.java Sun Jul 31 17:31:47 2011
@@ -34,16 +34,16 @@ import org.apache.ahc.api.HttpListener;
 import org.apache.ahc.api.HttpRequest;
 import org.apache.ahc.api.HttpResponse;
 import org.apache.ahc.api.HttpVerb;
-import org.apache.ahc.api.MimeContent;
-import org.apache.ahc.api.listeners.MimeContentListener;
+import org.apache.ahc.api.mime.MimeContent;
+import org.apache.ahc.api.mime.MimeListener;
 
 
 /**
- * @version $Revision$ $Date: $
+ *
  */
 public class AcmeHttpClient implements HttpClient
 {
-    public Object getValue(String key)
+    public <T> T getEquip(String key)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
@@ -53,22 +53,22 @@ public class AcmeHttpClient implements H
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public HttpClientFuture<HttpResponse> get(String url)
+    public HttpClientFuture<HttpResponse> get(URL url)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public HttpClientFuture<HttpResponse> post(String url, Map<String, String> map, MimeContent... content)
+    public HttpClientFuture<HttpResponse> post(URL url, Map<String, String> map, MimeContent... content)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public HttpClientFuture<HttpResponse> put(String url, Map<String, String> map, MimeContent... content)
+    public HttpClientFuture<HttpResponse> put(URL url, Map<String, String> map, MimeContent... content)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public HttpClientFuture<HttpResponse> delete(String url)
+    public HttpClientFuture<HttpResponse> delete(URL url)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
@@ -118,7 +118,7 @@ public class AcmeHttpClient implements H
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }
 
-    public HttpRequest allocateHttpRequest(URL url, HttpVerb verb, HttpHeaders headers, List<MimeContent> mimeContent, List<MimeContentListener> listeners, int timeout, TimeUnit timeUnit)
+    public HttpRequest allocateHttpRequest(URL url, HttpVerb verb, HttpHeaders headers, List<MimeContent> mimeContent, List<MimeListener> listeners, int timeout, TimeUnit timeUnit)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }

Modified: mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpRequest.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpRequest.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpRequest.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/AcmeHttpRequest.java Sun Jul 31 17:31:47 2011
@@ -55,7 +55,7 @@ public class AcmeHttpRequest extends Htt
     }
 
     @Override
-    public Object getValue(String key)
+    public Object getEquip(String key)
     {
         return null;  //Todo change body of implemented methods use File | Settings | File Templates.
     }

Modified: mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/listeners/SslBenchmarkListener.java
URL: http://svn.apache.org/viewvc/mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/listeners/SslBenchmarkListener.java?rev=1152600&r1=1152599&r2=1152600&view=diff
==============================================================================
--- mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/listeners/SslBenchmarkListener.java (original)
+++ mina/sandbox/adc/ahc/mina3/src/test/java/com/acme/ahc/listeners/SslBenchmarkListener.java Sun Jul 31 17:31:47 2011
@@ -19,7 +19,7 @@
 package com.acme.ahc.listeners;
 
 /**
- * @version $Revision: $ $Date: $
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface SslBenchmarkListener extends BenchmarkListener
 {