You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/10/02 15:51:27 UTC

svn commit: r581239 - in /mina/trunk: core/src/main/java/org/apache/mina/common/ core/src/main/java/org/apache/mina/filter/codec/ core/src/main/java/org/apache/mina/filter/codec/textline/ core/src/main/java/org/apache/mina/filter/ssl/ core/src/main/jav...

Author: trustin
Date: Tue Oct  2 06:51:26 2007
New Revision: 581239

URL: http://svn.apache.org/viewvc?rev=581239&view=rev
Log:
More renaming and textual replaces...


Added:
    mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslBufferUtil.java
      - copied, changed from r581234, mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslByteBufferUtil.java
    mina/trunk/core/src/test/java/org/apache/mina/common/IoBufferTest.java
      - copied, changed from r581234, mina/trunk/core/src/test/java/org/apache/mina/common/ByteBufferTest.java
Removed:
    mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslByteBufferUtil.java
    mina/trunk/core/src/test/java/org/apache/mina/common/ByteBufferTest.java
Modified:
    mina/trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java
    mina/trunk/core/src/main/java/org/apache/mina/common/IoBufferHexDumper.java
    mina/trunk/core/src/main/java/org/apache/mina/common/SimpleBufferAllocator.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecSession.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
    mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
    mina/trunk/example/src/main/java/org/apache/mina/example/httpserver/codec/ServerHandler.java
    mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyDecoder.java
    mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyEncoder.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/IoBuffer.java Tue Oct  2 06:51:26 2007
