You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/04/15 15:49:43 UTC

svn commit: r161459 - directory/network/trunk/src/java/org/apache/mina/protocol/codec

Author: trustin
Date: Fri Apr 15 06:49:42 2005
New Revision: 161459

URL: http://svn.apache.org/viewcvs?view=rev&rev=161459
Log:
* Updated JavaDoc for MessageCodecFactory and its friends.
* Separated MessageDecoder.DecodeResult to MessageDecoderResult

Added:
    directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java   (with props)
Modified:
    directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageCodecFactory.java
    directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoder.java
    directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageEncoder.java

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageCodecFactory.java?view=diff&r1=161458&r2=161459
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageCodecFactory.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageCodecFactory.java Fri Apr 15 06:49:42 2005
@@ -32,7 +32,6 @@
 import org.apache.mina.protocol.ProtocolEncoderOutput;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
-import org.apache.mina.protocol.codec.MessageDecoder.DecodeResult;
 
 /**
  * A composite {@link ProtocolCodecFactory} that consists of multiple
@@ -169,7 +168,7 @@
                     MessageDecoder decoder = decoders[i];
                     int limit = in.limit();
                     in.position( 0 );
-                    DecodeResult result = decoder.decodable( session, in );
+                    MessageDecoderResult result = decoder.decodable( session, in );
                     in.position( 0 );
                     in.limit( limit );
                     
@@ -203,7 +202,7 @@
                 }
             }
             
-            DecodeResult result = currentDecoder.decode( session, in, out );
+            MessageDecoderResult result = currentDecoder.decode( session, in, out );
             if( result == MessageDecoder.OK )
             {
                 currentDecoder = null;

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoder.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoder.java?view=diff&r1=161458&r2=161459
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoder.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoder.java Fri Apr 15 06:49:42 2005
@@ -29,6 +29,8 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
+ * 
+ * @see MessageCodecFactory
  */
 public interface MessageDecoder {
     /**
@@ -36,21 +38,21 @@
      * {@link #decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.  Please
      * refer to each method's documentation for detailed explanation.
      */
-    static DecodeResult OK = new DecodeResult( "OK" );
+    static MessageDecoderResult OK = MessageDecoderResult.OK;
 
     /**
      * Represents a result from {@link #decodable(ProtocolSession, ByteBuffer)} and
      * {@link #decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.  Please
      * refer to each method's documentation for detailed explanation.
      */
-    static DecodeResult NEED_DATA = new DecodeResult( "NEED_DATA" );
+    static MessageDecoderResult NEED_DATA = MessageDecoderResult.NEED_DATA;
 
     /**
      * Represents a result from {@link #decodable(ProtocolSession, ByteBuffer)} and
      * {@link #decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.  Please
      * refer to each method's documentation for detailed explanation.
      */
-    static DecodeResult NOT_OK = new DecodeResult( "NOT_OK" );
+    static MessageDecoderResult NOT_OK = MessageDecoderResult.NOT_OK;
     
     /**
      * Checks the specified buffer is decodable by this decoder.
@@ -61,7 +63,7 @@
      *         specified buffer is decodable ({@link #OK}) or not decodable
      *         {@link #NOT_OK}.
      */
-    DecodeResult decodable( ProtocolSession session, ByteBuffer in );
+    MessageDecoderResult decodable( ProtocolSession session, ByteBuffer in );
     
     /**
      * Decodes binary or protocol-specific content into higher-level message objects.
@@ -76,24 +78,6 @@
      * @throws ProtocolViolationException if the read data violated protocol
      *                                    specification 
      */
-    DecodeResult decode( ProtocolSession session, ByteBuffer in,
+    MessageDecoderResult decode( ProtocolSession session, ByteBuffer in,
                          ProtocolDecoderOutput out ) throws ProtocolViolationException;
-    
-    /**
-     * Enumeration type  for decoding results.
-     */
-    public class DecodeResult
-    {
-        private final String name;
-
-        private DecodeResult( String name )
-        {
-            this.name = name;
-        }
-        
-        public String toString()
-        {
-            return name;
-        }
-    }
 }

Added: directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java?view=auto&rev=161459
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java (added)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java Fri Apr 15 06:49:42 2005
@@ -0,0 +1,68 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.protocol.codec;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.protocol.ProtocolDecoderOutput;
+import org.apache.mina.protocol.ProtocolSession;
+
+/**
+ * Represents results from {@link MessageDecoder}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$
+ * 
+ * @see MessageDecoder
+ */
+public class MessageDecoderResult
+{
+    /**
+     * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)}
+     * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.
+     * Please refer to each method's documentation for detailed explanation.
+     */
+    public static MessageDecoderResult OK = new MessageDecoderResult( "OK" );
+
+    /**
+     * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)}
+     * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.
+     * Please refer to each method's documentation for detailed explanation.
+     */
+    public static MessageDecoderResult NEED_DATA = new MessageDecoderResult( "NEED_DATA" );
+
+    /**
+     * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)}
+     * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}.
+     * Please refer to each method's documentation for detailed explanation.
+     */
+    public static MessageDecoderResult NOT_OK = new MessageDecoderResult( "NOT_OK" );
+
+    private final String name;
+
+    private MessageDecoderResult( String name )
+    {
+        this.name = name;
+    }
+    
+    public String toString()
+    {
+        return name;
+    }
+}
\ No newline at end of file

Propchange: directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageDecoderResult.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageEncoder.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageEncoder.java?view=diff&r1=161458&r2=161459
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageEncoder.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/MessageEncoder.java Fri Apr 15 06:49:42 2005
@@ -28,6 +28,8 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
+ * 
+ * @see MessageCodecFactory
  */
 public interface MessageEncoder extends ProtocolEncoder
 {