directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1028966 [7/9] - in /directory/shared/branches/shared-config: all/ dsml-engine/ dsml-parser/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ dsml-parser/src...
Date Sat, 30 Oct 2010 01:51:55 GMT
Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapStatesEnum.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapStatesEnum.java Sat Oct 30 01:51:50 2010
@@ -30,283 +30,132 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapStatesEnum implements States
+public enum LdapStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
-    public static final int START_STATE =                       0;
-    public static final int LDAP_MESSAGE_STATE =                1;
-    public static final int MESSAGE_ID_STATE =                  2;
-    public static final int BIND_REQUEST_STATE =                3;
-    public static final int BIND_RESPONSE_STATE =               4;
-    public static final int UNBIND_REQUEST_STATE =              5;
-    public static final int SEARCH_REQUEST_STATE =              6;
-    public static final int SEARCH_RESULT_ENTRY_STATE =         7;
-    public static final int SEARCH_RESULT_DONE_STATE =          8;
-    public static final int SEARCH_RESULT_REFERENCE_STATE =     9;
-    public static final int MODIFY_REQUEST_STATE =              10;
-    public static final int MODIFY_RESPONSE_STATE =             11;
-    public static final int ADD_REQUEST_STATE =                 12;
-    public static final int ADD_RESPONSE_STATE =                13;
-    public static final int DEL_REQUEST_STATE =                 14;
-    public static final int DEL_RESPONSE_STATE =                15;
-    public static final int MODIFY_DN_REQUEST_STATE =           16;
-    public static final int MODIFY_DN_RESPONSE_STATE =          17;
-    public static final int COMPARE_REQUEST_STATE =             18;
-    public static final int COMPARE_RESPONSE_STATE =            19;
-    public static final int ABANDON_REQUEST_STATE =             20;
-    public static final int EXTENDED_REQUEST_STATE =            21;
-    public static final int EXTENDED_RESPONSE_STATE =           22;
-    public static final int VERSION_STATE =                     23;
-    public static final int NAME_STATE =                        24;
-    public static final int SIMPLE_STATE =                      25;
-    public static final int SASL_STATE =                        26;
-    public static final int MECHANISM_STATE =                   27;
-    public static final int CREDENTIALS_STATE =                 28;
-    public static final int RESULT_CODE_BR_STATE =              29;
-    public static final int MATCHED_DN_BR_STATE =               30;
-    public static final int ERROR_MESSAGE_BR_STATE =            31;
-    public static final int REFERRALS_BR_STATE =                32;
-    public static final int REFERRAL_BR_STATE =                 33;
-    public static final int SERVER_SASL_CREDENTIALS_STATE =     34;
-    public static final int RESULT_CODE_STATE =                 35;
-    public static final int MATCHED_DN_STATE =                  36;
-    public static final int ERROR_MESSAGE_STATE =               37;
-    public static final int REFERRALS_STATE =                   38;
-    public static final int REFERRAL_STATE =                    39;
-    public static final int REQUEST_NAME_STATE =                40;
-    public static final int REQUEST_VALUE_STATE =               41;
-    public static final int RESPONSE_NAME_STATE =               42;
-    public static final int RESPONSE_STATE =                    43;
-    public static final int RESULT_CODE_ER_STATE =              44;
-    public static final int MATCHED_DN_ER_STATE =               45;
-    public static final int ERROR_MESSAGE_ER_STATE =            46;
-    public static final int REFERRALS_ER_STATE =                47;
-    public static final int REFERRAL_ER_STATE =                 48;
-    public static final int ENTRY_STATE =                       49;
-    public static final int ATTRIBUTES_STATE =                  50;
-    public static final int ATTRIBUTE_STATE =                   51;
-    public static final int TYPE_STATE =                        52;
-    public static final int VALUES_STATE =                      53;
-    public static final int VALUE_STATE =                       54;
-    public static final int OBJECT_STATE =                      55;
-    public static final int MODIFICATIONS_STATE =               56;
-    public static final int MODIFICATIONS_SEQ_STATE =           57;
-    public static final int OPERATION_STATE =                   58;
-    public static final int MODIFICATION_STATE =                59;
-    public static final int TYPE_MOD_STATE =                    60;
-    public static final int VALS_STATE =                        61;
-    public static final int ATTRIBUTE_VALUE_STATE =             62;
-    public static final int ENTRY_MOD_DN_STATE =                63;
-    public static final int NEW_RDN_STATE =                     64;
-    public static final int DELETE_OLD_RDN_STATE =              65;
-    public static final int NEW_SUPERIOR_STATE =                66;
-    public static final int ENTRY_COMP_STATE =                  67;
-    public static final int AVA_STATE =                         68;
-    public static final int ATTRIBUTE_DESC_STATE =              69;
-    public static final int ASSERTION_VALUE_STATE =             70;
-    public static final int BASE_OBJECT_STATE =                 71;
-    public static final int SCOPE_STATE =                       72;
-    public static final int DEREF_ALIAS_STATE =                 73;
-    public static final int SIZE_LIMIT_STATE =                  74;
-    public static final int TIME_LIMIT_STATE =                  75;
-    public static final int TYPES_ONLY_STATE =                  76;
-    public static final int AND_STATE =                         77;
-    public static final int OR_STATE =                          78;
-    public static final int NOT_STATE =                         79;
-    public static final int EQUALITY_MATCH_STATE =              80;
-    public static final int SUBSTRING_FILTER_STATE =            81;
-    public static final int GREATER_OR_EQUAL_STATE =            82;
-    public static final int LESS_OR_EQUAL_STATE =               83;
-    public static final int PRESENT_STATE =                     84;
-    public static final int APPROX_MATCH_STATE =                85;
-    public static final int EXTENSIBLE_MATCH_STATE =            86;
-    public static final int ATTRIBUTE_DESC_FILTER_STATE =       87;
-    public static final int ASSERTION_VALUE_FILTER_STATE =      88;
-    public static final int ATTRIBUTE_DESCRIPTION_LIST_STATE =  89;
-    public static final int ATTRIBUTE_DESCRIPTION_STATE =       90;
-    public static final int TYPE_SUBSTRING_STATE =              91;
-    public static final int SUBSTRINGS_STATE =                  92;
-    public static final int INITIAL_STATE =                     93;
-    public static final int ANY_STATE =                         94;
-    public static final int FINAL_STATE =                       95;
-    public static final int MATCHING_RULE_STATE =               96;
-    public static final int TYPE_MATCHING_RULE_STATE =          97;
-    public static final int MATCH_VALUE_STATE =                 98;
-    public static final int DN_ATTRIBUTES_STATE =               99;
-    public static final int OBJECT_NAME_STATE =                 100;
-    public static final int ATTRIBUTES_SR_STATE =               101;
-    public static final int PARTIAL_ATTRIBUTES_LIST_STATE =     102;
-    public static final int TYPE_SR_STATE =                     103;
-    public static final int VALS_SR_STATE =                     104;
-    public static final int ATTRIBUTE_VALUE_SR_STATE =          105;
-    public static final int REFERENCE_STATE =                   106;
-    public static final int CONTROLS_STATE =                    107;
-    public static final int CONTROL_STATE =                     108;
-    public static final int CONTROL_TYPE_STATE =                109;
-    public static final int CRITICALITY_STATE =                 110;
-    public static final int CONTROL_VALUE_STATE =               111;
-    public static final int INTERMEDIATE_RESPONSE_STATE =       112;
-    public static final int INTERMEDIATE_RESPONSE_NAME_STATE =  113;
-    public static final int INTERMEDIATE_RESPONSE_VALUE_STATE = 114;
-    
-    
-    public static final int LAST_LDAP_STATE = 115;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] LDAP_MESSAGE_STRING = new String[]
-        { 
-        "START_STATE",
-        "LDAP_MESSAGE_STATE",
-        "MESSAGE_ID_STATE",
-        "BIND_REQUEST_STATE",
-        "BIND_RESPONSE_STATE",
-        "UNBIND_REQUEST_STATE",
-        "SEARCH_REQUEST_STATE",
-        "SEARCH_RESULT_ENTRY_STATE",
-        "SEARCH_RESULT_DONE_STATE",
-        "SEARCH_RESULT_REFERENCE_STATE",
-        "MODIFY_REQUEST_STATE",
-        "MODIFY_RESPONSE_STATE",
-        "ADD_REQUEST_STATE",
-        "ADD_RESPONSE_STATE",
-        "DEL_REQUEST_STATE",
-        "DEL_RESPONSE_STATE",
-        "MODIFY_DN_REQUEST_STATE",
-        "MODIFY_DN_RESPONSE_STATE",
-        "COMPARE_REQUEST_STATE",
-        "COMPARE_RESPONSE_STATE",
-        "ABANDON_REQUEST_STATE",
-        "EXTENDED_REQUEST_STATE",
-        "EXTENDED_RESPONSE_STATE",
-        "VERSION_STATE",
-        "NAME_STATE",
-        "SIMPLE_STATE",
-        "SASL_STATE",
-        "MECHANISM_STATE",
-        "CREDENTIALS_STATE",
-        "RESULT_CODE_BR_STATE",
-        "MATCHED_DN_BR_STATE",
-        "ERROR_MESSAGE_BR_STATE",
-        "REFERRALS_BR_STATE",
-        "REFERRAL_BR_STATE",
-        "SERVER_SASL_CREDENTIALS_STATE",
-        "RESULT_CODE_STATE",
-        "MATCHED_DN_STATE",
-        "ERROR_MESSAGE_STATE",
-        "REFERRALS_STATE",
-        "REFERRAL_STATE",
-        "REQUEST_NAME_STATE",
-        "REQUEST_VALUE_STATE",
-        "RESPONSE_NAME_STATE",
-        "RESPONSE_STATE",
-        "RESULT_CODE_ER_STATE",
-        "MATCHED_DN_ER_STATE",
-        "ERROR_MESSAGE_ER_STATE",
-        "REFERRALS_ER_STATE",
-        "REFERRAL_ER_STATE",
-        "ENTRY_STATE",
-        "ATTRIBUTES_STATE",
-        "ATTRIBUTE_STATE",
-        "TYPE_STATE",
-        "VALUES_STATE",
-        "VALUE_STATE",
-        "OBJECT_STATE",
-        "MODIFICATIONS_STATE",
-        "MODIFICATIONS_SEQ_STATE",
-        "OPERATION_STATE",
-        "MODIFICATION_STATE",
-        "TYPE_MOD_STATE",
-        "VALS_STATE",
-        "ATTRIBUTE_VALUE_STATE",
-        "ENTRY_MOD_DN_STATE",
-        "NEW_RDN_STATE",
-        "DELETE_OLD_RDN_STATE",
-        "NEW_SUPERIOR_STATE",
-        "ENTRY_COMP_STATE",
-        "AVA_STATE",
-        "ATTRIBUTE_DESC_STATE",
-        "ASSERTION_VALUE_STATE",
-        "BASE_OBJECT_STATE",
-        "SCOPE_STATE",
-        "DEREF_ALIAS_STATE",
-        "SIZE_LIMIT_STATE",
-        "TIME_LIMIT_STATE",
-        "TYPES_ONLY_STATE",
-        "AND_STATE",
-        "OR_STATE",
-        "NOT_STATE",
-        "EQUALITY_MATCH_STATE",
-        "SUBSTRINGS_FILTER_STATE",
-        "GREATER_OR_EQUAL_STATE",
-        "LESS_OR_EQUAL_STATE",
-        "PRESENT_STATE",
-        "APPROX_MATCH_STATE",
-        "EXTENSIBLE_MATCH_STATE",
-        "SUBSTRING_FILTER_STATE",
-        "ATTRIBUTE_DESC_FILTER_STATE",
-        "ASSERTION_VALUE_FILTER_STATE",
-        "ATTRIBUTE_DESCRIPTION_LIST_STATE",
-        "ATTRIBUTE_DESCRIPTION_STATE",
-        "TYPE_SUBSTRING_STATE",
-        "SUBSTRINGS_STATE",
-        "INITIAL_STATE",
-        "ANY_STATE",
-        "FINAL_STATE",
-        "MATCHING_RULE_STATE",
-        "TYPE_MATCHING_RULE_STATE",
-        "MATCH_VALUE_STATE",
-        "DN_ATTRIBUTES_STATE",
-        "OBJECT_NAME_STATE",
-        "ATTRIBUTES_SR_STATE",
-        "PARTIAL_ATTRIBUTES_LIST_STATE",
-        "TYPE_SR_STATE",
-        "VALS_SR_STATE",
-        "ATTRIBUTE_VALUE_SR_STATE",
-        "REFERENCE_STATE",
-        "CONTROLS_STATE",
-        "CONTROL_STATE",
-        "CONTROL_TYPE_STATE",
-        "CRITICALITY_STATE",
-        "CONTROL_VALUE_STATE",
-        "INTERMEDIATE_RESPONSE_STATE",
-        "INTERMEDIATE_RESPONSE_NAME_STATE",
-        "INTERMEDIATE_RESPONSE_VALUE_STATE",
-        "LAST_LDAP_STATE",
-        };
-
-    /** The instance */
-    private static LdapStatesEnum instance = new LdapStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private LdapStatesEnum()
-    {
-    }
 
