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/11/04 09:20:13 UTC
svn commit: r330747 - in /directory: asn1/trunk/codec/
asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/
asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/ network/trunk/
Author: trustin
Date: Fri Nov 4 00:20:06 2005
New Revision: 330747
URL: http://svn.apache.org/viewcvs?rev=330747&view=rev
Log:
Related issue: DIR-114 Migrate all protocol providers to MINA 0.9.
* Migrated ASN1 to MINA 0.9
* Fixed a missing zero in MINA POM
Modified:
directory/asn1/trunk/codec/project.xml
directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecDecoder.java
directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecEncoder.java
directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/StringUtils.java
directory/network/trunk/pom.xml
Modified: directory/asn1/trunk/codec/project.xml
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/codec/project.xml?rev=330747&r1=330746&r2=330747&view=diff
==============================================================================
--- directory/asn1/trunk/codec/project.xml (original)
+++ directory/asn1/trunk/codec/project.xml Fri Nov 4 00:20:06 2005
@@ -20,7 +20,7 @@
<dependency>
<groupId>directory-network</groupId>
<artifactId>mina</artifactId>
- <version>0.8.0</version>
+ <version>0.9.0-SNAPSHOT</version>
<type>jar</type>
<url>http://directory.apache.org/subprojects/network/mina/</url>
</dependency>
Modified: directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecDecoder.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecDecoder.java?rev=330747&r1=330746&r2=330747&view=diff
==============================================================================
--- directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecDecoder.java (original)
+++ directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecDecoder.java Fri Nov 4 00:20:06 2005
@@ -7,10 +7,9 @@
import org.apache.asn1.codec.stateful.DecoderCallback;
import org.apache.asn1.codec.stateful.StatefulDecoder;
import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.protocol.ProtocolDecoder;
-import org.apache.mina.protocol.ProtocolDecoderOutput;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.ProtocolViolationException;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
/**
* Adapts {@link StatefulDecoder} to MINA <tt>ProtocolDecoder</tt>
@@ -31,19 +30,15 @@
this.decoder = decoder;
}
- public void decode( ProtocolSession session, ByteBuffer in,
- ProtocolDecoderOutput out )
- throws ProtocolViolationException
+ public void decode( IoSession session, ByteBuffer in,
+ ProtocolDecoderOutput out ) throws DecoderException
{
callback.decOut = out;
- try
- {
- decoder.decode( in.buf() );
- }
- catch( DecoderException e )
- {
- throw new ProtocolViolationException( "Failed to decode.", e );
- }
+ decoder.decode( in.buf() );
+ }
+
+ public void dispose( IoSession session ) throws Exception
+ {
}
private class DecoderCallbackImpl implements DecoderCallback
Modified: directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecEncoder.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecEncoder.java?rev=330747&r1=330746&r2=330747&view=diff
==============================================================================
--- directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecEncoder.java (original)
+++ directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/mina/Asn1CodecEncoder.java Fri Nov 4 00:20:06 2005
@@ -11,10 +11,9 @@
import org.apache.asn1.codec.stateful.EncoderCallback;
import org.apache.asn1.codec.stateful.StatefulEncoder;
import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.protocol.ProtocolEncoder;
-import org.apache.mina.protocol.ProtocolEncoderOutput;
-import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.ProtocolViolationException;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
/**
* Adapts {@link StatefulEncoder} to MINA <tt>ProtocolEncoder</tt>
@@ -34,19 +33,15 @@
this.encoder = encoder;
}
- public void encode( ProtocolSession session, Object message,
- ProtocolEncoderOutput out )
- throws ProtocolViolationException
+ public void encode( IoSession session, Object message,
+ ProtocolEncoderOutput out ) throws EncoderException
{
callback.encOut = out;
- try
- {
- encoder.encode( message );
- }
- catch( EncoderException e )
- {
- throw new ProtocolViolationException( "Encoding failed.", e );
- }
+ encoder.encode( message );
+ }
+
+ public void dispose( IoSession session ) throws Exception
+ {
}
private class EncoderCallbackImpl implements EncoderCallback
Modified: directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/StringUtils.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/StringUtils.java?rev=330747&r1=330746&r2=330747&view=diff
==============================================================================
--- directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/StringUtils.java (original)
+++ directory/asn1/trunk/codec/src/main/java/org/apache/asn1/codec/util/StringUtils.java Fri Nov 4 00:20:06 2005
@@ -140,7 +140,7 @@
/**
* Helper function that dump an array of bytes in hex form
*
- * @param octet The bytes array to dump
+ * @param buffer The bytes array to dump
* @return A string representation of the array of bytes
*/
public static String dumpBytes( byte[] buffer )
@@ -252,7 +252,7 @@
* @param chars The char array to decode
* @return The number of bytes in the char array
*/
- public static int countBytes(char[] chars) throws UnsupportedEncodingException
+ public static int countBytes(char[] chars)
{
int nbBytes = 0;
int currentPos = 0;
@@ -274,7 +274,6 @@
* Return the Unicode char which is coded in the bytes at the given position.
* @param bytes The byte[] represntation of an Unicode string.
* @param pos The current position to start decoding the char
- * @return The char found.
* @return The decoded char, or -1 if no char can be decoded
*
* TODO : Should stop after the third byte, as a char is only 2 bytes long.
@@ -442,7 +441,7 @@
/**
* Check if a text is present at the current position in a buffer.
*
- * @param byteArray The buffer which contains the data
+ * @param charArray The buffer which contains the data
* @param index Current position in the buffer
* @param text The text we want to check
*
@@ -564,7 +563,7 @@
* Test if the current character is equal to a specific character.
*
*
- * @param byteArray The buffer which contains the data
+ * @param chars The buffer which contains the data
* @param index Current position in the buffer
* @param car The character we want to compare with the current buffer position
*
@@ -753,7 +752,7 @@
* Test if the current character is a digit
* <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
*
- * @param byteArray The buffer which contains the data
+ * @param chars The buffer which contains the data
* @param index Current position in the buffer
*
* @return <code>true</code> if the current character is a Digit
@@ -775,7 +774,7 @@
* Test if the current character is a digit
* <digit> ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
*
- * @param byteArray The buffer which contains the data
+ * @param chars The buffer which contains the data
*
* @return <code>true</code> if the current character is a Digit
*/
@@ -1129,7 +1128,7 @@
* StringUtils.trimRight(" abc ") = " abc"
* </pre>
*
- * @param chars the chars array to be trimmed, may be null
+ * @param bytes the chars array to be trimmed, may be null
* @return the position of the first char which is not a space,
* or the last position of the array.
*/
@@ -1236,8 +1235,8 @@
/**
* Return an UTF-8 encoded String
- * @param bytes The byte array to be transformed to a String
- * @return A String.
+ * @param string The string to be transformed to a byte array
+ * @return The transformed byte array
*/
public static byte[] getBytesUtf8( String string )
{
Modified: directory/network/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/directory/network/trunk/pom.xml?rev=330747&r1=330746&r2=330747&view=diff
==============================================================================
--- directory/network/trunk/pom.xml (original)
+++ directory/network/trunk/pom.xml Fri Nov 4 00:20:06 2005
@@ -6,7 +6,7 @@
<groupId>org.apache.directory.network</groupId>
<artifactId>mina</artifactId>
<name>MINA</name>
- <version>0.9-SNAPSHOT</version>
+ <version>0.9.0-SNAPSHOT</version>
<inceptionYear>2004</inceptionYear>
<url>http://directory.apache.org/subprojects/network/</url>