directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r159340 - in directory/network/trunk/src/java/org/apache/mina: common/ io/ io/datagram/ io/socket/
Date Tue, 29 Mar 2005 01:40:29 GMT
Author: trustin
Date: Mon Mar 28 17:40:25 2005
New Revision: 159340

URL: http://svn.apache.org/viewcvs?view=rev&rev=159340
Log:
Added more JavaDocs

Modified:
    directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java
    directory/network/trunk/src/java/org/apache/mina/common/IdleStatus.java
    directory/network/trunk/src/java/org/apache/mina/common/SessionConfig.java
    directory/network/trunk/src/java/org/apache/mina/common/TransportType.java
    directory/network/trunk/src/java/org/apache/mina/io/AbstractIoHandlerFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramProcessor.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSession.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSessionConfig.java

Modified: directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java Mon Mar 28 17:40:25
2005
@@ -48,42 +48,22 @@
  */
 public final class ByteBuffer
 {
-    private static final Stack[] bufferStacks = new Stack[] { new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(),
-                                                             new Stack(), };
+    private static final Stack[] bufferStacks = new Stack[] {
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), new Stack(), new Stack(), new Stack(),
+            new Stack(), };
 
     /**
      * Returns the buffer which is capable of the specified size.
      */
-    public static ByteBuffer allocate( int size )
+    public static ByteBuffer allocate( int capacity )
     {
-        int idx = getBufferStackIndex( size );
+        int idx = getBufferStackIndex( capacity );
         Stack stack = bufferStacks[ idx ];
 
         ByteBuffer buf;

Modified: directory/network/trunk/src/java/org/apache/mina/common/IdleStatus.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/IdleStatus.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/IdleStatus.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/IdleStatus.java Mon Mar 28 17:40:25
2005
@@ -30,8 +30,8 @@
  *   <li>{@link #BOTH_IDLE} - Both {@link #READER_IDLE} and {@link #WRITER_IDLE}.</li>
  * </ul>
  * <p>
- * Idle time settings are all disabled by default.  You can enable them all or
- * partly using {@link SessionConfig#setIdleTime(IdleStatus,int)}.
+ * Idle time settings are all disabled by default.  You can enable them
+ * using {@link SessionConfig#setIdleTime(IdleStatus,int)}.
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
@@ -64,6 +64,14 @@
         this.strValue = strValue;
     }
 
+    /**
+     * Returns the string representation of this status.
+     * <ul>
+     *   <li>{@link #READER_IDLE} - <tt>"reader idle"</tt></li>
+     *   <li>{@link #WRITER_IDLE} - <tt>"writer idle"</tt></li>
+     *   <li>{@link #BOTH_IDLE} - <tt>"both idle"</tt></li>
+     * </ul>
+     */
     public String toString()
     {
         return strValue;

Modified: directory/network/trunk/src/java/org/apache/mina/common/SessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/SessionConfig.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/SessionConfig.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/SessionConfig.java Mon Mar 28
17:40:25 2005
@@ -25,7 +25,7 @@
 import org.apache.mina.protocol.ProtocolSession;
 
 /**
- * Provides general or transport-specific configuration.
+ * Provides general or {@link TransportType}-specific configuration.
  * <p>
  * <ul>
  *   <li><code>idleTime</code> (secs) - <code>sessionIdle</code>
event is
@@ -36,10 +36,17 @@
  * </ul>
  * <p>
  * Please refer to {@link SocketSessionConfig} and {@link DatagramSessionConfig}
- * for transport-specific configurations.
+ * for {@link TransportType}-specific configurations.
  * <p>
  * {@link SessionConfig} can be obtained by {@link IoSession#getConfig()} and
- * by {@link ProtocolSession#getConfig()}.
+ * by {@link ProtocolSession#getConfig()}.  To adjust
+ * {@link TransportType}-specific settings, please downcast it:
+ * <pre>
+ * public void sessionOpened( IoSession s )
+ * {
+ *     ( ( SocketSessionConfig ) s.getConfig() ).setReuseAddress( true );
+ * }
+ * </pre>
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$

Modified: directory/network/trunk/src/java/org/apache/mina/common/TransportType.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/TransportType.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/TransportType.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/TransportType.java Mon Mar 28
17:40:25 2005
@@ -23,7 +23,13 @@
 import java.io.Serializable;
 
 /**
- * Represents network transport types.
+ * Represents network transport types.  MINA provides three transport types:
+ * <ul>
+ *   <li>{@link #SOCKET} - TCP/IP</li>
+ *   <li>{@link #DATAGRAM} - UDP/IP</li>
+ *   <li>{@link #VM_PIPE} - in-VM pipe support (only available in protocol
+ *       layer</li>
+ * </ul> 
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
@@ -45,7 +51,10 @@
             "DATAGRAM", true );
 
     /**
-     * Transport type: VM pipe (direct message exchange)
+     * Transport type: VM pipe (direct message exchange).
+     * Please refer to
+     * <a href="../protocol/vmpipe/package-summary.htm"><tt>org.apache.mina.protocol.vmpipe</tt></a>
+     * package.
      */
     public static final TransportType VM_PIPE = new TransportType( "VM_PIPE",
             false );
@@ -54,9 +63,9 @@
      * Returns the transport type of the specified name.  Here are the list
      * of available names:
      * <ul>
-     *   <li><code>"socket"</code> or <code>"tcp"</code> -
{@link #SOCKET}</li>
-     *   <li><code>"datagram"</code> or <code>"udp"</code>
- {@link #DATAGRAM}</li>
-     *   <li><code>"vm_pipe"</code> - {@link #VM_PIPE}</li>
+     *   <li><code>"socket"</code> or <code>"tcp"</code> returns
{@link #SOCKET}</li>
+     *   <li><code>"datagram"</code> or <code>"udp"</code>
returns {@link #DATAGRAM}</li>
+     *   <li><code>"vm_pipe"</code> returns {@link #VM_PIPE}</li>
      * </ul>
      * All names are case-insensitive.
      * 

Modified: directory/network/trunk/src/java/org/apache/mina/io/AbstractIoHandlerFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/AbstractIoHandlerFilterChain.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/AbstractIoHandlerFilterChain.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/io/AbstractIoHandlerFilterChain.java
Mon Mar 28 17:40:25 2005
@@ -11,6 +11,25 @@
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandlerFilter.NextFilter;
 
+/**
+ * An abstract implementation of {@link IoHandlerFilterChain} that provides
+ * common operations for developers to support specific transport types.
+ * <p>
+ * All methods has been implemented.  The list of filters is maintained
+ * as a doublely linked list.  You can fire any MINA events which is filtered
+ * by this chain using these public methods:
+ * <ul>
+ *   <li></li>
+ * </ul>
+ * 
+ * The only method a developer should implement is {@link #doWrite(IoSession, ByteBuffer,
Object)}.
+ * This method is invoked when filter chain is evaluated for
+ * {@link IoHandlerFilter#filterWrite(NextFilter, IoSession, ByteBuffer, Object)} and 
+ * finally to be written to the underlying transport layer (e.g. socket)
+ * 
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$,
+ */
 public abstract class AbstractIoHandlerFilterChain implements IoHandlerFilterChain
 {
     private final IoHandlerFilter HEAD_FILTER = new IoHandlerFilter()

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java Mon
Mar 28 17:40:25 2005
@@ -68,7 +68,7 @@
     /**
      * Creates a new instance.
      * 
-     * @throws IOException
+     * @throws IOException if failed to open a selector.
      */
     public DatagramAcceptor() throws IOException
     {
@@ -182,13 +182,13 @@
         }
     }
 
-    public void flushSession( DatagramSession session )
+    void flushSession( DatagramSession session )
     {
         scheduleFlush( session );
         selector.wakeup();
     }
 
-    public void closeSession( DatagramSession session )
+    void closeSession( DatagramSession session )
     {
     }
 

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java Mon
Mar 28 17:40:25 2005
@@ -67,7 +67,7 @@
     /**
      * Creates a new instance.
      * 
-     * @throws IOException
+     * @throws IOException if failed to open a selector
      */
     public DatagramConnector() throws IOException
     {
@@ -134,7 +134,7 @@
         return connect( address, handler );
     }
 
-    public void closeSession( DatagramSession session )
+    void closeSession( DatagramSession session )
     {
         synchronized( this )
         {
@@ -149,7 +149,7 @@
         selector.wakeup();
     }
 
-    public void flushSession( DatagramSession session )
+    void flushSession( DatagramSession session )
     {
         scheduleFlush( session );
         selector.wakeup();

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramFilterChain.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramFilterChain.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramFilterChain.java
Mon Mar 28 17:40:25 2005
@@ -5,6 +5,11 @@
 import org.apache.mina.io.IoSession;
 import org.apache.mina.util.Queue;
 
+/**
+ * An {@link IoHandlerFilterChain} for datagram transport (UDP/IP).
+ * 
+ * @author The Apache Directory Project
+ */
 class DatagramFilterChain extends AbstractIoHandlerFilterChain {
 
     private final DatagramProcessor processor;

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramProcessor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramProcessor.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramProcessor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramProcessor.java Mon
Mar 28 17:40:25 2005
@@ -29,11 +29,13 @@
 abstract class DatagramProcessor
 {
     /**
-     * This method is invoked by MINA internally.
+     * Requests this processor to flush the write buffer of the specified
+     * session.  This method is invoked by MINA internally.
      */
     abstract void flushSession( DatagramSession session );
 
     /**
+     * Requests this processor to close the specified session.
      * This method is invoked by MINA internally.
      */
     abstract void closeSession( DatagramSession session );

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSession.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSession.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSession.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSession.java Mon
Mar 28 17:40:25 2005
@@ -31,7 +31,7 @@
 import org.apache.mina.util.Queue;
 
 /**
- * TODO Insert type comment.
+ * An {@link IoSession} for datagram transport (UDP/IP).
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
Mon Mar 28 17:40:25 2005
@@ -26,6 +26,10 @@
 
 /**
  * A {@link SessionConfig} for datagram transport (UDP/IP).
+ * You can downcast {@link SessionConfig} instance returned by
+ * {@link IoSession#getConfig()} or {@link ProtocolSession#getConfig()}
+ * if you've created datagram session using {@link DatagramAcceptor} or 
+ * {@link DatagramConnector}.
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java Mon Mar
28 17:40:25 2005
@@ -18,7 +18,6 @@
  */
 package org.apache.mina.io.socket;
 
-
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
@@ -37,7 +36,6 @@
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilterChain;
 import org.apache.mina.util.Queue;
-
 
 /**
  * {@link IoAcceptor} for socket transport (TCP/IP).

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketFilterChain.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketFilterChain.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketFilterChain.java Mon
Mar 28 17:40:25 2005
@@ -5,6 +5,11 @@
 import org.apache.mina.io.IoSession;
 import org.apache.mina.util.Queue;
 
+/**
+ * An {@link IoHandlerFilterChain} for socket transport (TCP/IP).
+ * 
+ * @author The Apache Directory Project
+ */
 class SocketFilterChain extends AbstractIoHandlerFilterChain {
 
     SocketFilterChain()

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketIoProcessor.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketIoProcessor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketIoProcessor.java Mon
Mar 28 17:40:25 2005
@@ -32,8 +32,8 @@
 import org.apache.mina.util.Queue;
 
 /**
- * Performs core I/O operations for sockets.  This class is used by MINA
- * internally.
+ * Performs all I/O operations for sockets which is connected or bound.
+ * This class is used by MINA internally.
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSession.java Mon Mar
28 17:40:25 2005
@@ -31,7 +31,7 @@
 import org.apache.mina.util.Queue;
 
 /**
- * TODO Insert type comment.
+ * An {@link IoSession} for socket transport (TCP/IP).
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSessionConfig.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSessionConfig.java?view=diff&r1=159339&r2=159340
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSessionConfig.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketSessionConfig.java Mon
Mar 28 17:40:25 2005
@@ -22,10 +22,16 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.SessionConfig;
+import org.apache.mina.io.IoSession;
+import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.util.BasicSessionConfig;
 
 /**
  * A {@link SessionConfig} for socket transport (TCP/IP).
+ * You can downcast {@link SessionConfig} instance returned by
+ * {@link IoSession#getConfig()} or {@link ProtocolSession#getConfig()}
+ * if you've created datagram session using {@link SocketAcceptor} or 
+ * {@link SocketConnector}.
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,



Mime
View raw message