directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r992800 [1/4] - in /directory: apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/ apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/v...
Date Sun, 05 Sep 2010 14:56:43 GMT
Author: elecharny
Date: Sun Sep  5 14:56:40 2010
New Revision: 992800

URL: http://svn.apache.org/viewvc?rev=992800&view=rev
Log:
o Some more reviewed files
o The UniversalTag class is now an enum
o The TLVStateEnum class is now an enum

Added:
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVBerDecoderMBean.java
      - copied, changed from r992571, directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/ITLVBerDecoderMBean.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/aci/
Removed:
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/ITLVBerDecoderMBean.java
Modified:
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/Ticket.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationData.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataEntry.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java
    directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLV.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVStateEnum.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/UniversalTag.java
    directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/Cancel.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/cancel/CancelGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationObject.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnect.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdown.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedure.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/Ticket.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/Ticket.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/Ticket.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/components/Ticket.java Sun Sep  5 14:56:40 2010
@@ -488,7 +488,7 @@ public class Ticket extends AbstractAsn1
             buffer.put( TLV.getBytes( ticketLength ) );
 
             // The Ticket SEQUENCE Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( ticketSeqLength ) );
 
             // The tkt-vno Tag and value
@@ -499,7 +499,7 @@ public class Ticket extends AbstractAsn1
             // The realm Tag and value
             buffer.put( ( byte ) 0xA1 );
             buffer.put( TLV.getBytes( realmLength ) );
