You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2010/12/15 02:20:42 UTC
svn commit: r1049374 [2/3] - in /directory:
apacheds/branches/alex_refactoring/
apacheds/branches/alex_refactoring/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/
apacheds/branches/alex_refactoring/kerberos-codec/src/ma...
Modified: directory/shared/branches/alex_refactoring/ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/pom.xml?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/pom.xml (original)
+++ directory/shared/branches/alex_refactoring/ldap/pom.xml Wed Dec 15 01:20:38 2010
@@ -43,6 +43,21 @@
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shared-asn1-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shared-asn1-ber</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>shared-util</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
</dependency>
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java Wed Dec 15 01:20:38 2010
@@ -20,13 +20,13 @@
package org.apache.directory.shared.asn1.actions;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.asn1.DecoderException;
import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoder.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java Wed Dec 15 01:20:38 2010
@@ -17,10 +17,9 @@
* under the License.
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +50,7 @@ public final class BooleanDecoder
*
* @param value The byte buffer to parse
* @return A boolean.
- * @throws BooleanDecoderException Thrown if the byte stream does not contains a boolean
+ * @throws org.apache.directory.shared.asn1.ber.tlv.BooleanDecoderException Thrown if the byte stream does not contains a boolean
*/
public static boolean parse( Value value ) throws BooleanDecoderException
{
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Dec 15 01:20:38 2010
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/BooleanDecoderException.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java Wed Dec 15 01:20:38 2010
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
/**
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/BooleanDecoderException.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Dec 15 01:20:38 2010
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoder.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java Wed Dec 15 01:20:38 2010
@@ -17,10 +17,9 @@
* under the License.
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
@@ -53,7 +52,7 @@ public final class IntegerDecoder
* @param min Lowest value allowed, included
* @param max Highest value allowed, included
* @return An integer
- * @throws IntegerDecoderException Thrown if the byte stream does not contains an integer
+ * @throws org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException Thrown if the byte stream does not contains an integer
*/
public static int parse( Value value, int min, int max ) throws IntegerDecoderException
{
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Dec 15 01:20:38 2010
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/IntegerDecoderException.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java Wed Dec 15 01:20:38 2010
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
/**
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/IntegerDecoderException.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Dec 15 01:20:38 2010
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoder.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoder.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoder.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoder.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoder.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoder.java Wed Dec 15 01:20:38 2010
@@ -17,10 +17,9 @@
* under the License.
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.i18n.I18n;
@@ -54,7 +53,7 @@ public final class LongDecoder
* @param min Lowest value allowed, included
* @param max Highest value allowed, included
* @return An integer
- * @throws LongDecoderException Thrown if the byte stream does not contains an integer
+ * @throws org.apache.directory.shared.asn1.ber.tlv.LongDecoderException Thrown if the byte stream does not contains an integer
*/
public static long parse( Value value, long min, long max ) throws LongDecoderException
{
Copied: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoderException.java (from r1049361, directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoderException.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoderException.java?p2=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoderException.java&p1=directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoderException.java&r1=1049361&r2=1049374&rev=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/util/LongDecoderException.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/LongDecoderException.java Wed Dec 15 01:20:38 2010
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.shared.asn1.util;
+package org.apache.directory.shared.asn1.ber.tlv;
/**
Added: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java?rev=1049374&view=auto
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java (added)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java Wed Dec 15 01:20:38 2010
@@ -0,0 +1,935 @@
+/*
+ * 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.directory.shared.asn1.ber.tlv;
+
+
+import java.io.Serializable;
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.util.BitString;
+import org.apache.directory.shared.asn1.util.OID;
+import org.apache.directory.shared.asn1.util.Asn1StringUtils;
+import org.apache.directory.shared.i18n.I18n;
+
+
+/**
+ * This class stores the data decoded from a TLV.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class Value implements Serializable
+{
+ /** The serialVersion UID */
+ private static final long serialVersionUID = 1L;
+
+ /** The data buffer. */
+ private byte[] data;
+
+ /** The current position of the last byte in the data buffer */
+ private int currentPos;
+
+ /** The encoded byte for a TRUE value */
+ public static final byte TRUE_VALUE = ( byte ) 0xFF;
+
+ /** The encoded byte for a FALSE value */
+ public static final byte FALSE_VALUE = ( byte ) 0x00;
+
+ /** Pre-encoded PDUs for a TRUE TLV */
+ private static final byte[] ENCODED_TRUE = new byte[]
+ { 0x01, 0x01, TRUE_VALUE };
+
+ /** Pre-encoded PDUs for a FALSE TLV */
+ private static final byte[] ENCODED_FALSE = new byte[]
+ { 0x01, 0x01, FALSE_VALUE };
+
+ /** Integer limits for encoding : 0x7F */
+ private static final int ONE_BYTE_MAX = ( 1 << 7 ) - 1;
+
+ /** Integer limits for encoding : -0x7F */
+ private static final int ONE_BYTE_MIN = -( 1 << 7 );
+
+ /** Integer limits for encoding : 0x7FFF */
+ private static final int TWO_BYTE_MAX = ( 1 << 15 ) - 1;
+
+ /** Integer limits for encoding : -0x7FFF */
+ private static final int TWO_BYTE_MIN = -( 1 << 15 );
+
+ /** Integer limits for encoding : 0x7FFFFF */
+ private static final int THREE_BYTE_MAX = ( 1 << 23 ) - 1;
+
+ /** Integer limits for encoding : -0x7FFFFF */
+ private static final int THREE_BYTE_MIN = -( 1 << 23 );
+
+ /** Integer limits for encoding : 0x7FFFFFFF */
+ private static final long FOUR_BYTE_MAX = ( 1L << 31 ) - 1L;
+
+ /** Integer limits for encoding : -0x7FFFFFFF */
+ private static final long FOUR_BYTE_MIN = -( 1L << 31 );
+
+ /** Integer limits for encoding : 0x7FFFFFFFFF */
+ private static final long FIVE_BYTE_MAX = ( 1L << 39 ) - 1L;
+
+ /** Integer limits for encoding : -0x7FFFFFFFFF */
+ private static final long FIVE_BYTE_MIN = -( 1L << 39 );
+
+ /** Integer limits for encoding : 0x7FFFFFFFFFFF */
+ private static final long SIX_BYTE_MAX = ( 1L << 47 ) - 1L;
+
+ /** Integer limits for encoding : -0x7FFFFFFFFFFF */
+ private static final long SIX_BYTE_MIN = -( 1L << 47 );
+
+ /** Integer limits for encoding : 0x7FFFFFFFFFFF */
+ private static final long SEVEN_BYTE_MAX = ( 1L << 55 ) - 1L;
+
+ /** Integer limits for encoding : -0x7FFFFFFFFFFF */
+ private static final long SEVEN_BYTE_MIN = -( 1L << 55 );
+
+
+ /**
+ * Creates a new Value from a byte[]
+ *
+ * @param value the associated value
+ */
+ public Value( byte[] value )
+ {
+ // Do a copy of the byte array
+ data = new byte[value.length];
+ System.arraycopy( value, 0, data, 0, value.length );
+ currentPos = 0;
+ }
+
+
+ /**
+ * The default constructor.
+ */
+ public Value()
+ {
+ data = null;
+ currentPos = 0;
+ }
+
+
+ /**
+ * Initialize the Value
+ *
+ * @param size The data size to allocate.
+ */
+ public void init( int size )
+ {
+ data = new byte[size];
+ currentPos = 0;
+ }
+
+
+ /**
+ * Reset the Value so that it can be reused
+ */
+ public void reset()
+ {
+ data = null;
+ currentPos = 0;
+ }
+
+
+ /**
+ * Get the Values'data
+ *
+ * @return Returns the data.
+ */
+ public byte[] getData()
+ {
+ return data;
+ }
+
+
+ /**
+ * Set a block of bytes in the Value
+ *
+ * @param data The data to set.
+ */
+ public void setData( ByteBuffer data )
+ {
+ int length = data.remaining();
+ data.get( this.data, 0, length );
+ currentPos = length;
+ }
+
+
+ /**
+ * Append some bytes to the data buffer.
+ *
+ * @param buffer The data to append.
+ */
+ public void addData( ByteBuffer buffer )
+ {
+ int length = buffer.remaining();
+ buffer.get( data, currentPos, length );
+ currentPos += length;
+ }
+
+
+ /**
+ * Set a block of bytes in the Value
+ *
+ * @param data The data to set.
+ */
+ public void setData( byte[] data )
+ {
+ System.arraycopy( data, 0, this.data, 0, data.length );
+ currentPos = data.length;
+ }
+
+
+ /**
+ * Append some bytes to the data buffer.
+ *
+ * @param array The data to append.
+ */
+ public void addData( byte[] array )
+ {
+ System.arraycopy( array, 0, this.data, currentPos, array.length );
+ currentPos = array.length;
+ }
+
+
+ /**
+ * @return The number of bytes actually stored
+ */
+ public int getCurrentLength()
+ {
+ return currentPos;
+ }
+
+
+ /**
+ * Utility function that return the number of bytes necessary to store an
+ * integer value. Note that this value must be in [Integer.MIN_VALUE,
+ * Integer.MAX_VALUE].
+ *
+ * @param value The value to store in a byte array
+ * @return The number of bytes necessary to store the value.
+ */
+ public static int getNbBytes( int value )
+ {
+ if ( value >= ONE_BYTE_MIN && value <= ONE_BYTE_MAX )
+ {
+ return 1;
+ }
+ else if ( value >= TWO_BYTE_MIN && value <= TWO_BYTE_MAX )
+ {
+ return 2;
+ }
+ else if ( value >= THREE_BYTE_MIN && value <= THREE_BYTE_MAX )
+ {
+ return 3;
+ }
+ else
+ {
+ return 4;
+ }
+ }
+
+
+ /**
+ * Utility function that return the number of bytes necessary to store a
+ * long value. Note that this value must be in [Long.MIN_VALUE,
+ * Long.MAX_VALUE].
+ *
+ * @param value The value to store in a byte array
+ * @return The number of bytes necessary to store the value.
+ */
+ public static int getNbBytes( long value )
+ {
+ if ( value >= ONE_BYTE_MIN && value <= ONE_BYTE_MAX )
+ {
+ return 1;
+ }
+ else if ( value >= TWO_BYTE_MIN && value <= TWO_BYTE_MAX )
+ {
+ return 2;
+ }
+ else if ( value >= THREE_BYTE_MIN && value <= THREE_BYTE_MAX )
+ {
+ return 3;
+ }
+ else if ( value >= FOUR_BYTE_MIN && value <= FOUR_BYTE_MAX )
+ {
+ return 4;
+ }
+ else if ( value >= FIVE_BYTE_MIN && value <= FIVE_BYTE_MAX )
+ {
+ return 5;
+ }
+ else if ( value >= SIX_BYTE_MIN && value <= SIX_BYTE_MAX )
+ {
+ return 6;
+ }
+ else if ( value >= SEVEN_BYTE_MIN && value <= SEVEN_BYTE_MAX )
+ {
+ return 7;
+ }
+ else
+ {
+ return 8;
+ }
+ }
+
+
+ /**
+ * Utility function that return a byte array representing the Value We must
+ * respect the ASN.1 BER encoding scheme :
+ * 1) positive integer
+ * - [0 - 0x7F] : 0xVV
+ * - [0x80 - 0xFF] : 0x00 0xVV
+ * - [0x0100 - 0x7FFF] : 0xVV 0xVV
+ * - [0x8000 - 0xFFFF] : 0x00 0xVV 0xVV
+ * - [0x010000 - 0x7FFFFF] : 0xVV 0xVV 0xVV
+ * - [0x800000 - 0xFFFFFF] : 0x00 0xVV 0xVV 0xVV
+ * - [0x01000000 - 0x7FFFFFFF] : 0xVV 0xVV 0xVV 0xVV
+ * 2) Negative number - (~value) + 1
+ *
+ * @param value The value to store in a byte array
+ * @return The byte array representing the value.
+ */
+ public static byte[] getBytes( int value )
+ {
+ byte[] bytes = null;
+
+ if ( value >= 0 )
+ {
+ if ( ( value >= 0 ) && ( value <= ONE_BYTE_MAX ) )
+ {
+ bytes = new byte[1];
+ bytes[0] = ( byte ) value;
+ }
+ else if ( ( value > ONE_BYTE_MAX ) && ( value <= TWO_BYTE_MAX ) )
+ {
+ bytes = new byte[2];
+ bytes[1] = ( byte ) value;
+ bytes[0] = ( byte ) ( value >> 8 );
+ }
+ else if ( ( value > TWO_BYTE_MAX ) && ( value <= THREE_BYTE_MAX ) )
+ {
+ bytes = new byte[3];
+ bytes[2] = ( byte ) value;
+ bytes[1] = ( byte ) ( value >> 8 );
+ bytes[0] = ( byte ) ( value >> 16 );
+ }
+ else
+ {
+ bytes = new byte[4];
+ bytes[3] = ( byte ) value;
+ bytes[2] = ( byte ) ( value >> 8 );
+ bytes[1] = ( byte ) ( value >> 16 );
+ bytes[0] = ( byte ) ( value >> 24 );
+ }
+ }
+ else
+ {
+ // On special case : 0x80000000
+ if ( value == 0x80000000 )
+ {
+ bytes = new byte[4];
+ bytes[3] = ( byte ) value;
+ bytes[2] = ( byte ) ( value >> 8 );
+ bytes[1] = ( byte ) ( value >> 16 );
+ bytes[0] = ( byte ) ( value >> 24 );
+ }
+ else
+ {
+ // We have to compute the complement, and add 1
+ //value = ( ~value ) + 1;
+
+ if ( value >= 0xFFFFFF80 )
+ {
+ bytes = new byte[1];
+ bytes[0] = ( byte ) value;
+ }
+ else if ( value >= 0xFFFF8000 )
+ {
+ bytes = new byte[2];
+ bytes[1] = ( byte ) ( value );
+ bytes[0] = ( byte ) ( value >> 8 );
+ }
+ else if ( value >= 0xFF800000 )
+ {
+ bytes = new byte[3];
+ bytes[2] = ( byte ) value;
+ bytes[1] = ( byte ) ( value >> 8 );
+ bytes[0] = ( byte ) ( value >> 16 );
+ }
+ else
+ {
+ bytes = new byte[4];
+ bytes[3] = ( byte ) value;
+ bytes[2] = ( byte ) ( value >> 8 );
+ bytes[1] = ( byte ) ( value >> 16 );
+ bytes[0] = ( byte ) ( value >> 24 );
+ }
+ }
+ }
+
+ return bytes;
+ }
+
+
+ /**
+ * Utility function that return a byte array representing the Value.
+ * We must respect the ASN.1 BER encoding scheme : <br>
+ * 1) positive integer <br>
+ * - [0 - 0x7F] : 0xVV <br>
+ * - [0x80 - 0xFF] : 0x00 0xVV <br>
+ * - [0x0100 - 0x7FFF] : 0xVV 0xVV <br>
+ * - [0x8000 - 0xFFFF] : 0x00 0xVV 0xVV <br>
+ * - [0x010000 - 0x7FFFFF] : 0xVV 0xVV 0xVV <br>
+ * - [0x800000 - 0xFFFFFF] : 0x00 0xVV 0xVV 0xVV <br>
+ * - [0x01000000 - 0x7FFFFFFF] : 0xVV 0xVV 0xVV 0xVV <br>
+ * 2) Negative number - (~value) + 1 <br>
+ * They are encoded following the table (the <br>
+ * encode bytes are those enclosed by squared braquets) :<br>
+ * <br>
+ * -1 -> FF FF FF FF FF FF FF [FF]<br>
+ * -127 -> FF FF FF FF FF FF FF [81]<br>
+ * -128 -> FF FF FF FF FF FF FF [80]<br>
+ * -129 -> FF FF FF FF FF FF [FF 7F]<br>
+ * -255 -> FF FF FF FF FF FF [FF 01]<br>
+ * -256 -> FF FF FF FF FF FF [FF 00]<br>
+ * -257 -> FF FF FF FF FF FF [FE FF]<br>
+ * -32767 -> FF FF FF FF FF FF [80 01]<br>
+ * -32768 -> FF FF FF FF FF FF [80 00]<br>
+ * -32769 -> FF FF FF FF FF [FF 7F FF]<br>
+ * -65535 -> FF FF FF FF FF [FF 00 01]<br>
+ * -65536 -> FF FF FF FF FF [FF 00 00]<br>
+ * -65537 -> FF FF FF FF FF [FE FF FF]<br>
+ * -8388607 -> FF FF FF FF FF [80 00 01]<br>
+ * -8388608 -> FF FF FF FF FF [80 00 00]<br>
+ * -8388609 -> FF FF FF FF [FF 7F FF FF]<br>
+ * -16777215 -> FF FF FF FF [FF 00 00 01]<br>
+ * -16777216 -> FF FF FF FF [FF 00 00 00]<br>
+ * -16777217 -> FF FF FF FF [FE FF FF FF]<br>
+ * -2147483647 -> FF FF FF FF [80 00 00 01]<br>
+ * -2147483648 -> FF FF FF FF [80 00 00 00]<br>
+ * -2147483649 -> FF FF FF [FF 7F FF FF FF]<br>
+ * -4294967295 -> FF FF FF [FF 00 00 00 01]<br>
+ * -4294967296 -> FF FF FF [FF 00 00 00 00]<br>
+ * -4294967297 -> FF FF FF [FE FF FF FF FF]<br>
+ * -549755813887 -> FF FF FF [80 00 00 00 01]<br>
+ * -549755813888 -> FF FF FF [80 00 00 00 00]<br>
+ * -549755813889 -> FF FF [FF 7F FF FF FF FF]<br>
+ * -1099511627775 -> FF FF [FF 00 00 00 00 01]<br>
+ * -1099511627776 -> FF FF [FF 00 00 00 00 00]<br>
+ * -1099511627777 -> FF FF [FE FF FF FF FF FF]<br>
+ * -140737488355327 -> FF FF [80 00 00 00 00 01]<br>
+ * -140737488355328 -> FF FF [80 00 00 00 00 00]<br>
+ * -140737488355329 -> FF [FF 7F FF FF FF FF FF]<br>
+ * -281474976710655 -> FF [FF 00 00 00 00 00 01]<br>
+ * -281474976710656 -> FF [FF 00 00 00 00 00 00]<br>
+ * -281474976710657 -> FF [FE FF FF FF FF FF FF]<br>
+ * -36028797018963967 -> FF [80 00 00 00 00 00 01]<br>
+ * -36028797018963968 -> FF [80 00 00 00 00 00 00]<br>
+ * -36028797018963969 -> [FF 7F FF FF FF FF FF FF]<br>
+ * -72057594037927935 -> [FF 00 00 00 00 00 00 01]<br>
+ * -72057594037927936 -> [FF 00 00 00 00 00 00 00]<br>
+ * -72057594037927937 -> [FE FF FF FF FF FF FF FF]<br>
+ * -9223372036854775807 -> [80 00 00 00 00 00 00 01]<br>
+ * -9223372036854775808 -> [80 00 00 00 00 00 00 00]<br>
+ *
+ * @param value The value to store in a byte array
+ * @return The byte array representing the value.
+ */
+ public static byte[] getBytes( long value )
+ {
+ byte[] bytes = null;
+
+ if ( value >= 0 )
+ {
+ if ( ( value >= 0 ) && ( value <= ONE_BYTE_MAX ) )
+ {
+ bytes = new byte[1];
+ bytes[0] = ( byte ) value;
+ }
+ else if ( ( value > ONE_BYTE_MAX ) && ( value <= TWO_BYTE_MAX ) )
+ {
+ bytes = new byte[2];
+ bytes[1] = ( byte ) value;
+ bytes[0] = ( byte ) ( value >> 8 );
+ }
+ else if ( ( value > TWO_BYTE_MAX ) && ( value <= THREE_BYTE_MAX ) )
+ {
+ bytes = new byte[3];
+ bytes[2] = ( byte ) value;
+ bytes[1] = ( byte ) ( value >> 8 );
+ bytes[0] = ( byte ) ( value >> 16 );
+ }
+ else if ( ( value > THREE_BYTE_MAX ) && ( value <= FOUR_BYTE_MAX ) )
+ {
+ bytes = new byte[4];
+ bytes[3] = ( byte ) value;
+ bytes[2] = ( byte ) ( value >> 8 );
+ bytes[1] = ( byte ) ( value >> 16 );
+ bytes[0] = ( byte ) ( value >> 24 );
+ }
+ else if ( ( value > FOUR_BYTE_MAX ) && ( value <= FIVE_BYTE_MAX ) )
+ {
+ bytes = new byte[5];
+ bytes[4] = ( byte ) value;
+ bytes[3] = ( byte ) ( value >> 8 );
+ bytes[2] = ( byte ) ( value >> 16 );
+ bytes[1] = ( byte ) ( value >> 24 );
+ bytes[0] = ( byte ) ( value >> 32 );
+ }
+ else if ( ( value > FIVE_BYTE_MAX ) && ( value <= SIX_BYTE_MAX ) )
+ {
+ bytes = new byte[6];
+ bytes[5] = ( byte ) value;
+ bytes[4] = ( byte ) ( value >> 8 );
+ bytes[3] = ( byte ) ( value >> 16 );
+ bytes[2] = ( byte ) ( value >> 24 );
+ bytes[1] = ( byte ) ( value >> 32 );
+ bytes[0] = ( byte ) ( value >> 40 );
+ }
+ else if ( ( value > SIX_BYTE_MAX ) && ( value <= SEVEN_BYTE_MAX ) )
+ {
+ bytes = new byte[7];
+ bytes[6] = ( byte ) value;
+ bytes[5] = ( byte ) ( value >> 8 );
+ bytes[4] = ( byte ) ( value >> 16 );
+ bytes[3] = ( byte ) ( value >> 24 );
+ bytes[2] = ( byte ) ( value >> 32 );
+ bytes[1] = ( byte ) ( value >> 40 );
+ bytes[0] = ( byte ) ( value >> 48 );
+ }
+ else
+ {
+ bytes = new byte[8];
+ bytes[7] = ( byte ) value;
+ bytes[6] = ( byte ) ( value >> 8 );
+ bytes[5] = ( byte ) ( value >> 16 );
+ bytes[4] = ( byte ) ( value >> 24 );
+ bytes[3] = ( byte ) ( value >> 32 );
+ bytes[2] = ( byte ) ( value >> 40 );
+ bytes[1] = ( byte ) ( value >> 48 );
+ bytes[0] = ( byte ) ( value >> 56 );
+ }
+ }
+ else
+ {
+ // On special case : 0x80000000
+ if ( value == 0x8000000000000000L )
+ {
+ bytes = new byte[8];
+ bytes[7] = ( byte ) 0x00;
+ bytes[6] = ( byte ) 0x00;
+ bytes[5] = ( byte ) 0x00;
+ bytes[4] = ( byte ) 0x00;
+ bytes[3] = ( byte ) 0x00;
+ bytes[2] = ( byte ) 0x00;
+ bytes[1] = ( byte ) 0x00;
+ bytes[0] = ( byte ) 0x80;
+ }
+ else
+ {
+ // We have to compute the complement, and add 1
+ // value = ( ~value ) + 1;
+
+ if ( value >= 0xFFFFFFFFFFFFFF80L )
+ {
+ bytes = new byte[1];
+ bytes[0] = ( byte ) value;
+ }
+ else if ( value >= 0xFFFFFFFFFFFF8000L )
+ {
+ bytes = new byte[2];
+ bytes[1] = ( byte ) ( value );
+ bytes[0] = ( byte ) ( value >> 8 );
+ }
+ else if ( value >= 0xFFFFFFFFFF800000L )
+ {
+ bytes = new byte[3];
+ bytes[2] = ( byte ) value;
+ bytes[1] = ( byte ) ( value >> 8 );
+ bytes[0] = ( byte ) ( value >> 16 );
+ }
+ else if ( value >= 0xFFFFFFFF80000000L )
+ {
+ bytes = new byte[4];
+ bytes[3] = ( byte ) value;
+ bytes[2] = ( byte ) ( value >> 8 );
+ bytes[1] = ( byte ) ( value >> 16 );
+ bytes[0] = ( byte ) ( value >> 24 );
+ }
+ else if ( value >= 0xFFFFFF8000000000L )
+ {
+ bytes = new byte[5];
+ bytes[4] = ( byte ) value;
+ bytes[3] = ( byte ) ( value >> 8 );
+ bytes[2] = ( byte ) ( value >> 16 );
+ bytes[1] = ( byte ) ( value >> 24 );
+ bytes[0] = ( byte ) ( value >> 32 );
+ }
+ else if ( value >= 0xFFFF800000000000L )
+ {
+ bytes = new byte[6];
+ bytes[5] = ( byte ) value;
+ bytes[4] = ( byte ) ( value >> 8 );
+ bytes[3] = ( byte ) ( value >> 16 );
+ bytes[2] = ( byte ) ( value >> 24 );
+ bytes[1] = ( byte ) ( value >> 32 );
+ bytes[0] = ( byte ) ( value >> 40 );
+ }
+ else if ( value >= 0xFF80000000000000L )
+ {
+ bytes = new byte[7];
+ bytes[6] = ( byte ) value;
+ bytes[5] = ( byte ) ( value >> 8 );
+ bytes[4] = ( byte ) ( value >> 16 );
+ bytes[3] = ( byte ) ( value >> 24 );
+ bytes[2] = ( byte ) ( value >> 32 );
+ bytes[1] = ( byte ) ( value >> 40 );
+ bytes[0] = ( byte ) ( value >> 48 );
+ }
+ else
+ {
+ bytes = new byte[8];
+ bytes[7] = ( byte ) value;
+ bytes[6] = ( byte ) ( value >> 8 );
+ bytes[5] = ( byte ) ( value >> 16 );
+ bytes[4] = ( byte ) ( value >> 24 );
+ bytes[3] = ( byte ) ( value >> 32 );
+ bytes[2] = ( byte ) ( value >> 40 );
+ bytes[1] = ( byte ) ( value >> 48 );
+ bytes[0] = ( byte ) ( value >> 56 );
+ }
+ }
+ }
+
+ return bytes;
+ }
+
+
+ /**
+ * Encode a String value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param string The String to be encoded. It is supposed to be UTF-8
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, String string ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.OCTET_STRING.getValue() );
+
+ byte[] value = Asn1StringUtils.getBytesUtf8( string );
+
+ buffer.put( TLV.getBytes(value.length) );
+
+ if ( value.length != 0 )
+ {
+ buffer.put( value );
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode a BIT STRING value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param bitString The BitString to be encoded.
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, BitString bitString ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.BIT_STRING.getValue() );
+
+ // The BitString length. We add one byte for the unused number
+ // of bits
+ byte[] bytes = bitString.getData();
+ int length = bytes.length;
+
+ buffer.put( TLV.getBytes( length ) );
+ buffer.put( bytes );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode an OctetString value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param bytes The bytes to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, byte[] bytes ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.OCTET_STRING.getValue() );
+
+ if ( ( bytes == null ) || ( bytes.length == 0 ) )
+ {
+ buffer.put( ( byte ) 0 );
+ }
+ else
+ {
+ buffer.put( TLV.getBytes( bytes.length ) );
+ buffer.put( bytes );
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode an OID value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param oid The OID to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, OID oid ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.OCTET_STRING.getValue() );
+ buffer.put( TLV.getBytes( oid.getOIDLength() ) );
+
+ if ( oid.getOIDLength() != 0 )
+ {
+ buffer.put( oid.getOID() );
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode an integer value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param value The integer to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, int value ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.INTEGER.getValue() );
+ buffer.put( ( byte ) getNbBytes( value ) );
+ buffer.put( getBytes( value ) );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode a long value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param value The long to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, long value ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.INTEGER.getValue() );
+ buffer.put( ( byte ) getNbBytes( value ) );
+ buffer.put( getBytes( value ) );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode an integer value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param tag The tag if it's not an UNIVERSAL one
+ * @param value The integer to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, byte tag, int value ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( tag );
+ buffer.put( ( byte ) getNbBytes( value ) );
+ buffer.put( getBytes( value ) );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode an enumerated value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param value The integer to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encodeEnumerated( ByteBuffer buffer, int value ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ buffer.put( UniversalTag.ENUMERATED.getValue() );
+ buffer.put( TLV.getBytes( getNbBytes( value ) ) );
+ buffer.put( getBytes( value ) );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Encode a boolean value
+ *
+ * @param buffer The PDU in which the value will be put
+ * @param bool The boolean to be encoded
+ * @throws EncoderException if the PDU in which the value should be encoded is
+ * two small
+ */
+ public static void encode( ByteBuffer buffer, boolean bool ) throws EncoderException
+ {
+ if ( buffer == null )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
+ }
+
+ try
+ {
+ if ( bool )
+ {
+ buffer.put( ENCODED_TRUE );
+ }
+ else
+ {
+ buffer.put( ENCODED_FALSE );
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ) );
+ }
+ }
+
+
+ /**
+ * Return a string representing the Value
+ *
+ * @return A string representing the value
+ */
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append( "DATA" );
+
+ if ( data != null )
+ {
+ sb.append( '[' );
+ sb.append( Asn1StringUtils.dumpBytes( data ) );
+ sb.append( ']' );
+ }
+ else
+ {
+ return "[]";
+ }
+
+ return sb.toString();
+ }
+}
\ No newline at end of file
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Wed Dec 15 01:20:38 2010
@@ -27,11 +27,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.ber.tlv.*;
import org.apache.directory.shared.asn1.util.OID;
-import org.apache.directory.shared.asn1.util.*;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.actions.AttributeDescAction;
import org.apache.directory.shared.ldap.codec.actions.ControlValueAction;
@@ -534,7 +531,7 @@ public final class LdapMessageGrammar ex
try
{
- int version = IntegerDecoder.parse( value, 1, 127 );
+ int version = IntegerDecoder.parse(value, 1, 127);
if ( IS_DEBUG )
{
@@ -6177,7 +6174,7 @@ public final class LdapMessageGrammar ex
try
{
- extensibleMatchFilter.setDnAttributes( BooleanDecoder.parse( value ) );
+ extensibleMatchFilter.setDnAttributes( BooleanDecoder.parse(value) );
}
catch ( BooleanDecoderException bde )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java Wed Dec 15 01:20:38 2010
@@ -22,11 +22,11 @@ package org.apache.directory.shared.ldap
import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
import org.apache.directory.shared.ldap.message.LdapResult;
@@ -76,8 +76,8 @@ public class ResultCodeAction extends Gr
try
{
- resultCode = ResultCodeEnum.getResultCode( IntegerDecoder.parse( value, 0, ResultCodeEnum.UNKNOWN
- .getResultCode() ) );
+ resultCode = ResultCodeEnum.getResultCode( IntegerDecoder.parse(value, 0, ResultCodeEnum.UNKNOWN
+ .getResultCode()) );
}
catch ( IntegerDecoderException ide )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java Wed Dec 15 01:20:38 2010
@@ -192,7 +192,7 @@ public abstract class AbstractControl ex
}
// The control type
- Value.encode( buffer, getOid().getBytes() );
+ Value.encode(buffer, getOid().getBytes());
// The control criticality, if true
if ( criticality )
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlImpl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlImpl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlImpl.java Wed Dec 15 01:20:38 2010
@@ -57,7 +57,7 @@ public class ControlImpl extends Abstrac
/**
* Set the encoded control value
*
- * @param encodedValue The encoded control value to store
+ * @param value The encoded control value to store
*/
public void setValue( byte[] value )
{
@@ -129,7 +129,7 @@ public class ControlImpl extends Abstrac
// If we have a value, encode it
if ( value != null )
{
- Value.encode( buffer, value );
+ Value.encode(buffer, value);
}
return buffer;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java Wed Dec 15 01:20:38 2010
@@ -132,7 +132,7 @@ public class PasswordPolicyResponseContr
{
buffer.put( ( byte ) PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG.getValue() );
buffer.put( TLV.getBytes( timeBeforeExpirationTagLength ) );
- buffer.put( Value.getBytes( timeBeforeExpiration ) );
+ buffer.put( Value.getBytes(timeBeforeExpiration) );
}
else if ( graceAuthNsRemaining >= 0 )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java Wed Dec 15 01:20:38 2010
@@ -124,7 +124,7 @@ public class SyncDoneValueControl extend
if ( refreshDeletes )
{
- Value.encode( buffer, refreshDeletes );
+ Value.encode(buffer, refreshDeletes);
}
return buffer;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java Wed Dec 15 01:20:38 2010
@@ -28,8 +28,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.util.BooleanDecoder;
-import org.apache.directory.shared.asn1.util.BooleanDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoder;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java Wed Dec 15 01:20:38 2010
@@ -408,7 +408,7 @@ public class SyncInfoValueControl extend
{
for ( byte[] syncUUID:syncUUIDs )
{
- Value.encode( buffer , syncUUID );
+ Value.encode(buffer, syncUUID);
}
}
}
@@ -482,7 +482,7 @@ public class SyncInfoValueControl extend
// The refreshDone flag
if ( !refreshDone )
{
- Value.encode( buffer, refreshDone );
+ Value.encode(buffer, refreshDone);
}
break;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java Wed Dec 15 01:20:38 2010
@@ -26,10 +26,10 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoder;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.util.BooleanDecoder;
-import org.apache.directory.shared.asn1.util.BooleanDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.control.replication.SynchronizationInfoEnum;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -446,7 +446,7 @@ public final class SyncInfoValueControlG
try
{
- boolean refreshDone = BooleanDecoder.parse( value );
+ boolean refreshDone = BooleanDecoder.parse(value);
if ( IS_DEBUG )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java Wed Dec 15 01:20:38 2010
@@ -175,7 +175,7 @@ public class SyncRequestValueControl ex
// The mode
buffer.put( UniversalTag.ENUMERATED.getValue() );
buffer.put( (byte)0x01 );
- buffer.put( Value.getBytes( mode.getValue() ) );
+ buffer.put( Value.getBytes(mode.getValue()) );
// The cookie
if ( cookie != null )
@@ -186,7 +186,7 @@ public class SyncRequestValueControl ex
// The reloadHint if not false
if ( reloadHint )
{
- Value.encode( buffer, reloadHint );
+ Value.encode(buffer, reloadHint);
}
return buffer;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java Wed Dec 15 01:20:38 2010
@@ -25,13 +25,13 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoder;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.BooleanDecoder;
-import org.apache.directory.shared.asn1.util.BooleanDecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.BooleanDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -202,7 +202,7 @@ public final class SyncRequestValueContr
try
{
- boolean reloadHint = BooleanDecoder.parse( value );
+ boolean reloadHint = BooleanDecoder.parse(value);
if ( IS_DEBUG )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java Wed Dec 15 01:20:38 2010
@@ -211,10 +211,10 @@ public class SyncStateValueControl exte
// The mode
buffer.put( UniversalTag.ENUMERATED.getValue() );
buffer.put( ( byte ) 0x01 );
- buffer.put( Value.getBytes( syncStateType.getValue() ) );
+ buffer.put( Value.getBytes(syncStateType.getValue()) );
// the entryUUID
- Value.encode( buffer, entryUUID );
+ Value.encode(buffer, entryUUID);
// The cookie
if ( cookie != null )
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java Wed Dec 15 01:20:38 2010
@@ -25,11 +25,11 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.message.control.replication.SyncStateTypeEnum;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -115,8 +115,8 @@ public final class SyncStateValueControl
try
{
// Check that the value is into the allowed interval
- int syncStateType = IntegerDecoder.parse( value, SyncStateTypeEnum.PRESENT.getValue(),
- SyncStateTypeEnum.MODDN.getValue() );
+ int syncStateType = IntegerDecoder.parse(value, SyncStateTypeEnum.PRESENT.getValue(),
+ SyncStateTypeEnum.MODDN.getValue());
SyncStateTypeEnum syncStateTypeEnum = SyncStateTypeEnum.getSyncStateType( syncStateType );
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java Wed Dec 15 01:20:38 2010
@@ -172,7 +172,7 @@ public class SyncModifyDnControl extends
buffer.put( ( byte ) SyncModifyDnControlTags.RENAME_TAG.getValue() );
buffer.put( TLV.getBytes( renameLen ) );
Value.encode( buffer, newRdn );
- Value.encode( buffer, deleteOldRdn );
+ Value.encode(buffer, deleteOldRdn);
break;
case MOVEANDRENAME:
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/Cancel.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/Cancel.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/Cancel.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/Cancel.java Wed Dec 15 01:20:38 2010
@@ -102,7 +102,7 @@ public class Cancel extends AbstractAsn1
public int computeLength()
{
// The messageId length
- cancelSequenceLength = 1 + 1 + Value.getNbBytes( cancelId );
+ cancelSequenceLength = 1 + 1 + Value.getNbBytes(cancelId);
// Add the sequence and the length
return 1 + 1 + cancelSequenceLength;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/CancelGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/CancelGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/CancelGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/CancelGrammar.java Wed Dec 15 01:20:38 2010
@@ -28,8 +28,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationObject.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationObject.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationObject.java Wed Dec 15 01:20:38 2010
@@ -67,13 +67,13 @@ public class CertGenerationObject extend
public int computeLength()
{
int len = StringTools.getBytesUtf8( targetDN ).length;
- requestLength = 1 + Value.getNbBytes( len ) + len;
+ requestLength = 1 + Value.getNbBytes(len) + len;
len = StringTools.getBytesUtf8( issuerDN ).length;
requestLength += 1 + Value.getNbBytes( len ) + len;
len = StringTools.getBytesUtf8( subjectDN ).length;
- requestLength += 1 + Value.getNbBytes( len ) + len;
+ requestLength += 1 + Value.getNbBytes(len) + len;
len = StringTools.getBytesUtf8( keyAlgorithm ).length;
requestLength += 1 + Value.getNbBytes( len ) + len;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnect.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnect.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnect.java Wed Dec 15 01:20:38 2010
@@ -181,7 +181,7 @@ public class GracefulDisconnect extends
// We may have more than one reference.
for ( LdapURL replicatedContext:replicatedContexts )
{
- Value.encode( bb, replicatedContext.getBytesReference() );
+ Value.encode(bb, replicatedContext.getBytesReference());
}
}
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java Wed Dec 15 01:20:38 2010
@@ -28,8 +28,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.extended.operations.GracefulActionConstants;
import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdown.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdown.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdown.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdown.java Wed Dec 15 01:20:38 2010
@@ -81,7 +81,7 @@ public class GracefulShutdown extends Gr
if ( delay != 0 )
{
- gracefulSequenceLength += 1 + 1 + Value.getNbBytes( delay );
+ gracefulSequenceLength += 1 + 1 + Value.getNbBytes(delay);
}
return gracefulLength + gracefulSequenceLength;
@@ -110,7 +110,7 @@ public class GracefulShutdown extends Gr
if ( delay != 0 )
{
bb.put( ( byte ) GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG );
- bb.put( ( byte ) Value.getNbBytes( delay ) );
+ bb.put( ( byte ) Value.getNbBytes(delay) );
bb.put( Value.getBytes( delay ) );
}
return bb;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java Wed Dec 15 01:20:38 2010
@@ -25,11 +25,11 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoder;
import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
import org.apache.directory.shared.asn1.ber.tlv.Value;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.extended.operations.GracefulActionConstants;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -119,7 +119,7 @@ public final class GracefulShutdownGramm
try
{
- int timeOffline = IntegerDecoder.parse( value, 0, 720 );
+ int timeOffline = IntegerDecoder.parse(value, 0, 720);
if ( IS_DEBUG )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedure.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedure.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedure.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedure.java Wed Dec 15 01:20:38 2010
@@ -277,7 +277,7 @@ public class StoredProcedure extends Abs
Value.encode( bb, language );
// The procedure
- Value.encode( bb, procedure );
+ Value.encode(bb, procedure);
// The parameters sequence
bb.put( UniversalTag.SEQUENCE.getValue() );
@@ -299,7 +299,7 @@ public class StoredProcedure extends Abs
Value.encode( bb, spParam.type );
// The parameter value
- Value.encode( bb, spParam.value );
+ Value.encode(bb, spParam.value);
// Go to the next parameter;
parameterNumber++;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java Wed Dec 15 01:20:38 2010
@@ -227,7 +227,7 @@ public class AttributeValueAssertionFilt
}
else
{
- Value.encode( buffer, assertion.getAssertionValue().getBytes() );
+ Value.encode(buffer, assertion.getAssertionValue().getBytes());
}
return buffer;
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java Wed Dec 15 01:20:38 2010
@@ -302,7 +302,7 @@ public class SubstringFilter extends Fil
buffer.put( TLV.getBytes( substringsFilterLength ) );
// The type
- Value.encode( buffer, type.getBytes() );
+ Value.encode(buffer, type.getBytes());
// The SubstringSequenceFilter Tag
buffer.put( UniversalTag.SEQUENCE.getValue() );
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java Wed Dec 15 01:20:38 2010
@@ -212,7 +212,7 @@ public class EntryChangeControl extends
if ( previousDn != null )
{
- Value.encode( buffer, previousDnBytes );
+ Value.encode(buffer, previousDnBytes);
}
if ( changeNumber != UNDEFINED_CHANGE_NUMBER )
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java Wed Dec 15 01:20:38 2010
@@ -25,13 +25,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.ber.grammar.Grammar;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
-import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.ber.tlv.*;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
-import org.apache.directory.shared.asn1.util.LongDecoder;
-import org.apache.directory.shared.asn1.util.LongDecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.search.controls.ChangeType;
import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
@@ -102,7 +97,7 @@ public final class EntryChangeControlGra
try
{
- int change = IntegerDecoder.parse( value, 1, 8 );
+ int change = IntegerDecoder.parse(value, 1, 8);
switch ( ChangeType.getChangeType( change ) )
{
@@ -207,7 +202,7 @@ public final class EntryChangeControlGra
try
{
- long changeNumber = LongDecoder.parse( value );
+ long changeNumber = LongDecoder.parse(value);
if ( IS_DEBUG )
{
Modified: directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java?rev=1049374&r1=1049373&r2=1049374&view=diff
==============================================================================
--- directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java (original)
+++ directory/shared/branches/alex_refactoring/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java Wed Dec 15 01:20:38 2010
@@ -152,7 +152,7 @@ public class PagedResultsControl extends
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( pscSeqLength ) );
- Value.encode( buffer, size );
+ Value.encode(buffer, size);
Value.encode( buffer, cookie );
return buffer;