+    /** The END_STATE */
+    END_STATE,
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
-
+    START_STATE,
+    LDAP_MESSAGE_STATE,
+    MESSAGE_ID_STATE,
+    BIND_REQUEST_STATE,
+    BIND_RESPONSE_STATE,
+    UNBIND_REQUEST_STATE,
+    SEARCH_REQUEST_STATE,
+    SEARCH_RESULT_ENTRY_STATE,
+    SEARCH_RESULT_DONE_STATE,
+    SEARCH_RESULT_REFERENCE_STATE,
+    MODIFY_REQUEST_STATE,
+    MODIFY_RESPONSE_STATE,
+    ADD_REQUEST_STATE,
+    ADD_RESPONSE_STATE,
+    DEL_REQUEST_STATE,
+    DEL_RESPONSE_STATE,
+    MODIFY_DN_REQUEST_STATE,
+    MODIFY_DN_RESPONSE_STATE,
+    COMPARE_REQUEST_STATE,
+    COMPARE_RESPONSE_STATE,
+    ABANDON_REQUEST_STATE,
+    EXTENDED_REQUEST_STATE,
+    EXTENDED_RESPONSE_STATE,
+    VERSION_STATE,
+    NAME_STATE,
+    SIMPLE_STATE,
+    SASL_STATE,
+    MECHANISM_STATE,
+    CREDENTIALS_STATE,
+    RESULT_CODE_BR_STATE,
+    MATCHED_DN_BR_STATE,
+    ERROR_MESSAGE_BR_STATE,
+    REFERRALS_BR_STATE,
+    REFERRAL_BR_STATE,
+    SERVER_SASL_CREDENTIALS_STATE,
+    RESULT_CODE_STATE,
+    MATCHED_DN_STATE,
+    ERROR_MESSAGE_STATE,
+    REFERRALS_STATE,
+    REFERRAL_STATE,
+    REQUEST_NAME_STATE,
+    REQUEST_VALUE_STATE,
+    RESPONSE_NAME_STATE,
+    RESPONSE_STATE,
+    RESULT_CODE_ER_STATE,
+    MATCHED_DN_ER_STATE,
+    ERROR_MESSAGE_ER_STATE,
+    REFERRALS_ER_STATE,
+    REFERRAL_ER_STATE,
+    ENTRY_STATE,
+    ATTRIBUTES_STATE,
+    ATTRIBUTE_STATE,
+    TYPE_STATE,
+    VALUES_STATE,
+    VALUE_STATE,
+    OBJECT_STATE,
+    MODIFICATIONS_STATE,
+    MODIFICATIONS_SEQ_STATE,
+    OPERATION_STATE,
+    MODIFICATION_STATE,
+    TYPE_MOD_STATE,
+    VALS_STATE,
+    ATTRIBUTE_VALUE_STATE,
+    ENTRY_MOD_DN_STATE,
+    NEW_RDN_STATE,
+    DELETE_OLD_RDN_STATE,
+    NEW_SUPERIOR_STATE,
+    ENTRY_COMP_STATE,
+    AVA_STATE,
+    ATTRIBUTE_DESC_STATE,
+    ASSERTION_VALUE_STATE,
+    BASE_OBJECT_STATE,
+    SCOPE_STATE,
+    DEREF_ALIAS_STATE,
+    SIZE_LIMIT_STATE,
+    TIME_LIMIT_STATE,
+    TYPES_ONLY_STATE,
+    AND_STATE,
+    OR_STATE,
+    NOT_STATE,
+    EQUALITY_MATCH_STATE,
+    SUBSTRING_FILTER_STATE,
+    GREATER_OR_EQUAL_STATE,
+    LESS_OR_EQUAL_STATE,
+    PRESENT_STATE,
+    APPROX_MATCH_STATE,
+    EXTENSIBLE_MATCH_STATE,
+    ATTRIBUTE_DESC_FILTER_STATE,
+    ASSERTION_VALUE_FILTER_STATE,
+    ATTRIBUTE_DESCRIPTION_LIST_STATE,
+    ATTRIBUTE_DESCRIPTION_STATE,
+    TYPE_SUBSTRING_STATE,
+    SUBSTRINGS_STATE,
+    INITIAL_STATE,
+    ANY_STATE,
+    FINAL_STATE,
+    MATCHING_RULE_STATE,
+    TYPE_MATCHING_RULE_STATE,
+    MATCH_VALUE_STATE,
+    DN_ATTRIBUTES_STATE,
+    OBJECT_NAME_STATE,
+    ATTRIBUTES_SR_STATE,
+    PARTIAL_ATTRIBUTES_LIST_STATE,
+    TYPE_SR_STATE,
+    VALS_SR_STATE,
+    ATTRIBUTE_VALUE_SR_STATE,
+    REFERENCE_STATE,
+    CONTROLS_STATE,
+    CONTROL_STATE,
+    CONTROL_TYPE_STATE,
+    CRITICALITY_STATE,
+    CONTROL_VALUE_STATE,
+    INTERMEDIATE_RESPONSE_STATE,
+    INTERMEDIATE_RESPONSE_NAME_STATE,
+    INTERMEDIATE_RESPONSE_VALUE_STATE,
+    LAST_LDAP_STATE;
 