@@ -240,7 +240,7 @@
     }
 
     /**
-     * Creates a new instance of ByteBuffer.  This is an empty constructor.
+     * Creates a new instance.  This is an empty constructor.
      *
      */
     protected IoBuffer() {
@@ -1005,7 +1005,7 @@
      * not changed as a result of this method call.
      *
      * @return
-     *  hexidecimal representation of this ByteBuffer
+     *  hexidecimal representation of this buffer
      */
     public String getHexDump() {
         return this.getHexDump(Integer.MAX_VALUE);
@@ -1017,7 +1017,7 @@
      * @param lengthLimit The maximum number of bytes to dump from
      *                    the current buffer position.
      * @return
-     *  hexidecimal representation of this ByteBuffer
+     *  hexidecimal representation of this buffer
      */
     public String getHexDump(int lengthLimit) {
         return IoBufferHexDumper.getHexdump(this, lengthLimit);

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/IoBufferHexDumper.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/IoBufferHexDumper.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/IoBufferHexDumper.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/IoBufferHexDumper.java Tue Oct  2 06:51:26 2007
@@ -21,7 +21,7 @@
 
 
 /**
- * Provides utility methods for ByteBuffers.
+ * Provides utility methods for an {@link IoBuffer}.
  *
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/SimpleBufferAllocator.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/SimpleBufferAllocator.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/SimpleBufferAllocator.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/SimpleBufferAllocator.java Tue Oct  2 06:51:26 2007
@@ -42,20 +42,20 @@
         } else {
             nioBuffer = java.nio.ByteBuffer.allocate(capacity);
         }
-        return new SimpleIoBuffer(nioBuffer, true);
+        return new SimpleBuffer(nioBuffer, true);
     }
 
     public IoBuffer wrap(java.nio.ByteBuffer nioBuffer) {
-        return new SimpleIoBuffer(nioBuffer, true);
+        return new SimpleBuffer(nioBuffer, true);
     }
 
     public void dispose() {
     }
 
-    private static class SimpleIoBuffer extends AbstractIoBuffer {
+    private static class SimpleBuffer extends AbstractIoBuffer {
         private java.nio.ByteBuffer buf;
 
-        protected SimpleIoBuffer(java.nio.ByteBuffer buf,
+        protected SimpleBuffer(java.nio.ByteBuffer buf,
                 boolean autoExpandAllowed) {
             super(autoExpandAllowed);
             this.buf = buf;
@@ -90,17 +90,17 @@
 
         @Override
         protected IoBuffer duplicate0() {
-            return new SimpleIoBuffer(this.buf.duplicate(), false);
+            return new SimpleBuffer(this.buf.duplicate(), false);
         }
 
         @Override
         protected IoBuffer slice0() {
-            return new SimpleIoBuffer(this.buf.slice(), false);
+            return new SimpleBuffer(this.buf.slice(), false);
         }
 
         @Override
         protected IoBuffer asReadOnlyBuffer0() {
-            return new SimpleIoBuffer(this.buf.asReadOnlyBuffer(), false);
+            return new SimpleBuffer(this.buf.asReadOnlyBuffer(), false);
         }
 
         @Override

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java Tue Oct  2 06:51:26 2007
@@ -37,14 +37,14 @@
  * public class CrLfTerminatedCommandLineDecoder
  *         extends CumulativeProtocolDecoder {
  *
- *     private Command parseCommand(ByteBuffer in) {
+ *     private Command parseCommand(IoBuffer in) {
  *         // Convert the bytes in the specified buffer to a
  *         // Command object.
  *         ...
  *     }
  *
- *     protected boolean doDecode(IoSession session, ByteBuffer in,
- *                                ProtocolDecoderOutput out)
+ *     protected boolean doDecode(
+ *             IoSession session, IoBuffer in, ProtocolDecoderOutput out)
  *             throws Exception {
  *
  *         // Remember the initial position.

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecSession.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecSession.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecSession.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecSession.java Tue Oct  2 06:51:26 2007
@@ -40,14 +40,14 @@
  *
  * encoder.encode(session, in, session.getProtocolEncoderOutput());
  *
- * ByteBuffer buffer = session.getProtocolDecoderOutputQueue().poll();
+ * IoBuffer buffer = session.getProtocolDecoderOutputQueue().poll();
  * </pre>
  *
  * <h2>Decoding</h2>
  * <pre>
  * ProtocolCodecSession session = new ProtocolCodecSession();
  * ProtocolDecoder decoder = ...;
- * ByteBuffer in = ...;
+ * IoBuffer in = ...;
  *
  * decoder.decode(session, in, session.getProtocolDecoderOutput());
  *

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java Tue Oct  2 06:51:26 2007
@@ -195,7 +195,7 @@
     private int decodeNormal(IoBuffer in, IoBuffer buf, int matchCount,
             CharsetDecoder decoder, ProtocolDecoderOutput out)
             throws CharacterCodingException {
-        // Convert delimiter to ByteBuffer if not done yet.
+        // Convert delimiter to the buffer if not done yet.
         if (delimBuf == null) {
             IoBuffer tmp = IoBuffer.allocate(2).setAutoExpand(true);
             tmp.putString(delimiter.getValue(), charset.newEncoder());

Copied: mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslBufferUtil.java (from r581234, mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslByteBufferUtil.java)
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslBufferUtil.java?p2=mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslBufferUtil.java&p1=mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslByteBufferUtil.java&r1=581234&r2=581239&rev=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslByteBufferUtil.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslBufferUtil.java Tue Oct  2 06:51:26 2007
@@ -24,14 +24,12 @@
 import javax.net.ssl.SSLEngine;
 
 /**
- * Simple ByteBuffer pool used by SSLHandler.
- * ByteBuffers are by default allocated as direct byte buffers. To use non-direct
- * ByteBuffers, set system property mina.sslfilter.directbuffer to false.
+ * Simple buffer pool used by SSLHandler.
  *
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-class SslByteBufferUtil {
+class SslBufferUtil {
     private static final int PACKET_BUFFER_INDEX = 0;
 
     private static final int APPLICATION_BUFFER_INDEX = 1;

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java Tue Oct  2 06:51:26 2007
@@ -45,7 +45,7 @@
  * A helper class using the SSLEngine API to decrypt/encrypt data.
  * <p/>
  * Each connection has a SSLEngine that is used through the lifetime of the connection.
- * We allocate byte buffers for use as the outbound and inbound network buffers.
+ * We allocate buffers for use as the outbound and inbound network buffers.
  * These buffers handle all of the intermediary data for the SSL connection. To make things easy,
  * we'll require outNetBuffer be completely flushed before trying to wrap any more data.
  *
@@ -150,12 +150,12 @@
         handshakeComplete = false;
         initialHandshakeComplete = false;
 
-        SslByteBufferUtil.initiate(sslEngine);
+        SslBufferUtil.initiate(sslEngine);
 
-        appBuffer = SslByteBufferUtil.getApplicationBuffer();
+        appBuffer = SslBufferUtil.getApplicationBuffer();
 
-        inNetBuffer = SslByteBufferUtil.getPacketBuffer();
-        outNetBuffer = SslByteBufferUtil.getPacketBuffer();
+        inNetBuffer = SslBufferUtil.getPacketBuffer();
+        outNetBuffer = SslBufferUtil.getPacketBuffer();
         outNetBuffer.position(0);
         outNetBuffer.limit(0);
 
@@ -163,7 +163,7 @@
     }
 
     /**
-     * Release allocated ByteBuffers.
+     * Release allocated buffers.
      */
     public void destroy() {
         if (sslEngine == null) {
@@ -289,10 +289,10 @@
     public void messageReceived(NextFilter nextFilter, ByteBuffer buf) throws SSLException {
         if (buf.limit() > inNetBuffer.remaining()) {
             // We have to expand inNetBuffer
-            inNetBuffer = SslByteBufferUtil.expandBuffer(inNetBuffer,
+            inNetBuffer = SslBufferUtil.expandBuffer(inNetBuffer,
                     inNetBuffer.capacity() + buf.limit() * 2);
             // We also expand app. buffer (twice the size of in net. buffer)
-            appBuffer = SslByteBufferUtil.expandBuffer(appBuffer, inNetBuffer
+            appBuffer = SslBufferUtil.expandBuffer(appBuffer, inNetBuffer
                     .capacity() * 2);
             if (IoSessionLogger.isDebugEnabled(session)) {
                 IoSessionLogger.debug(session, " expanded inNetBuffer:"
@@ -357,7 +357,7 @@
                 // We have to expand outNetBuffer
                 // Note: there is no way to know the exact size required, but enrypted data
                 // shouln't need to be larger than twice the source data size?
-                outNetBuffer = SslByteBufferUtil.expandBuffer(outNetBuffer, src
+                outNetBuffer = SslBufferUtil.expandBuffer(outNetBuffer, src
                         .capacity() * 2);
                 if (IoSessionLogger.isDebugEnabled(session)) {
                     IoSessionLogger.debug(session, " expanded outNetBuffer:"
@@ -696,7 +696,7 @@
     }
 
     /**
-     * Creates a new Mina byte buffer that is a deep copy of the remaining bytes
+     * Creates a new MINA buffer that is a deep copy of the remaining bytes
      * in the given buffer (between index buf.position() and buf.limit())
      *
      * @param src the buffer to copy

Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/filter/stream/StreamWriteFilter.java Tue Oct  2 06:51:26 2007
@@ -102,8 +102,8 @@
 
             InputStream inputStream = (InputStream) message;
 
-            IoBuffer byteBuffer = getNextByteBuffer(inputStream);
-            if (byteBuffer == null) {
+            IoBuffer buffer = getNextBuffer(inputStream);
+            if (buffer == null) {
                 // End of stream reached.
                 writeRequest.getFuture().setWritten(true);
                 nextFilter.messageSent(session, writeRequest);
@@ -112,7 +112,7 @@
                 session.setAttribute(CURRENT_WRITE_REQUEST, writeRequest);
 
                 nextFilter.filterWrite(session, new DefaultWriteRequest(
-                        byteBuffer));
+                        buffer));
             }
 
         } else {
@@ -138,9 +138,9 @@
         if (inputStream == null) {
             nextFilter.messageSent(session, writeRequest);
         } else {
-            IoBuffer byteBuffer = getNextByteBuffer(inputStream);
+            IoBuffer buffer = getNextBuffer(inputStream);
 
-            if (byteBuffer == null) {
+            if (buffer == null) {
                 // End of stream reached.
                 session.removeAttribute(CURRENT_STREAM);
                 WriteRequest currentWriteRequest = (WriteRequest) session
@@ -160,12 +160,12 @@
                 nextFilter.messageSent(session, currentWriteRequest);
             } else {
                 nextFilter.filterWrite(session, new DefaultWriteRequest(
-                        byteBuffer));
+                        buffer));
             }
         }
     }
 
-    private IoBuffer getNextByteBuffer(InputStream is) throws IOException {
+    private IoBuffer getNextBuffer(InputStream is) throws IOException {
         byte[] bytes = new byte[writeBufferSize];
 
         int off = 0;

Copied: mina/trunk/core/src/test/java/org/apache/mina/common/IoBufferTest.java (from r581234, mina/trunk/core/src/test/java/org/apache/mina/common/ByteBufferTest.java)
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/common/IoBufferTest.java?p2=mina/trunk/core/src/test/java/org/apache/mina/common/IoBufferTest.java&p1=mina/trunk/core/src/test/java/org/apache/mina/common/ByteBufferTest.java&r1=581234&r2=581239&rev=581239&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/common/ByteBufferTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/common/IoBufferTest.java Tue Oct  2 06:51:26 2007
@@ -40,10 +40,10 @@
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class ByteBufferTest extends TestCase {
+public class IoBufferTest extends TestCase {
 
     public static void main(String[] args) {
-        junit.textui.TestRunner.run(ByteBufferTest.class);
+        junit.textui.TestRunner.run(IoBufferTest.class);
     }
 
     @Override

Modified: mina/trunk/example/src/main/java/org/apache/mina/example/httpserver/codec/ServerHandler.java
URL: http://svn.apache.org/viewvc/mina/trunk/example/src/main/java/org/apache/mina/example/httpserver/codec/ServerHandler.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/example/src/main/java/org/apache/mina/example/httpserver/codec/ServerHandler.java (original)
+++ mina/trunk/example/src/main/java/org/apache/mina/example/httpserver/codec/ServerHandler.java Tue Oct  2 06:51:26 2007
@@ -49,7 +49,7 @@
 
         // msg.setResponseCode(HttpResponseMessage.HTTP_STATUS_SUCCESS);
         // byte[] b = new byte[ta.buffer.limit()];
-        // ((ByteBuffer)ta.buffer.rewind()).get(b);
+        // ta.buffer.rewind().get(b);
         // msg.appendBody(b);
         // System.out.println("####################");
         // System.out.println("  GET_TILE RESPONSE SENT - ATTACHMENT GOOD DIAMOND.SI="+d.si+

Modified: mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyDecoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyDecoder.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyDecoder.java (original)
+++ mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyDecoder.java Tue Oct  2 06:51:26 2007
@@ -31,7 +31,7 @@
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
 
 /**
- * A MINA {@link ProtocolDecoder} that decodes byte buffers into
+ * A MINA {@link ProtocolDecoder} that decodes buffers into
  * Netty2 {@link Message}s using specified {@link MessageRecognizer}s.
  *
  * @author The Apache MINA Project (dev@mina.apache.org)

Modified: mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyEncoder.java
URL: http://svn.apache.org/viewvc/mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyEncoder.java?rev=581239&r1=581238&r2=581239&view=diff
==============================================================================
--- mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyEncoder.java (original)
+++ mina/trunk/filter-codec-netty/src/main/java/org/apache/mina/filter/codec/netty/NettyEncoder.java Tue Oct  2 06:51:26 2007
@@ -29,7 +29,7 @@
 
 /**
  * A MINA <tt>ProtocolEncoder</tt> that encodes Netty2 {@link Message}s
- * into byte buffers.
+ * into buffers.
  *
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$,