-            buffer.put( UniversalTag.GENERALIZED_STRING_TAG );
+            buffer.put( UniversalTag.GENERAL_STRING.getValue() );
             buffer.put( TLV.getBytes( realmBytes.length ) );
             buffer.put( realmBytes );
 

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationData.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationData.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationData.java Sun Sep  5 14:56:40 2010
@@ -164,7 +164,7 @@ public class AuthorizationData extends A
         try
         {
             // The AuthorizationData SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( authorizationDataLength ) );
 
             // Each entry, if any

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataEntry.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataEntry.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataEntry.java Sun Sep  5 14:56:40 2010
@@ -220,7 +220,7 @@ public class AuthorizationDataEntry exte
         try
         {
             // The AuthorizationDataEntry SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( authorizationDataEntryLength ) );
 
             // The adType, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java Sun Sep  5 14:56:40 2010
@@ -240,7 +240,7 @@ public class Checksum extends AbstractAs
         try
         {
             // The Checksum SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( checksumLength ) );
 
             // The cksumtype, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptedData.java Sun Sep  5 14:56:40 2010
@@ -270,7 +270,7 @@ public class EncryptedData extends Abstr
         try
         {
             // The EncryptedData SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( encryptedDataSeqLength ) );
 
             // The etype, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java Sun Sep  5 14:56:40 2010
@@ -289,7 +289,7 @@ public class EncryptionKey extends Abstr
         try
         {
             // The EncryptionKey SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( encryptionKeyLength ) );
 
             // The keyType, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java Sun Sep  5 14:56:40 2010
@@ -267,7 +267,7 @@ public class HostAddress extends Abstrac
         try
         {
             // The HostAddress SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( hostAddressLength ) );
 
             // The addr-type, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java Sun Sep  5 14:56:40 2010
@@ -241,7 +241,7 @@ public class HostAddresses extends Abstr
         try
         {
             // The HostAddresses SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( addressesLength ) );
 
             // The hostAddress list, if it's not empty

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PaData.java Sun Sep  5 14:56:40 2010
@@ -213,7 +213,7 @@ public class PaData extends AbstractAsn1
         try
         {
             // The Checksum SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( preAuthenticationDataSeqLength ) );
 
             // The cksumtype, first the tag, then the value

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java Sun Sep  5 14:56:40 2010
@@ -380,7 +380,7 @@ public class PrincipalName extends Abstr
         try
         {
             // The PrincipalName SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( principalNameSeqLength ) );
 
             // The name-type, first the tag, then the value
@@ -393,7 +393,7 @@ public class PrincipalName extends Abstr
             buffer.put( TLV.getBytes( principalStringsTagLength ) );
 
             // The name-string sequence
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
 
             if ( ( nameString == null ) || ( nameString.size() == 0 ) )
             {
@@ -406,7 +406,7 @@ public class PrincipalName extends Abstr
                 // The kerberosStrings
                 for ( byte[] name : nameBytes )
                 {
-                    buffer.put( UniversalTag.GENERALIZED_STRING_TAG );
+                    buffer.put( UniversalTag.GENERAL_STRING.getValue() );
 
                     if ( ( name == null ) || ( name.length == 0 ) )
                     {

Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java Sun Sep  5 14:56:40 2010
@@ -208,7 +208,7 @@ public class TransitedEncoding extends A
         try
         {
             // The AuthorizationDataEntry SEQ Tag
-            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( UniversalTag.SEQUENCE.getValue() );
             buffer.put( TLV.getBytes( transitedEncodingLength ) );
 
             // The tr-type, first the tag, then the value

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java Sun Sep  5 14:56:40 2010
@@ -42,7 +42,7 @@ public abstract class AbstractContainer 
     protected int[] stateStack;
 
     /** The current state of the decoding */
-    private int state;
+    private TLVStateEnum state;
 
     /** The current transition */
     private int transition;
@@ -68,6 +68,17 @@ public abstract class AbstractContainer 
     /** The incremental id used to tag TLVs */
     private int id = 0;
     
+    
+    /**
+     * Creates a new instance of AbstractContainer with a starting state.
+     *
+     */
+    protected AbstractContainer()
+    {
+        state = TLVStateEnum.TAG_STATE_START;
+    }
+
+    
     /**
      * Get the current grammar
      * 
@@ -84,7 +95,7 @@ public abstract class AbstractContainer 
      * 
      * @return Returns the current grammar state
      */
-    public int getState()
+    public TLVStateEnum getState()
     {
         return state;
     }
@@ -95,7 +106,7 @@ public abstract class AbstractContainer 
      * 
      * @param state The new state
      */
-    public void setState( int state )
+    public void setState( TLVStateEnum state )
     {
         this.state = state;
     }
@@ -212,6 +223,7 @@ public abstract class AbstractContainer 
         state = TLVStateEnum.TAG_STATE_START;
     }
     
+    
     /**
      * Return a new ID and increment the counter
      * @return A new TLV id. 
@@ -221,6 +233,7 @@ public abstract class AbstractContainer 
         return id++;
     }
 
+    
     /**
      * @return The TLV Id
      */

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java Sun Sep  5 14:56:40 2010
@@ -22,8 +22,7 @@ package org.apache.directory.shared.asn1
 
 import java.nio.ByteBuffer;
 
-import org.apache.directory.shared.asn1.ber.grammar.States;
-import org.apache.directory.shared.asn1.ber.tlv.ITLVBerDecoderMBean;
+import org.apache.directory.shared.asn1.ber.tlv.TLVBerDecoderMBean;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -41,7 +40,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
 */
-public class Asn1Decoder implements ITLVBerDecoderMBean
+public class Asn1Decoder implements TLVBerDecoderMBean
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -604,7 +603,7 @@ public class Asn1Decoder implements ITLV
         // Check if the PDU has been fully decoded.
         if ( isTLVDecoded( container ) )
         {
-            if ( container.getState() == States.GRAMMAR_END )
+            if ( container.getState() == TLVStateEnum.GRAMMAR_END )
             {
                 // Change the state to DECODED
                 container.setState( TLVStateEnum.PDU_DECODED );
@@ -634,50 +633,6 @@ public class Asn1Decoder implements ITLV
 
 
     /**
-     * An helper function that return a string representing the current state
-     * for debuging purpose.
-     * 
-     * @param state The state
-     * @return A string representation of the state
-     */
-    private String stateToString( int state )
-    {
-        switch ( state )
-        {
-            case TLVStateEnum.TAG_STATE_START:
-                return "TAG_STATE_START";
-
-            case TLVStateEnum.TAG_STATE_END:
-                return "TAG_STATE_END";
-
-            case TLVStateEnum.TAG_STATE_OVERFLOW:
-                return "TAG_STATE_OVERFLOW";
-
-            case TLVStateEnum.LENGTH_STATE_START:
-                return "LENGTH_STATE_START";
-
-            case TLVStateEnum.LENGTH_STATE_PENDING:
-                return "LENGTH_STATE_PENDING";
-
-            case TLVStateEnum.LENGTH_STATE_END:
-                return "LENGTH_STATE_END";
-
-            case TLVStateEnum.VALUE_STATE_START:
-                return "VALUE_STATE_START";
-
-            case TLVStateEnum.VALUE_STATE_PENDING:
-                return "VALUE_STATE_PENDING";
-
-            case TLVStateEnum.TLV_STATE_DONE:
-                return "TLV_STATE_DONE";
-
-            default:
-                return "UNKNOWN_STATE";
-        }
-    }
-
-
-    /**
      * The decoder main function. This is where we read bytes from the stream
      * and go through the automaton. It's an inifnite loop which stop when no
      * more bytes are to be read. It can occurs if the ByteBuffer is exhausted
@@ -723,7 +678,7 @@ public class Asn1Decoder implements ITLV
         {
             if ( IS_DEBUG )
             {
-                LOG.debug( "--- State = {} ---", stateToString( container.getState() ) );
+                LOG.debug( "--- State = {} ---", container.getState() );
 
                 if ( stream.hasRemaining() )
                 {
@@ -739,50 +694,50 @@ public class Asn1Decoder implements ITLV
 
             switch ( container.getState() )
             {
-                case TLVStateEnum.TAG_STATE_START:
+                case TAG_STATE_START:
                     // Reset the GrammarEnd flag first
                     container.grammarEndAllowed( false );
                     hasRemaining = treatTagStartState( stream, container );
 
                     break;
 
-                case TLVStateEnum.LENGTH_STATE_START:
+                case LENGTH_STATE_START:
                     hasRemaining = treatLengthStartState( stream, container );
 
                     break;
 
-                case TLVStateEnum.LENGTH_STATE_PENDING:
+                case LENGTH_STATE_PENDING:
                     hasRemaining = treatLengthPendingState( stream, container );
 
                     break;
 
-                case TLVStateEnum.LENGTH_STATE_END:
+                case LENGTH_STATE_END:
                     treatLengthEndState( container );
 
                     break;
 
-                case TLVStateEnum.VALUE_STATE_START:
+                case VALUE_STATE_START:
                     hasRemaining = treatValueStartState( stream, container );
 
                     break;
 
-                case TLVStateEnum.VALUE_STATE_PENDING:
+                case VALUE_STATE_PENDING:
                     hasRemaining = treatValuePendingState( stream, container );
 
                     break;
 
-                case TLVStateEnum.VALUE_STATE_END:
+                case VALUE_STATE_END:
                     hasRemaining = stream.hasRemaining();
 
                     // Nothing to do. We will never reach this state
                     break;
 
-                case TLVStateEnum.TLV_STATE_DONE:
+                case TLV_STATE_DONE:
                     hasRemaining = treatTLVDoneState( stream, container );
 
                     break;
 
-                case TLVStateEnum.PDU_DECODED:
+                case PDU_DECODED:
                     // We have to deal with the case where there are
                     // more bytes in the buffer, but the PDU has been decoded.
                     LOG.warn( I18n.err( I18n.ERR_REMAINING_BYTES_FOR_DECODED_PDU_00043 ) );
@@ -882,11 +837,7 @@ public class Asn1Decoder implements ITLV
 
 
     /**
-     * Set the maximal length for a Length
-     * 
-     * @param maxLengthLength The lengthLength to set.
-     * @throws DecoderException Thrown if the indefinite length is 
-     * allowed or if the length's Length is above 126 bytes
+     * {@inheritDoc}
      */
     public void setMaxLengthLength( int maxLengthLength ) throws DecoderException
     {

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/IAsn1Container.java Sun Sep  5 14:56:40 2010
@@ -23,6 +23,7 @@ package org.apache.directory.shared.asn1
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 
 
 /**
@@ -37,7 +38,7 @@ public interface IAsn1Container
      * 
      * @return Returns the current grammar state
      */
-    int getState();
+    TLVStateEnum getState();
 
 
     /**
@@ -45,7 +46,7 @@ public interface IAsn1Container
      * 
      * @param state The new state
      */
-    void setState( int state );
+    void setState( TLVStateEnum state );
 
 
     /**

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLV.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLV.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLV.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLV.java Sun Sep  5 14:56:40 2010
@@ -30,12 +30,6 @@ import org.apache.directory.shared.asn1.
  */
 public class TLV
 {
-    // ~ Static fields/initializers
-    // -----------------------------------------------------------------
-
-    // ~ Instance fields
-    // ----------------------------------------------------------------------------
-
     /** The current Tag being processed */
     private byte tag;
 
@@ -89,7 +83,7 @@ public class TLV
     public static final int LENGTH_SHORT_MASK = 0x007F;
     
     /** A speedup for single bytes length */
-    static byte[][] ONE_BYTE = new byte[256][];
+    private static final byte[][] ONE_BYTE = new byte[256][];
     
     static
     {
@@ -118,9 +112,6 @@ public class TLV
     }
 
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Checks to see if the tag is constructed.
      * 
@@ -132,6 +123,7 @@ public class TLV
         return ( tag & CONSTRUCTED_FLAG ) != 0;
     }
 
+    
     /**
      * Checks to see if the current tlv's tag is constructed.
      * 
@@ -155,6 +147,7 @@ public class TLV
         return ( tag & CONSTRUCTED_FLAG ) == 0;
     }
 
+    
     /**
      * Tells if the tag is Universal or not
      * 
@@ -166,6 +159,7 @@ public class TLV
         return ( tag & TYPE_CLASS_MASK ) == TYPE_CLASS_UNIVERSAL; 
     }
 
+    
     /**
      * Reset the TLV, so it can be reused for the next PDU decoding.
      */
@@ -179,6 +173,7 @@ public class TLV
         expectedLength = 0;
     }
 
+    
     /**
      * @return Returns the tag.
      */
@@ -187,6 +182,7 @@ public class TLV
         return tag;
     }
 
+    
     /**
      * Set a tag value for this TLV.
      * 
@@ -197,6 +193,7 @@ public class TLV
         this.tag = tag;
     }
 
+    
     /**
      * @return Returns the value.
      */
@@ -205,25 +202,6 @@ public class TLV
         return value;
     }
 
-    /**
-     * Get a String representation of the TLV
-     * 
-     * @return A String
-     */
-    public String toString()
-    {
-
-        StringBuffer sb = new StringBuffer();
-
-        sb.append( "TLV[ " );
-        sb.append( Asn1StringUtils.dumpByte( tag ) ).append( ", " );
-        sb.append( length ).append( ", " );
-        sb.append( value.toString() );
-        sb.append( "]" );
-
-        return sb.toString();
-    }
-
 
     /**
      * The TLV size is calculated by adding the Tag's size, the Length's size
@@ -236,6 +214,7 @@ public class TLV
         return 1 + lengthNbBytes + length;
     }
 
+    
     /**
      * Utility function that return the number of bytes necessary to store the
      * length
@@ -245,10 +224,8 @@ public class TLV
      */
     public static int getNbBytes( int length )
     {
-
         if ( length >= 0 )
         {
-
             if ( length < 128 )
             {
                 return 1;
@@ -276,6 +253,7 @@ public class TLV
         }
     }
 
+    
     /**
      * Utility function that return a byte array representing the length
      * 
@@ -455,5 +433,25 @@ public class TLV
     {
         return id;
     }
+
+    
+    /**
+     * Get a String representation of the TLV
+     * 
+     * @return A String
+     */
+    public String toString()
+    {
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "TLV[ " );
+        sb.append( Asn1StringUtils.dumpByte( tag ) ).append( ", " );
+        sb.append( length ).append( ", " );
+        sb.append( value.toString() );
+        sb.append( "]" );
+
+        return sb.toString();
+    }
 }
  
\ No newline at end of file

Copied: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVBerDecoderMBean.java (from r992571, directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/ITLVBerDecoderMBean.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVBerDecoderMBean.java?p2=directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVBerDecoderMBean.java&p1=directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/ITLVBerDecoderMBean.java&r1=992571&r2=992800&rev=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/ITLVBerDecoderMBean.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVBerDecoderMBean.java Sun Sep  5 14:56:40 2010
@@ -19,25 +19,26 @@
  */
 package org.apache.directory.shared.asn1.ber.tlv;
 
-
 import org.apache.directory.shared.asn1.codec.DecoderException;
 
 
+
+
 /**
+ * A MBean used to get stats on the decoding process.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface ITLVBerDecoderMBean
+public interface TLVBerDecoderMBean
 {
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Set the number of bytes that can be used to encode the Value length,
      * including the first byte. Max is 127 if the Length use a definite form,
      * default is 1
      * 
      * @param length the number of byte to use
-     * @throws DecoderException 
+     * @throws DecoderException Thrown if the indefinite length is 
+     * allowed or if the length's Length is above 126 bytes
      */
     void setMaxLengthLength( int length ) throws DecoderException;
 
@@ -46,8 +47,7 @@ public interface ITLVBerDecoderMBean
      * Set the maximum number of bytes that should be used to encode a Tag
      * label, including the first byte. Default is 1, no maximum
      * 
-     * @param length
-     *            The length to use
+     * @param length The length to use
      */
     void setMaxTagLength( int length );
 

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVStateEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVStateEnum.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVStateEnum.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/TLVStateEnum.java Sun Sep  5 14:56:40 2010
@@ -25,48 +25,48 @@ package org.apache.directory.shared.asn1
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class TLVStateEnum
+public enum TLVStateEnum
 {
-    // ~ Static fields/initializers
-    // -----------------------------------------------------------------
-
     /** Start means that the deconding hasn't read the first byte */
-    public static final int TAG_STATE_START = 0x00;
+    TAG_STATE_START,
 
     /** Pending means that the Type Tag is contained in more that one byte */
-    public static final int TAG_STATE_PENDING = 0x01;
+    TAG_STATE_PENDING,
 
     /** End means that the Type is totally read */
-    public static final int TAG_STATE_END = 0x02;
+    TAG_STATE_END,
 
     /**
      * Overflow could have two meaning : either there are more than 5 bytes to
      * encode the value (5 bytes = 5bits + 4*7 bits = 33 bits) or the value that
      * is represented by those bytes is over MAX_INTEGER
      */
-    public static final int TAG_STATE_OVERFLOW = 0x04;
+    TAG_STATE_OVERFLOW,
 
     /** Start means that the decoding hasn't read the first byte */
-    public static final int LENGTH_STATE_START = 0x08;
+    LENGTH_STATE_START,
 
     /** Pending means that the Type length is contained in more that one byte */
-    public static final int LENGTH_STATE_PENDING = 0x10;
+    LENGTH_STATE_PENDING,
 
     /** End means that the Length is totally read */
-    public static final int LENGTH_STATE_END = 0x20;
+    LENGTH_STATE_END,
 
     /** Start means that the decoding hasn't read the first byte */
-    public static final int VALUE_STATE_START = 0x40;
+    VALUE_STATE_START,
 
     /** Pending means that the Type Value is contained in more that one byte */
-    public static final int VALUE_STATE_PENDING = 0x80;
+    VALUE_STATE_PENDING,
 
     /** End means that the Value is totally read */
-    public static final int VALUE_STATE_END = 0x100;
+    VALUE_STATE_END,
 
     /** The decoding of a TLV is done */
-    public static final int TLV_STATE_DONE = 0x200;
+    TLV_STATE_DONE,
 
     /** The decoding of a PDU is done */
-    public static final int PDU_DECODED = 0x400;
+    PDU_DECODED,
+    
+    /** The ending state */
+    GRAMMAR_END;
 }

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/UniversalTag.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/UniversalTag.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/UniversalTag.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/UniversalTag.java Sun Sep  5 14:56:40 2010
@@ -167,191 +167,129 @@ package org.apache.directory.shared.asn1
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class UniversalTag
+public enum UniversalTag
 {
-    // ~ Static fields/initializers
-    // -----------------------------------------------------------------
-
     /** value for the tag */
-    public static final int RESERVED_0 = 0;
+    RESERVED_0( (byte)0 ),
 
     /** value for the tag */
-    public static final int BOOLEAN = 1;
+    BOOLEAN( (byte)1 ),
 
     /** value for the tag */
-    public static final int INTEGER = 2;
+    INTEGER( (byte)2 ),
 
     /** value for the tag */
-    public static final int BIT_STRING = 3;
+    BIT_STRING( (byte)3 ),
 
     /** value for the tag */
-    public static final int OCTET_STRING = 4;
+    OCTET_STRING( (byte)4 ),
 
     /** value for the tag */
-    public static final int NULL = 5;
+    NULL((byte)5 ),
 
     /** value for the tag */
-    public static final int OBJECT_IDENTIFIER = 6;
+    OBJECT_IDENTIFIER( (byte)6 ),
 
     /** value for the tag */
-    public static final int OBJECT_DESCRIPTOR = 7;
+    OBJECT_DESCRIPTOR( (byte)7 ),
 
     /** value for the tag */
-    public static final int EXTERNAL_INSTANCE_OF = 8;
+    EXTERNAL_INSTANCE_OF( (byte)8 ),
 
     /** value for the tag */
-    public static final int REAL = 9;
+    REAL( (byte)9 ),
 
     /** value for the tag */
-    public static final int ENUMERATED = 10;
+    ENUMERATED( (byte)0x0A ),
 
     /** value for the tag */
-    public static final int EMBEDDED_PDV = 11;
+    EMBEDDED_PDV( (byte)0x0B ),
 
     /** value for the tag */
-    public static final int UTF8_STRING = 12;
+    UTF8_STRING( (byte)0x0C ),
 
     /** value for the tag */
-    public static final int RELATIVE_OID = 13;
+    RELATIVE_OID( (byte)0x0D ),
 
     /** value for the tag */
-    public static final int RESERVED_14 = 14;
+    RESERVED_14( (byte)0x0E ),
 
     /** value for the tag */
-    public static final int RESERVED_15 = 15;
+    RESERVED_15( (byte)0x0F ),
 
     /** value for the tag */
-    public static final int SEQUENCE_SEQUENCE_OF = 16;
+    SEQUENCE_SEQUENCE_OF( (byte)0x10 ),
 
     /** value for the tag */
-    public static final int SET_SET_OF = 17;
+    SET_SET_OF( (byte)0x11 ),
 
     /** value for the tag */
-    public static final int NUMERIC_STRING = 18;
+    NUMERIC_STRING( (byte)0x12 ),
 
     /** value for the tag */
-    public static final int PRINTABLE_STRING = 19;
+    PRINTABLE_STRING( (byte)0x13 ),
 
     /** value for the tag */
-    public static final int TELETEX_STRING = 20;
+    TELETEX_STRING( (byte)0x14 ),
 
     /** value for the tag */
-    public static final int VIDEOTEX_STRING = 21;
+    VIDEOTEX_STRING( (byte)0x15 ),
 
     /** value for the tag */
-    public static final int IA5_STRING = 22;
+    IA5_STRING( (byte)0x16 ),
 
     /** value for the tag */
-    public static final int UTC_TIME = 23;
+    UTC_TIME( (byte)0x17 ),
 
     /** value for the tag */
-    public static final int GENERALIZED_TIME = 24;
+    GENERALIZED_TIME( (byte)0x18 ),
 
     /** value for the tag */
-    public static final int GRAPHIC_STRING = 25;
+    GRAPHIC_STRING( (byte)0x19 ),
 
     /** value for the tag */
-    public static final int VISIBLE_STRING = 26;
+    VISIBLE_STRING( (byte)0x1A ),
 
     /** value for the tag */
-    public static final int GENERAL_STRING = 27;
+    GENERAL_STRING( (byte)0x1B ),
 
     /** value for the tag */
-    public static final int UNIVERSAL_STRING = 28;
+    UNIVERSAL_STRING( (byte)0x1C ),
 
     /** value for the tag */
-    public static final int CHARACTER_STRING = 29;
+    CHARACTER_STRING( (byte)0x1D ),
 
     /** value for the tag */
-    public static final int BMP_STRING = 30;
+    BMP_STRING( (byte)0x1E ),
 
     /** value for the tag */
-    public static final int RESERVED_31 = 31;
-
-    /** String representation of the tags */
-    private static final String[] UNIVERSAL_TAG_STRING =
-        { 
-            "RESERVED_0", 
-            "BOOLEAN", 
-            "INTEGER", 
-            "BIT_STRING", 
-            "OCTET_STRING", 
-            "NULL", 
-            "OBJECT_IDENTIFIER",
-            "OBJECT_DESCRIPTOR", 
-            "EXTERNAL_INSTANCE_OF", 
-            "REAL", 
-            "ENUMERATED", 
-            "EMBEDDED_PDV", 
-            "UTF8_STRING",
-            "RELATIVE_OID", 
-            "RESERVED_14", 
-            "RESERVED_15", 
-            "SEQUENCE_SEQUENCE_OF", 
-            "SET_SET_OF", 
-            "NUMERIC_STRING",
-            "PRINTABLE_STRING", 
-            "TELETEX_STRING", 
-            "VIDEOTEX_STRING", 
-            "IA5_STRING", 
-            "UTC_TIME", 
-            "GENERALIZED_TIME",
-            "GRAPHIC_STRING", 
-            "VISIBLE_STRING", 
-            "GENERAL_STRING", 
-            "UNIVERSAL_STRING", 
-            "CHARACTER_STRING", 
-            "BMP_STRING",
-            "RESERVED_31" 
-        };
-
-    /** ASN.1 primitive tag values */
-    /** Boolean TAG */
-    public static final byte BOOLEAN_TAG = 0x01;
-
-    /** Integer TAG */
-    public static final byte INTEGER_TAG = 0x02;
-
-    /** BIT_STRING TAG */
-    public static final byte BIT_STRING_TAG = 0x03;
-
-    /** OCTET_STRING TAG */
-    public static final byte OCTET_STRING_TAG = 0x04;
-
-    /** ENUMERATED TAG */
-    public static final byte ENUMERATED_TAG = 0x0A;
-    
-    /** UTF8_STRING TAG */
-    public static final byte UTF8_STRING_TAG = 0x0C;
+    RESERVED_31( (byte)0x1F ),
 
-    /** GENERALIZED_TIME TAG */
-    public static final byte GENERALIZED_TIME_TAG = 0x18;
-
-    /** GENERALIZED_STRING TAG */
-    public static final byte GENERALIZED_STRING_TAG = 0x1B;
 
     /** SEQUENCE TAG */
-    public static final byte SEQUENCE_TAG = 0x30;
+    SEQUENCE( (byte)0x30 ),
 
     /** SET TAG */
-    public static final byte SET_TAG = 0x31;
-
+    SET( (byte)0x31 );
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
+    /** The internal value */
+    private byte value;
+    
+    /**
+     * Creates a new instance of UniversalTag.
+     *
+     * @param value The tag value
+     */
+    private UniversalTag( byte value )
+    {
+        this.value = value;
+    }
 
-    // -----------------------------------------------------------------------
-    // Members
-    // -----------------------------------------------------------------------
     /**
-     * Gets the ASN.1 UNIVERSAL type tag's enum using a tag value.
-     * 
-     * @param tag
-     *            the first octet of the TLV
-     * @return the valued enum for the ASN.1 UNIVERSAL type tag
+     * @return The UniversalTag value
      */
-    public static String toString( int tag )
+    public byte getValue()
     {
-        return UNIVERSAL_TAG_STRING[tag & 0x1F];
+        return value;
     }
-} // end class UniversalTag
+}

Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/tlv/Value.java Sun Sep  5 14:56:40 2010
@@ -38,14 +38,10 @@ import org.apache.directory.shared.i18n.
  */
 public class Value implements Serializable
 {
+    /** The serialVersion UID */
     private static final long serialVersionUID = 1L;
 
-    // ~ Instance fields
-    // ----------------------------------------------------------------------------
-
-    /**
-     * The data buffer. TODO Create a streamed data to store large data
-     */
+    /** The data buffer. */
     private byte[] data;
 
     /** The current position of the last byte in the data buffer */
@@ -57,47 +53,58 @@ public class Value implements Serializab
     /** The encoded byte for a FALSE value */
     public static final byte FALSE_VALUE = ( byte ) 0x00;
 
-    /** Pre-encoded PDUs for a TRUE and FALSE TLV */
+    /** 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 */
-    private static final int ONE_BYTE_MAX = ( 1 << 7 ) - 1; // 0x7F
-
+    /** 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 );
 
-    private static final int TWO_BYTE_MAX = ( 1 << 15 ) - 1; // 0x7FFF
+    /** 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 );
 
-    private static final int THREE_BYTE_MAX = ( 1 << 23 ) - 1; // 0x7FFFFF
+    /** 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 );
 
-    private static final long FOUR_BYTE_MAX = ( 1L << 31 ) - 1L; // 0x7FFFFFFF
+    /** 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 ); 
 
-    private static final long FIVE_BYTE_MAX = ( 1L << 39 ) - 1L; // 0x7FFFFFFFFF
+    /** 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 ); 
 
-    private static final long SIX_BYTE_MAX = ( 1L << 47 ) - 1L; // 0x7FFFFFFFFFFF
+    /** 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 ); 
 
-    private static final long SEVEN_BYTE_MAX = ( 1L << 55 ) - 1L; // 0x7FFFFFFFFFFFFF
+    /** 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 ); 
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
-     * The constructor.
+     * Creates a new Value from a byte[]
      * 
      * @param value the associated value
      */
@@ -111,7 +118,7 @@ public class Value implements Serializab
 
 
     /**
-     * The constructor.
+     * The default constructor.
      */
     public Value()
     {
@@ -445,7 +452,6 @@ public class Value implements Serializab
      *   -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.
      */
@@ -631,12 +637,12 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.OCTET_STRING_TAG );
+            buffer.put( UniversalTag.OCTET_STRING.getValue() );
 
             byte[] value = Asn1StringUtils.getBytesUtf8( string );
 
@@ -649,10 +655,11 @@ public class Value implements Serializab
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
+    
     /**
      * Encode a BIT STRING value
      * 
@@ -665,12 +672,12 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.BIT_STRING_TAG );
+            buffer.put( UniversalTag.BIT_STRING.getValue() );
             
             // The BitString length. We add one byte for the unused number 
             // of bits
@@ -682,7 +689,7 @@ public class Value implements Serializab
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -699,12 +706,12 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.OCTET_STRING_TAG );
+            buffer.put( UniversalTag.OCTET_STRING.getValue() );
 
             if ( ( bytes == null ) || ( bytes.length == 0 ) )
             {
@@ -718,7 +725,7 @@ public class Value implements Serializab
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -735,12 +742,12 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.OCTET_STRING_TAG );
+            buffer.put( UniversalTag.OCTET_STRING.getValue() );
             buffer.put( TLV.getBytes( oid.getOIDLength() ) );
 
             if ( oid.getOIDLength() != 0 )
@@ -750,7 +757,7 @@ public class Value implements Serializab
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -767,18 +774,18 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.INTEGER_TAG );
+            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 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -795,18 +802,18 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.INTEGER_TAG );
+            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 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -824,7 +831,7 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
@@ -835,7 +842,7 @@ public class Value implements Serializab
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -852,18 +859,18 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( UniversalTag.ENUMERATED_TAG );
+            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 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -880,16 +887,23 @@ public class Value implements Serializab
     {
         if ( buffer == null )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00003 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003 ) );
         }
 
         try
         {
-            buffer.put( bool ? ENCODED_TRUE : ENCODED_FALSE );
+            if ( bool )
+            {
+                buffer.put( ENCODED_TRUE );
+            }
+            else
+            {
+                buffer.put( ENCODED_FALSE );
+            }
         }
         catch ( BufferOverflowException boe )
         {
-            throw new EncoderException( I18n.err( I18n.ERR_00004 ) );
+            throw new EncoderException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004 ) );
         }
     }
 
@@ -901,8 +915,7 @@ public class Value implements Serializab
      */
     public String toString()
     {
-
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append( "DATA" );
 
         if ( data != null )
@@ -913,7 +926,6 @@ public class Value implements Serializab
         }
         else
         {
-
             return "[]";
         }
 

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Sun Sep  5 14:56:40 2010
@@ -37,8 +37,8 @@ public enum I18n
     // asn1
     ERR_BAD_TRANSITION_FROM_STATE_00001( "ERR_BAD_TRANSITION_FROM_STATE_00001" ),
     ERR_BAD_TRANSITION_00002( "ERR_BAD_TRANSITION_00002" ),
-    ERR_00003( "ERR_00003" ),
-    ERR_00004( "ERR_00004" ),
+    ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003( "ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003" ),
+    ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004( "ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004" ),
     ERR_LENGTH_OVERFLOW_00005( "ERR_LENGTH_OVERFLOW_00005" ),
     ERR_LENGTH_EXTENSION_RESERVED_00006( "ERR_LENGTH_EXTENSION_RESERVED_00006" ),
     ERR_TLV_NULL_00007( "ERR_TLV_NULL_00007" ),

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties (original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties Sun Sep  5 14:56:40 2010
@@ -21,8 +21,8 @@
 # asn1
 ERR_BAD_TRANSITION_FROM_STATE_00001=Bad transition from state {0}, tag {1}
 ERR_BAD_TRANSITION_00002=Bad transition !
-ERR_00003=Cannot put a PDU in a null buffer !
-ERR_00004=The PDU buffer size is too small !
+ERR_CANNOT_PUT_PDU_IN_NULL_BUFFER_00003=Cannot put a PDU in a null buffer !
+ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004=The PDU buffer size is too small !
 ERR_LENGTH_OVERFLOW_00005=Overflow : can't have more than 4 bytes long length
 ERR_LENGTH_EXTENSION_RESERVED_00006=Length reserved extension used
 ERR_TLV_NULL_00007=The current container TLV is null.

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemChecker.java Sun Sep  5 14:56:40 2010
@@ -96,11 +96,11 @@ public class ACIItemChecker
         }
         catch ( TokenStreamException e )
         {
-            throw new ParseException( I18n.err( I18n.ERR_00004, spec, e.getLocalizedMessage() ), 0 );
+            throw new ParseException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004, spec, e.getLocalizedMessage() ), 0 );
         }
         catch ( RecognitionException e )
         {
-            throw new ParseException( I18n.err( I18n.ERR_00004, spec, e.getLocalizedMessage() ), e.getColumn() );
+            throw new ParseException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004, spec, e.getLocalizedMessage() ), e.getColumn() );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java?rev=992800&r1=992799&r2=992800&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java Sun Sep  5 14:56:40 2010
@@ -117,11 +117,11 @@ public class ACIItemParser
         }
         catch ( TokenStreamException e )
         {
-            throw new ParseException( I18n.err( I18n.ERR_00004, spec, e.getLocalizedMessage() ), 0 );
+            throw new ParseException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004, spec, e.getLocalizedMessage() ), 0 );
         }
         catch ( RecognitionException e )
         {
-            throw new ParseException( I18n.err( I18n.ERR_00004, spec, e.getLocalizedMessage() ), e.getColumn() );
+            throw new ParseException( I18n.err( I18n.ERR_PDU_BUFFER_SIZE_TOO_SMALL_00004, spec, e.getLocalizedMessage() ), e.getColumn() );
         }
 
         return aCIItem;



Mime
View raw message