+    
     /**
      * Get the grammar name
      * 
@@ -348,6 +197,24 @@ public class LdapStatesEnum implements S
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "LDAP_MESSAGE_END_STATE" : LDAP_MESSAGE_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "LDAP_MESSAGE_END_STATE" : name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public LdapStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlContainer.java Sat Oct 30 01:51:50 2010
@@ -39,7 +39,7 @@ public class PasswordPolicyResponseContr
         super();
         stateStack = new int[1];
         grammar = PasswordPolicyResponseControlGrammar.getInstance();
-        states = PasswordPolicyResponseControlStates.getInstance();
+        setTransition( PasswordPolicyResponseControlStates.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -26,7 +26,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -57,12 +56,11 @@ public class PasswordPolicyResponseContr
     private PasswordPolicyResponseControlGrammar()
     {
         setName( PasswordPolicyResponseControlGrammar.class.getName() );
-        setStatesEnum( PasswordPolicyResponseControlStates.getInstance() );
 
-        super.transitions = new GrammarTransition[PasswordPolicyResponseControlStates.END_STATE][256];
-
-        super.transitions[States.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            States.INIT_GRAMMAR_STATE, PasswordPolicyResponseControlStates.START_STATE, UniversalTag.SEQUENCE.getValue(),
+        super.transitions = new GrammarTransition[PasswordPolicyResponseControlStates.END_STATE.ordinal()][256];
+        
+        super.transitions[PasswordPolicyResponseControlStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            PasswordPolicyResponseControlStates.START_STATE, PasswordPolicyResponseControlStates.START_STATE, UniversalTag.SEQUENCE.getValue(),
             new GrammarAction( "Initialization" )
             {
                 public void action( Asn1Container container ) throws DecoderException
@@ -74,7 +72,7 @@ public class PasswordPolicyResponseContr
                 }
             } );
 
-        super.transitions[PasswordPolicyResponseControlStates.START_STATE][PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG
+        super.transitions[PasswordPolicyResponseControlStates.START_STATE.ordinal()][PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG
             .getValue()] = new GrammarTransition( PasswordPolicyResponseControlStates.START_STATE,
             PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE,
             PasswordPolicyResponseControlTags.TIME_BEFORE_EXPIRATION_TAG.getValue(), new GrammarAction(
@@ -106,7 +104,7 @@ public class PasswordPolicyResponseContr
                 }
             } );
 
-        super.transitions[PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
+        super.transitions[PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
             PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE, PasswordPolicyResponseControlStates.END_STATE,
             UniversalTag.ENUMERATED.getValue(), new GrammarAction( "set ppolicy error value" )
             {
@@ -120,7 +118,7 @@ public class PasswordPolicyResponseContr
                 }
             } );
 
-        super.transitions[PasswordPolicyResponseControlStates.START_STATE][PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG
+        super.transitions[PasswordPolicyResponseControlStates.START_STATE.ordinal()][PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG
             .getValue()] = new GrammarTransition( PasswordPolicyResponseControlStates.START_STATE,
             PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE,
             PasswordPolicyResponseControlTags.GRACE_AUTHNS_REMAINING_TAG.getValue(), new GrammarAction(
@@ -152,7 +150,7 @@ public class PasswordPolicyResponseContr
                 }
             } );
 
-        super.transitions[PasswordPolicyResponseControlStates.START_STATE][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
+        super.transitions[PasswordPolicyResponseControlStates.START_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
             PasswordPolicyResponseControlStates.START_STATE, PasswordPolicyResponseControlStates.PPOLICY_ERROR_STATE,
             UniversalTag.ENUMERATED.getValue(), new GrammarAction( "set ppolicy error value" )
             {
@@ -165,7 +163,6 @@ public class PasswordPolicyResponseContr
                     ppolicyRespContainer.setGrammarEndAllowed( true );
                 }
             } );
-
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlStates.java Sat Oct 30 01:51:50 2010
@@ -30,45 +30,21 @@ import org.apache.directory.shared.asn1.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PasswordPolicyResponseControlStates implements States
+public enum PasswordPolicyResponseControlStates implements States
 {
 
-    public static final int START_STATE = 0;
+    /** The ending state for every grammars */
+    GRAMMAR_END,
 
-    public static final int PPOLICY_TIME_BEFORE_EXPIRATION_STATE = 1;
+    START_STATE,
 
-    public static final int PPOLICY_GRACE_AUTHNS_REMAINING_STATE = 2;
+    PPOLICY_TIME_BEFORE_EXPIRATION_STATE,
 
-    public static final int PPOLICY_ERROR_STATE = 3;
+    PPOLICY_GRACE_AUTHNS_REMAINING_STATE,
 
-    public static final int END_STATE = 4;
-
-    private static PasswordPolicyResponseControlStates instance = new PasswordPolicyResponseControlStates();
-
-    private static final String[] PPOLICY_STATE_STRING = new String[]
-        { 
-          "START_STATE",
-          "PPOLICY_TIME_BEFORE_EXPIRATION_STATE",
-          "PPOLICY_GRACE_AUTHNS_REMAINING_STATE",
-          "PPOLICY_ERROR_STATE"
-        };
-
-
-    private PasswordPolicyResponseControlStates()
-    {
-    }
-
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
+    PPOLICY_ERROR_STATE,
 
+    END_STATE;
 
     /**
      * {@inheritDoc}
@@ -83,7 +59,6 @@ public class PasswordPolicyResponseContr
         return "UNKNOWN_GRAMMAR";
     }
 
-
     /**
      * {@inheritDoc}
      */
@@ -98,6 +73,24 @@ public class PasswordPolicyResponseContr
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "PASSWORD_POLICY_RESPONSE_CONTROL_GRAMMAR" : PPOLICY_STATE_STRING[state] );
+        return ( ( state == GRAMMAR_END.ordinal() ) ? "PASSWORD_POLICY_RESPONSE_CONTROL_GRAMMAR" : name() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public PasswordPolicyResponseControlStates getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlContainer.java Sat Oct 30 01:51:50 2010
@@ -45,7 +45,7 @@ public class SyncDoneValueControlContain
         super();
         stateStack = new int[1];
         grammar = SyncDoneValueControlGrammar.getInstance();
-        states = SyncDoneValueControlStatesEnum.getInstance();
+        setTransition( SyncDoneValueControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -25,7 +25,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -73,9 +72,8 @@ public final class SyncDoneValueControlG
     private SyncDoneValueControlGrammar()
     {
         setName( SyncDoneValueControlGrammar.class.getName() );
-        setStatesEnum( SyncDoneValueControlStatesEnum.getInstance() );
 
-        super.transitions = new GrammarTransition[SyncDoneValueControlStatesEnum.LAST_SYNC_DONE_VALUE_STATE][256];
+        super.transitions = new GrammarTransition[SyncDoneValueControlStatesEnum.LAST_SYNC_DONE_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncDoneValue sequence
@@ -84,9 +82,9 @@ public final class SyncDoneValueControlG
          *     
          * Initialize the syncDoneValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            States.INIT_GRAMMAR_STATE, SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, UniversalTag.SEQUENCE.getValue(),
-            new GrammarAction( "Initiaization" )
+        super.transitions[SyncDoneValueControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            SyncDoneValueControlStatesEnum.START_STATE, SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, UniversalTag.SEQUENCE.getValue(),
+            new GrammarAction( "Initialization" )
             {
                 public void action( Asn1Container container ) throws DecoderException
                 {
@@ -104,7 +102,7 @@ public final class SyncDoneValueControlG
          *    ....
          * }
          */
-        super.transitions[SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, SyncDoneValueControlStatesEnum.COOKIE_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncDoneValueControl cookie" )
             {
@@ -163,7 +161,7 @@ public final class SyncDoneValueControlG
          *    refreshDeletes BOOLEAN DEFAULT FALSE
          * }
          */
-        super.transitions[SyncDoneValueControlStatesEnum.COOKIE_STATE][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
+        super.transitions[SyncDoneValueControlStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
             SyncDoneValueControlStatesEnum.COOKIE_STATE, SyncDoneValueControlStatesEnum.REFRESH_DELETES_STATE,
             UniversalTag.BOOLEAN.getValue(), refreshDeletesTagAction );
         
@@ -174,7 +172,7 @@ public final class SyncDoneValueControlG
          *    refreshDeletes BOOLEAN DEFAULT FALSE
          * }
          */
-        super.transitions[SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
+        super.transitions[SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
             SyncDoneValueControlStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, SyncDoneValueControlStatesEnum.REFRESH_DELETES_STATE,
             UniversalTag.BOOLEAN.getValue(), refreshDeletesTagAction );
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlStatesEnum.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncDoneValue/SyncDoneValueControlStatesEnum.java Sat Oct 30 01:51:50 2010
@@ -27,55 +27,28 @@ import org.apache.directory.shared.asn1.
 /**
  * ASN.1 grammer constants of SyncDoneValueControl.
  * 
- * TODO: should this be an enum?
- *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncDoneValueControlStatesEnum implements States
+public enum SyncDoneValueControlStatesEnum implements States
 {
+
+    /** The END_STATE */
+    END_STATE,
+    
     /***/
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** sequence start state */
-    public static final int SYNC_DONE_VALUE_SEQUENCE_STATE = 1;
+    SYNC_DONE_VALUE_SEQUENCE_STATE,
 
     /** cookie value state */
-    public static final int COOKIE_STATE = 2;
+    COOKIE_STATE,
 
     /** refreshDeletes value state */
-    public static final int REFRESH_DELETES_STATE = 3;
+    REFRESH_DELETES_STATE,
 
     /** terminal state */
-    public static final int LAST_SYNC_DONE_VALUE_STATE = 4;
-
-    /** A string representation of all the states */
-    private static final String[] SYNC_DONE_VALUE_STRING = new String[]
-       {
-           "START_STATE",
-           "SYNC_DONE_VALUE_SEQUENCE_STATE",
-           "COOKIE_STATE",
-           "REFRESH_DELETES_STATE",
-       };
-
-    /** The instance */
-    private static SyncDoneValueControlStatesEnum instance = new SyncDoneValueControlStatesEnum();
-
-
-    private SyncDoneValueControlStatesEnum()
-    {
-    }
-
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
-
+    LAST_SYNC_DONE_VALUE_STATE;
 
     /**
      * Get the grammar name
@@ -114,7 +87,24 @@ public final class SyncDoneValueControlS
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "SYNC_DONE_VALUE_GRAMMAR" : SYNC_DONE_VALUE_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "SYNC_DONE_VALUE_GRAMMAR" : this.name() );
     }
 
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SyncDoneValueControlStatesEnum getStartState()
+    {
+        return START_STATE;
+    }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlContainer.java Sat Oct 30 01:51:50 2010
@@ -43,7 +43,7 @@ public class SyncInfoValueControlContain
         super();
         stateStack = new int[1];
         grammar = SyncInfoValueControlGrammar.getInstance();
-        states = SyncInfoValueControlStatesEnum.getInstance();
+        setTransition( SyncInfoValueControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -25,7 +25,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -81,10 +80,9 @@ public final class SyncInfoValueControlG
     private SyncInfoValueControlGrammar()
     {
         setName( SyncInfoValueControlGrammar.class.getName() );
-        setStatesEnum( SyncInfoValueControlStatesEnum.getInstance() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE][256];
+        super.transitions = new GrammarTransition[SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncInfoValue newCookie choice
@@ -94,8 +92,8 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the syncInfoValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][SyncInfoValueTags.NEW_COOKIE_TAG.getValue()] = 
-            new GrammarTransition( States.INIT_GRAMMAR_STATE, 
+        super.transitions[SyncInfoValueControlStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.NEW_COOKIE_TAG.getValue()] = 
+            new GrammarTransition( SyncInfoValueControlStatesEnum.START_STATE, 
                                     SyncInfoValueControlStatesEnum.NEW_COOKIE_STATE, 
                                     SyncInfoValueTags.NEW_COOKIE_TAG.getValue(), 
                 new GrammarAction( "NewCookie choice for SyncInfoValueControl" )
@@ -135,8 +133,8 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the syncInfoValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][SyncInfoValueTags.REFRESH_DELETE_TAG.getValue()] = 
-            new GrammarTransition( States.INIT_GRAMMAR_STATE, 
+        super.transitions[SyncInfoValueControlStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_DELETE_TAG.getValue()] = 
+            new GrammarTransition( SyncInfoValueControlStatesEnum.START_STATE, 
                                     SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE, 
                                     SyncInfoValueTags.REFRESH_DELETE_TAG.getValue(), 
                 new GrammarAction( "RefreshDelete choice for SyncInfoValueControl" )
@@ -164,7 +162,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the cookie object
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE, 
                                     SyncInfoValueControlStatesEnum.REFRESH_DELETE_COOKIE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(), 
@@ -203,7 +201,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDone flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_COOKIE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_DELETE_COOKIE_STATE, 
                                     SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -256,7 +254,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDone flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_DELETE_STATE, 
                                     SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -309,8 +307,8 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the syncInfoValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue()] = 
-            new GrammarTransition( States.INIT_GRAMMAR_STATE, 
+        super.transitions[SyncInfoValueControlStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue()] = 
+            new GrammarTransition( SyncInfoValueControlStatesEnum.START_STATE, 
                                     SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE, 
                                     SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue(), 
                 new GrammarAction( "RefreshDelete choice for SyncInfoValueControl" )
@@ -338,7 +336,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the cookie object
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE, 
                                     SyncInfoValueControlStatesEnum.REFRESH_PRESENT_COOKIE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(), 
@@ -379,7 +377,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDone flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_COOKIE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_PRESENT_COOKIE_STATE, 
                                     SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -432,7 +430,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDone flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.REFRESH_PRESENT_STATE, 
                                     SyncInfoValueControlStatesEnum.LAST_SYNC_INFO_VALUE_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -484,8 +482,8 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the syncInfoValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][SyncInfoValueTags.SYNC_ID_SET_TAG.getValue()] = 
-            new GrammarTransition( States.INIT_GRAMMAR_STATE, 
+        super.transitions[SyncInfoValueControlStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.SYNC_ID_SET_TAG.getValue()] = 
+            new GrammarTransition( SyncInfoValueControlStatesEnum.START_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE, 
                                     SyncInfoValueTags.SYNC_ID_SET_TAG.getValue(), 
                 new GrammarAction( "SyncIdSet choice for SyncInfoValueControl" )
@@ -510,7 +508,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the cookie object
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(), 
@@ -546,7 +544,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDeletes flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -592,7 +590,7 @@ public final class SyncInfoValueControlG
          *     
          * Load the refreshDeletes flag
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE, 
                                     UniversalTag.BOOLEAN.getValue(), 
@@ -638,7 +636,7 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the UUID set : no action associated, except allowing a grammar end
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE][UniversalTag.SET.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.SET.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE, 
                                     UniversalTag.SET.getValue(), 
@@ -664,7 +662,7 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the UUID set : no action associated
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE][UniversalTag.SET.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.SET.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_COOKIE_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE, 
                                     UniversalTag.SET.getValue(),
@@ -690,7 +688,7 @@ public final class SyncInfoValueControlG
          *     
          * Initialize the UUID set : no action associated
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE][UniversalTag.SET.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE.ordinal()][UniversalTag.SET.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE, 
                                     UniversalTag.SET.getValue(), 
@@ -716,7 +714,7 @@ public final class SyncInfoValueControlG
          *     
          * Add the first UUID in the UUIDs list
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_UUID_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(), 
@@ -763,7 +761,7 @@ public final class SyncInfoValueControlG
          *     
          * Add a new UUID in the UUIDs list
          */
-        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_UUID_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncInfoValueControlStatesEnum.SYNC_ID_SET_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncInfoValueControlStatesEnum.SYNC_ID_SET_UUID_STATE, 
                                     SyncInfoValueControlStatesEnum.SYNC_ID_SET_UUID_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(), 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlStatesEnum.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncInfoValue/SyncInfoValueControlStatesEnum.java Sat Oct 30 01:51:50 2010
@@ -28,108 +28,60 @@ import org.apache.directory.shared.asn1.
  * This class store the SyncInfoValueControl's grammar constants. It is also used for
  * debugging purposes.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncInfoValueControlStatesEnum implements States
+public enum SyncInfoValueControlStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
+    /** The END_STATE */
+    END_STATE,
+
     // =========================================================================
     // SyncRequestValue control grammar states
     // =========================================================================
     /** Initial state */
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** NewCookie state */
-    public static final int NEW_COOKIE_STATE = 1;
+    NEW_COOKIE_STATE,
 
     /** RefreshDelete state */
-    public static final int REFRESH_DELETE_STATE = 2;
+    REFRESH_DELETE_STATE,
     
     /** RefreshDelete cookie state */
-    public static final int REFRESH_DELETE_COOKIE_STATE = 3;
+    REFRESH_DELETE_COOKIE_STATE,
     
     /** RefreshDelete refreshDone state */
-    public static final int REFRESH_DELETE_REFRESH_DONE_STATE = 4;
+    REFRESH_DELETE_REFRESH_DONE_STATE,
     
     /** RefreshPresent state */
-    public static final int REFRESH_PRESENT_STATE = 5;
+    REFRESH_PRESENT_STATE,
     
     /** RefreshPresent cookie state */
-    public static final int REFRESH_PRESENT_COOKIE_STATE = 6;
+    REFRESH_PRESENT_COOKIE_STATE,
     
     /** RefreshPresent refreshDone state */
-    public static final int REFRESH_PRESENT_REFRESH_DONE_STATE = 7;
+    REFRESH_PRESENT_REFRESH_DONE_STATE,
     
     /** SyncIdSet state */
-    public static final int SYNC_ID_SET_STATE = 8;
+    SYNC_ID_SET_STATE,
     
     /** SyncIdSet cookie state */
-    public static final int SYNC_ID_SET_COOKIE_STATE = 9;
+    SYNC_ID_SET_COOKIE_STATE,
     
     /** SyncIdSet refreshDone state */
-    public static final int SYNC_ID_SET_REFRESH_DELETES_STATE = 10;
+    SYNC_ID_SET_REFRESH_DELETES_STATE,
     
     /** SyncIdSet SET OF UUIDs state */
-    public static final int SYNC_ID_SET_SET_OF_UUIDS_STATE = 11;
+    SYNC_ID_SET_SET_OF_UUIDS_STATE,
     
     /** SyncIdSet UUID state */
-    public static final int SYNC_ID_SET_UUID_STATE = 12;
+    SYNC_ID_SET_UUID_STATE,
 
     /** terminal state */
-    public static final int LAST_SYNC_INFO_VALUE_STATE = 13;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] SYNC_INFO_VALUE_STRING = new String[]
-        { 
-            "START_STATE",
-            "NEW_COOKIE_STATE",
-            "REFRESH_DELETE_STATE",
-            "REFRESH_DELETE_COOKIE_STATE",
-            "REFRESH_DELETE_REFRESH_DONE_STATE",
-            "REFRESH_PRESENT_STATE",
-            "REFRESH_PRESENT_COOKIE_STATE",
-            "REFRESH_PRESENT_REFRESH_DONE_STATE",
-            "SYNC_ID_SET_STATE",
-            "SYNC_ID_SET_COOKIE_STATE",
-            "SYNC_ID_SET_REFRESH_DELETES_STATE",
-            "SYNC_ID_SET_SET_OF_UUIDS_STATE",
-            "int SYNC_ID_SET_UUID_STATE"
-        };
-
-    /** The instance */
-    private static SyncInfoValueControlStatesEnum instance = new SyncInfoValueControlStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private SyncInfoValueControlStatesEnum()
-    {
-    }
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
+    LAST_SYNC_INFO_VALUE_STATE;
 
 
     /**
@@ -169,6 +121,24 @@ public final class SyncInfoValueControlS
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "SYNC_INFO_VALUE_END_STATE" : SYNC_INFO_VALUE_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "SYNC_INFO_VALUE_END_STATE" : this.name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SyncInfoValueControlStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java Sat Oct 30 01:51:50 2010
@@ -43,7 +43,7 @@ public class SyncRequestValueControlCont
         super();
         stateStack = new int[1];
         grammar = SyncRequestValueControlGrammar.getInstance();
-        states = SyncRequestValueControlStatesEnum.getInstance();
+        setTransition( SyncRequestValueControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -25,7 +25,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -77,10 +76,9 @@ public final class SyncRequestValueContr
     private SyncRequestValueControlGrammar()
     {
         setName( SyncRequestValueControlGrammar.class.getName() );
-        setStatesEnum( SyncRequestValueControlStatesEnum.getInstance() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncRequestValueControlStatesEnum.LAST_SYNC_REQUEST_VALUE_STATE][256];
+        super.transitions = new GrammarTransition[SyncRequestValueControlStatesEnum.LAST_SYNC_REQUEST_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncRequestValue sequence
@@ -89,8 +87,8 @@ public final class SyncRequestValueContr
          *     
          * Initialize the syncRequestValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( States.INIT_GRAMMAR_STATE, 
+        super.transitions[SyncRequestValueControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( SyncRequestValueControlStatesEnum.START_STATE, 
                                     SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), 
                 null );
@@ -109,7 +107,7 @@ public final class SyncRequestValueContr
          *     
          * Stores the mode value
          */
-        super.transitions[SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE][UniversalTag.ENUMERATED.getValue()] = 
+        super.transitions[SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = 
             new GrammarTransition( SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
                 SyncRequestValueControlStatesEnum.MODE_STATE, 
                 UniversalTag.ENUMERATED.getValue(),
@@ -158,7 +156,7 @@ public final class SyncRequestValueContr
          *     
          * Stores the cookie
          */
-        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
                                     SyncRequestValueControlStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction( "Set SyncRequestValueControl cookie" )
@@ -192,7 +190,7 @@ public final class SyncRequestValueContr
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
                                     SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )
@@ -235,7 +233,7 @@ public final class SyncRequestValueContr
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncRequestValueControlStatesEnum.COOKIE_STATE][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SyncRequestValueControlStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SyncRequestValueControlStatesEnum.COOKIE_STATE,
                                     SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java Sat Oct 30 01:51:50 2010
@@ -28,77 +28,36 @@ import org.apache.directory.shared.asn1.
  * This class store the SyncRequestValueControl's grammar constants. It is also used for
  * debugging purposes.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncRequestValueControlStatesEnum implements States
+public enum SyncRequestValueControlStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
+    /** The END_STATE */
+    END_STATE,
+
     // =========================================================================
     // SyncRequestValue control grammar states
     // =========================================================================
     /** Initial state */
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** Sequence Value */
-    public static final int SYNC_REQUEST_VALUE_SEQUENCE_STATE = 1;
+    SYNC_REQUEST_VALUE_SEQUENCE_STATE,
 
     /** mode Value */
-    public static final int MODE_STATE = 2;
+    MODE_STATE,
     
     /** cookie Value */
-    public static final int COOKIE_STATE = 3;
+    COOKIE_STATE,
 
     /** reloadHint Value */
-    public static final int RELOAD_HINT_STATE = 4;
+    RELOAD_HINT_STATE,
 
     /** terminal state */
-    public static final int LAST_SYNC_REQUEST_VALUE_STATE = 5;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] SYNC_REQUEST_VALUE_STRING = new String[]
-        { 
-        "START_STATE", 
-        "SYNC_REQUEST_VALUE_SEQUENCE_STATE", 
-        "MODE_STATE",
-        "COOKIE_STATE", 
-        "RELOAD_HINT_STATE" 
-        };
-
-    /** The instance */
-    private static SyncRequestValueControlStatesEnum instance = new SyncRequestValueControlStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private SyncRequestValueControlStatesEnum()
-    {
-    }
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
-
+    LAST_SYNC_REQUEST_VALUE_STATE;
 
     /**
      * Get the grammar name
@@ -137,6 +96,24 @@ public final class SyncRequestValueContr
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "SYNC_REQUEST_VALUE_END_STATE" : SYNC_REQUEST_VALUE_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "SYNC_REQUEST_VALUE_END_STATE" : this.name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SyncRequestValueControlStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java Sat Oct 30 01:51:50 2010
@@ -43,7 +43,7 @@ public class SyncStateValueControlContai
         super();
         stateStack = new int[1];
         grammar = SyncStateValueControlGrammar.getInstance();
-        states = SyncStateValueControlStatesEnum.getInstance();
+        setTransition( SyncStateValueControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -25,7 +25,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -75,10 +74,9 @@ public final class SyncStateValueControl
     private SyncStateValueControlGrammar()
     {
         setName( SyncStateValueControlGrammar.class.getName() );
-        setStatesEnum( SyncStateValueControlStatesEnum.getInstance() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncStateValueControlStatesEnum.LAST_SYNC_STATE_VALUE_STATE][256];
+        super.transitions = new GrammarTransition[SyncStateValueControlStatesEnum.LAST_SYNC_STATE_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncStateValue sequence
@@ -87,8 +85,8 @@ public final class SyncStateValueControl
          *     
          * Initialize the syncStateValue object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            States.INIT_GRAMMAR_STATE, SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
+        super.transitions[SyncStateValueControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            SyncStateValueControlStatesEnum.START_STATE, SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
             UniversalTag.SEQUENCE.getValue(), null );
 
         /** 
@@ -104,7 +102,7 @@ public final class SyncStateValueControl
          *     
          * Stores the sync state type value
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = new GrammarTransition(
             SyncStateValueControlStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
             SyncStateValueControlStatesEnum.SYNC_TYPE_STATE, UniversalTag.ENUMERATED.getValue(), new GrammarAction(
                 "Set SyncStateValueControl state type" )
@@ -150,7 +148,7 @@ public final class SyncStateValueControl
          *     
          * Stores the entryUUID
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_TYPE_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueControlStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncStateValueControlStatesEnum.SYNC_TYPE_STATE, SyncStateValueControlStatesEnum.SYNC_UUID_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncStateValueControl entryUUID" )
             {
@@ -182,7 +180,7 @@ public final class SyncStateValueControl
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncStateValueControlStatesEnum.SYNC_UUID_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueControlStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncStateValueControlStatesEnum.SYNC_UUID_STATE, SyncStateValueControlStatesEnum.COOKIE_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncStateValueControl cookie value" )
             {

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java Sat Oct 30 01:51:50 2010
@@ -28,77 +28,36 @@ import org.apache.directory.shared.asn1.
  * This class store the SyncStateValueControl's grammar constants. It is also used for
  * debugging purposes.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncStateValueControlStatesEnum implements States
+public enum SyncStateValueControlStatesEnum implements States
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
+    /** The END_STATE */
+    END_STATE,
+
     // =========================================================================
     // SyncStateValue control grammar states
     // =========================================================================
     /** Initial state */
-    public static final int START_STATE = 0;
+    START_STATE,
 
     /** Sequence Value */
-    public static final int SYNC_STATE_VALUE_SEQUENCE_STATE = 1;
+    SYNC_STATE_VALUE_SEQUENCE_STATE,
 
     /** sync state type Value */
-    public static final int SYNC_TYPE_STATE = 2;
+    SYNC_TYPE_STATE,
     
     /** syncUUID Value */
-    public static final int SYNC_UUID_STATE = 3;
+    SYNC_UUID_STATE,
 
     /** cookie Value */
-    public static final int COOKIE_STATE = 4;
+    COOKIE_STATE,
 
     /** terminal state */
-    public static final int LAST_SYNC_STATE_VALUE_STATE = 5;
-
-    // =========================================================================
-    // States debug strings
-    // =========================================================================
-    /** A string representation of all the states */
-    private static final String[] SYNC_STATE_VALUE_STRING = new String[]
-        { 
-        "START_STATE", 
-        "SYNC_STATE_VALUE_SEQUENCE_STATE", 
-        "SYNC_TYPE_STATE",
-        "SYNC_UUID_STATE", 
-        "COOKIE_STATE" 
-        };
-
-    /** The instance */
-    private static SyncStateValueControlStatesEnum instance = new SyncStateValueControlStatesEnum();
-
-
-    // ~ Constructors
-    // -------------------------------------------------------------------------------
-
-    /**
-     * This is a private constructor. This class is a singleton
-     */
-    private SyncStateValueControlStatesEnum()
-    {
-    }
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
-    /**
-     * Get an instance of this class
-     * 
-     * @return An instance on this class
-     */
-    public static States getInstance()
-    {
-        return instance;
-    }
-
+    LAST_SYNC_STATE_VALUE_STATE;
 
     /**
      * Get the grammar name
@@ -137,6 +96,24 @@ public final class SyncStateValueControl
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END ) ? "SYNC_STATE_VALUE_END_STATE" : SYNC_STATE_VALUE_STRING[state] );
+        return ( ( state == END_STATE.ordinal() ) ? "SYNC_STATE_VALUE_END_STATE" : this.name() );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEndState()
+    {
+        return this == END_STATE;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SyncStateValueControlStatesEnum getStartState()
+    {
+        return START_STATE;
     }
 }

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlContainer.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlContainer.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlContainer.java Sat Oct 30 01:51:50 2010
@@ -43,7 +43,7 @@ public class SyncModifyDnControlContaine
         super();
         stateStack = new int[1];
         grammar = SyncModifyDnControlGrammar.getInstance();
-        states = SyncModifyDnControlStatesEnum.getInstance();
+        setTransition( SyncModifyDnControlStatesEnum.START_SYNC_MODDN );
     }
 
 

Modified: directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java?rev=1028966&r1=1028965&r2=1028966&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java (original)
+++ directory/shared/branches/shared-config/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControlGrammar.java Sat Oct 30 01:51:50 2010
@@ -25,7 +25,6 @@ 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.grammar.States;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -83,10 +82,9 @@ public final class SyncModifyDnControlGr
     private SyncModifyDnControlGrammar()
     {
         setName( SyncModifyDnControlGrammar.class.getName() );
-        setStatesEnum( SyncModifyDnControlStatesEnum.getInstance() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncModifyDnControlStatesEnum.LAST_SYNC_MODDN_VALUE_STATE][256];
+        super.transitions = new GrammarTransition[SyncModifyDnControlStatesEnum.LAST_SYNC_MODDN_VALUE_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to SyncModifyDnControl sequence
@@ -95,8 +93,8 @@ public final class SyncModifyDnControlGr
          *     
          * Initialize the SyncModifyDnControl object
          */
-        super.transitions[States.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            States.INIT_GRAMMAR_STATE, SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE,
+        super.transitions[SyncModifyDnControlStatesEnum.START_SYNC_MODDN.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+            SyncModifyDnControlStatesEnum.START_SYNC_MODDN, SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE,
             UniversalTag.SEQUENCE.getValue(), null );
 
         /** 
@@ -107,7 +105,7 @@ public final class SyncModifyDnControlGr
          *     
          * Stores the entryDn value
          */
-        super.transitions[SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.SYNC_MODDN_VALUE_SEQUENCE_STATE,
             SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, UniversalTag.OCTET_STRING.getValue(), new GrammarAction(
                 "Set SyncModifyDnControl entryDn value" )
@@ -141,7 +139,7 @@ public final class SyncModifyDnControlGr
          * Stores the newSuperiorDn value
          */
 
-        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE][SyncModifyDnControlTags.MOVE_TAG.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnControlTags.MOVE_TAG.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, SyncModifyDnControlStatesEnum.MOVE_STATE,
             SyncModifyDnControlTags.MOVE_TAG.getValue(), new GrammarAction( "Set SyncModifyDnControl newSuperiorDn" )
             {
@@ -173,7 +171,7 @@ public final class SyncModifyDnControlGr
          * read the newSuperiorDn
          * move-name       [0] LDAPDN
          */
-        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE][SyncModifyDnControlTags.RENAME_TAG.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnControlTags.RENAME_TAG.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, SyncModifyDnControlStatesEnum.RENAME_STATE,
             SyncModifyDnControlTags.RENAME_TAG.getValue(), new GrammarAction( "enter SyncModifyDnControl rename choice" )
             {
@@ -195,7 +193,7 @@ public final class SyncModifyDnControlGr
          *            
          * Stores the newRdn value
          */
-        super.transitions[SyncModifyDnControlStatesEnum.RENAME_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.RENAME_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.RENAME_STATE, SyncModifyDnControlStatesEnum.RENAME_NEW_RDN_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncModifyDnControl newRdn value" )
             {
@@ -229,7 +227,7 @@ public final class SyncModifyDnControlGr
          *            
          * Stores the deleteOldRdn value
          */
-        super.transitions[SyncModifyDnControlStatesEnum.RENAME_NEW_RDN_STATE][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.RENAME_NEW_RDN_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.RENAME_NEW_RDN_STATE, SyncModifyDnControlStatesEnum.RENAME_DEL_OLD_RDN_STATE,
             UniversalTag.BOOLEAN.getValue(), new GrammarAction( "Set SyncModifyDnControl deleteOldRdn value" )
             {
@@ -262,7 +260,7 @@ public final class SyncModifyDnControlGr
          *     
          * Stores the deleteOldRdn flag
          */
-        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE][SyncModifyDnControlTags.MOVEANDRENAME_TAG.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.ENTRY_DN_STATE.ordinal()][SyncModifyDnControlTags.MOVEANDRENAME_TAG.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.ENTRY_DN_STATE, SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_STATE,
             SyncModifyDnControlTags.MOVEANDRENAME_TAG.getValue(), new GrammarAction( "enter SyncModifyDnControl moveAndRename choice" )
             {
@@ -284,7 +282,7 @@ public final class SyncModifyDnControlGr
          *            
          * Stores the newRdn value
          */
-        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_STATE, SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncModifyDnControl moveAndRename state's newSuperirorDN value" )
             {
@@ -316,7 +314,7 @@ public final class SyncModifyDnControlGr
          *            
          * Stores the newRdn value
          */
-        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_SUPERIOR_DN_STATE, SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE,
             UniversalTag.OCTET_STRING.getValue(), new GrammarAction( "Set SyncModifyDnControl moveAndRename state's newRdn value" )
             {
@@ -348,7 +346,7 @@ public final class SyncModifyDnControlGr
          *     
          * Stores the deleteOldRdn flag
          */
-        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
+        super.transitions[SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = new GrammarTransition(
             SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_NEW_RDN_STATE, SyncModifyDnControlStatesEnum.MOVE_AND_RENAME_DEL_OLD_RDN_STATE,
             UniversalTag.BOOLEAN.getValue(), new GrammarAction( "Set SyncModifyDnControl deleteOldRdn value" )
             {



Mime
View raw message