directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r1028638 [7/7] - in /directory/shared/trunk: dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/re...
Date Fri, 29 Oct 2010 08:12:07 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/certGeneration/CertGenerationStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -32,60 +32,30 @@ import org.apache.directory.shared.asn1.
 public enum CertGenerationStatesEnum implements States
 {
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     /** start state*/
-    START_STATE(0),
+    START_STATE,
 
     /** sequence*/
-    CERT_GENERATION_REQUEST_SEQUENCE_STATE(1),
+    CERT_GENERATION_REQUEST_SEQUENCE_STATE,
 
     /** the target DN*/
-    TARGETDN_STATE(2),
+    TARGETDN_STATE,
 
     /** the issuer DN*/
-    ISSUER_STATE(3),
+    ISSUER_STATE,
 
     /** the subject DN*/
-    SUBJECT_STATE(4),
+    SUBJECT_STATE,
 
     /** the key algorithm*/
-    KEY_ALGORITHM_STATE(5),
+    KEY_ALGORITHM_STATE,
 
     /** terminal state */
-    LAST_CERT_GENERATION_STATE(6);
+    LAST_CERT_GENERATION_STATE;
 
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of CertGenerationStatesEnum.
-     *
-     * @param state
-     */
-    private CertGenerationStatesEnum( int state )
-    {
-        this.state = state;
-    }
-
-    /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
     /**
      * Get the grammar name
      * 
@@ -123,7 +93,7 @@ public enum CertGenerationStatesEnum imp
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "CERT_GENERATION_END_STATE" : this.name() );
+        return ( ( state == END_STATE.ordinal() ) ? "CERT_GENERATION_END_STATE" : this.name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectContainer.java Fri Oct 29 08:12:05 2010
@@ -43,7 +43,7 @@ public class GracefulDisconnectContainer
         super();
         stateStack = new int[1];
         grammar = GracefulDisconnectGrammar.getInstance();
-        setTransition( GracefulDisconnectStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( GracefulDisconnectStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectGrammar.java Fri Oct 29 08:12:05 2010
@@ -172,7 +172,7 @@ public final class GracefulDisconnectGra
         setName( GracefulDisconnectGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[GracefulDisconnectStatesEnum.LAST_GRACEFUL_DISCONNECT_STATE.getState()][256];
+        super.transitions = new GrammarTransition[GracefulDisconnectStatesEnum.LAST_GRACEFUL_DISCONNECT_STATE.ordinal()][256];
 
         /**
          * Transition from init state to graceful disconnect
@@ -181,8 +181,8 @@ public final class GracefulDisconnectGra
          * 
          * Creates the GracefulDisconnect object
          */
-        super.transitions[GracefulDisconnectStatesEnum.INIT_GRAMMAR_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( GracefulDisconnectStatesEnum.INIT_GRAMMAR_STATE,
+        super.transitions[GracefulDisconnectStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( GracefulDisconnectStatesEnum.START_STATE,
                                     GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(),
                 new GrammarAction(
@@ -206,7 +206,7 @@ public final class GracefulDisconnectGra
          *     
          * Set the time offline value into the GracefulDisconnect object.    
          */
-        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE,
                                     GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE, 
                                     UniversalTag.INTEGER.getValue(), 
@@ -222,7 +222,7 @@ public final class GracefulDisconnectGra
          *     
          * Set the delay value into the GracefulDisconnect object.    
          */
-        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.getState()]
+        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.ordinal()]
                          [GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE,
                                     GracefulDisconnectStatesEnum.DELAY_STATE, 
@@ -240,7 +240,7 @@ public final class GracefulDisconnectGra
          *     
          * Get some replicated contexts. Nothing to do    
          */
-        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.GRACEFUL_DISCONNECT_SEQUENCE_STATE,
                                     GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE,
                                     UniversalTag.SEQUENCE.getValue(), null );
@@ -255,7 +255,7 @@ public final class GracefulDisconnectGra
          *     
          * Set the delay value into the GracefulDisconnect object.    
          */
-        super.transitions[GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE.getState()][GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
+        super.transitions[GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE.ordinal()][GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE,
                                     GracefulDisconnectStatesEnum.DELAY_STATE, 
                                     GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG,
@@ -272,7 +272,7 @@ public final class GracefulDisconnectGra
          *     
          * Get some replicated contexts. Nothing to do    
          */
-        super.transitions[GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.TIME_OFFLINE_STATE,
                                     GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE,
                                     UniversalTag.SEQUENCE.getValue(), null );
@@ -288,7 +288,7 @@ public final class GracefulDisconnectGra
          *     
          * Get some replicated contexts. Nothing to do    
          */
-        super.transitions[GracefulDisconnectStatesEnum.DELAY_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.DELAY_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.DELAY_STATE,
                                     GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), null );
@@ -304,7 +304,7 @@ public final class GracefulDisconnectGra
          *     
          * Stores the referral
          */
-        super.transitions[GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.REPLICATED_CONTEXTS_STATE,
                                     GracefulDisconnectStatesEnum.REFERRAL_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -321,7 +321,7 @@ public final class GracefulDisconnectGra
          *     
          * Stores the referral
          */
-        super.transitions[GracefulDisconnectStatesEnum.REFERRAL_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[GracefulDisconnectStatesEnum.REFERRAL_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( GracefulDisconnectStatesEnum.REFERRAL_STATE,
                                     GracefulDisconnectStatesEnum.REFERRAL_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulDisconnect/GracefulDisconnectStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,8 +28,6 @@ import org.apache.directory.shared.asn1.
  * This class store the GracefulDisconnect'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 enum GracefulDisconnectStatesEnum implements States
@@ -37,64 +35,34 @@ public enum GracefulDisconnectStatesEnum
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // GracefulDisconnect grammar states
     // =========================================================================
     /** Initial state */
-    START_STATE(0),
+    START_STATE,
 
     /** Sequence */
-    GRACEFUL_DISCONNECT_SEQUENCE_STATE(1),
+    GRACEFUL_DISCONNECT_SEQUENCE_STATE,
 
     /** Time offline */
-    TIME_OFFLINE_STATE(2),
+    TIME_OFFLINE_STATE,
 
     /** Delay */
-    DELAY_STATE(3),
+    DELAY_STATE,
 
     /** Replicated contexts */
-    REPLICATED_CONTEXTS_STATE(4),
+    REPLICATED_CONTEXTS_STATE,
 
     /** Referral */
-    REFERRAL_STATE(5),
+    REFERRAL_STATE,
 
     /** terminal state */
-    LAST_GRACEFUL_DISCONNECT_STATE(6);
-
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of GracefulDisconnectStatesEnum.
-     *
-     * @param state
-     */
-    private GracefulDisconnectStatesEnum(int state)
-    {
-        this.state = state;
-    }
+    LAST_GRACEFUL_DISCONNECT_STATE;
 
     /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
-    /**
      * Get the grammar name
      * 
      * @param grammar The grammar code
@@ -131,7 +99,7 @@ public enum GracefulDisconnectStatesEnum
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "GRACEFUL_DISCONNECT_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "GRACEFUL_DISCONNECT_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownContainer.java Fri Oct 29 08:12:05 2010
@@ -43,7 +43,7 @@ public class GracefulShutdownContainer e
         super();
         stateStack = new int[1];
         grammar = GracefulShutdownGrammar.getInstance();
-        setTransition( GracefulShutdownStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( GracefulShutdownStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownGrammar.java Fri Oct 29 08:12:05 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.IntegerDecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.extended.operations.GracefulActionConstants;
-import org.apache.directory.shared.ldap.codec.extended.operations.gracefulDisconnect.GracefulDisconnectStatesEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -72,7 +71,7 @@ public final class GracefulShutdownGramm
         setName( GracefulShutdownGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[GracefulShutdownStatesEnum.LAST_GRACEFUL_SHUTDOWN_STATE.getState()][256];
+        super.transitions = new GrammarTransition[GracefulShutdownStatesEnum.LAST_GRACEFUL_SHUTDOWN_STATE.ordinal()][256];
 
         /**
          * Transition from init state to graceful shutdown
@@ -82,8 +81,8 @@ public final class GracefulShutdownGramm
          *     
          * Creates the GracefulShutdown object
          */
-        super.transitions[GracefulShutdownStatesEnum.INIT_GRAMMAR_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( GracefulDisconnectStatesEnum.INIT_GRAMMAR_STATE, 
+        super.transitions[GracefulShutdownStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( GracefulShutdownStatesEnum.START_STATE, 
                 GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE, 
                 UniversalTag.SEQUENCE.getValue(),
                 new GrammarAction( "Init GracefulShutdown" )
@@ -107,7 +106,7 @@ public final class GracefulShutdownGramm
          * Set the time offline value into the GracefulShutdown
          * object.
          */
-        super.transitions[GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE, 
                                     GracefulShutdownStatesEnum.TIME_OFFLINE_STATE, 
                                     UniversalTag.INTEGER.getValue(), 
@@ -149,7 +148,7 @@ public final class GracefulShutdownGramm
          * Set the delay value into the GracefulShutdown
          * object.
          */
-        super.transitions[GracefulShutdownStatesEnum.TIME_OFFLINE_STATE.getState()][GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
+        super.transitions[GracefulShutdownStatesEnum.TIME_OFFLINE_STATE.ordinal()][GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
             new GrammarTransition( GracefulShutdownStatesEnum.TIME_OFFLINE_STATE, 
                                     GracefulShutdownStatesEnum.DELAY_STATE, 
                                     GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG, 
@@ -192,7 +191,7 @@ public final class GracefulShutdownGramm
          * Set the delay value into the GracefulShutdown
          * object.
          */
-        super.transitions[GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE.getState()]
+        super.transitions[GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE.ordinal()]
                          [GracefulActionConstants.GRACEFUL_ACTION_DELAY_TAG] = 
             new GrammarTransition( GracefulShutdownStatesEnum.GRACEFUL_SHUTDOWN_SEQUENCE_STATE, 
                                     GracefulShutdownStatesEnum.DELAY_STATE, 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/gracefulShutdown/GracefulShutdownStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,8 +28,6 @@ import org.apache.directory.shared.asn1.
  * This class store the GracefulShutdown'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 enum GracefulShutdownStatesEnum implements States
@@ -37,59 +35,29 @@ public enum GracefulShutdownStatesEnum i
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // GracefulShutdown grammar states
     // =========================================================================
 
     /** Initial state */
-    START_STATE(0),
+    START_STATE,
 
     /** Sequence */
-    GRACEFUL_SHUTDOWN_SEQUENCE_STATE(1),
+    GRACEFUL_SHUTDOWN_SEQUENCE_STATE,
 
     /** Time offline */
-    TIME_OFFLINE_STATE(2),
+    TIME_OFFLINE_STATE,
 
     /** Delay */
-    DELAY_STATE(3),
+    DELAY_STATE,
 
     /** terminal state */
-    LAST_GRACEFUL_SHUTDOWN_STATE(4);
-
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of GracefulShutdownStatesEnum.
-     *
-     * @param state
-     */
-    GracefulShutdownStatesEnum(int state)
-    {
-        this.state = state;
-    }
+    LAST_GRACEFUL_SHUTDOWN_STATE;
 
     /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
-    /**
      * Get the grammar name
      * 
      * @param grammar The grammar code
@@ -126,7 +94,7 @@ public enum GracefulShutdownStatesEnum i
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "GRACEFUL_SHUTDOWN_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "GRACEFUL_SHUTDOWN_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureContainer.java Fri Oct 29 08:12:05 2010
@@ -46,7 +46,7 @@ public class StoredProcedureContainer ex
         super();
         stateStack = new int[1];
         grammar = StoredProcedureGrammar.getInstance();
-        setTransition( StoredProcedureStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( StoredProcedureStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureGrammar.java Fri Oct 29 08:12:05 2010
@@ -63,7 +63,7 @@ public final class StoredProcedureGramma
         setName( StoredProcedureGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[StoredProcedureStatesEnum.LAST_STORED_PROCEDURE_STATE.getState()][256];
+        super.transitions = new GrammarTransition[StoredProcedureStatesEnum.LAST_STORED_PROCEDURE_STATE.ordinal()][256];
 
         //============================================================================================
         // StoredProcedure Message
@@ -71,7 +71,7 @@ public final class StoredProcedureGramma
         // StoredProcedure ::= SEQUENCE {
         //   ...
         // Nothing to do.
-        super.transitions[StoredProcedureStatesEnum.START_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.START_STATE, 
                                     StoredProcedureStatesEnum.STORED_PROCEDURE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), 
@@ -81,7 +81,7 @@ public final class StoredProcedureGramma
         //    ...
         //
         // Creates the storeProcedure and stores the language
-        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.STORED_PROCEDURE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.STORED_PROCEDURE_STATE, 
                                     StoredProcedureStatesEnum.LANGUAGE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -124,7 +124,7 @@ public final class StoredProcedureGramma
         //    procedure OCTETSTRING, (Value)
         //    ...
         // Stores the procedure.
-        super.transitions[StoredProcedureStatesEnum.LANGUAGE_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.LANGUAGE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.LANGUAGE_STATE, 
                                     StoredProcedureStatesEnum.PROCEDURE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -166,7 +166,7 @@ public final class StoredProcedureGramma
         //    ...
         // The list of parameters will be created with the first parameter.
         // We can have an empty list of parameters, so the PDU can be empty
-        super.transitions[StoredProcedureStatesEnum.PROCEDURE_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.PROCEDURE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.PROCEDURE_STATE, 
                                     StoredProcedureStatesEnum.PARAMETERS_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), 
@@ -183,7 +183,7 @@ public final class StoredProcedureGramma
         // parameter SEQUENCE OF { (Value)
         //    ...
         // Nothing to do. 
-        super.transitions[StoredProcedureStatesEnum.PARAMETERS_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.PARAMETERS_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.PARAMETERS_STATE, 
                                     StoredProcedureStatesEnum.PARAMETER_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), 
@@ -194,7 +194,7 @@ public final class StoredProcedureGramma
         //    ...
         //
         // We can create a parameter, and store its type
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.PARAMETER_STATE, 
                                     StoredProcedureStatesEnum.PARAMETER_TYPE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -240,7 +240,7 @@ public final class StoredProcedureGramma
         //    value OCTETSTRING (Tag)
         // }
         // Store the parameter value
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.PARAMETER_TYPE_STATE, 
                                     StoredProcedureStatesEnum.PARAMETER_VALUE_STATE, 
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -294,7 +294,7 @@ public final class StoredProcedureGramma
         // Parameters ::= SEQUENCE OF Parameter
         // 
         // Loop on next parameter
-        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[StoredProcedureStatesEnum.PARAMETER_VALUE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( StoredProcedureStatesEnum.PARAMETER_VALUE_STATE, 
                                     StoredProcedureStatesEnum.PARAMETER_STATE, 
                                     UniversalTag.SEQUENCE.getValue(),

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/storedProcedure/StoredProcedureStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,84 +28,53 @@ import org.apache.directory.shared.asn1.
 /**
  * Constants for StoredProcedureGrammar.
  * 
- * TODO: should this be an enum?
- * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum StoredProcedureStatesEnum implements States
 {
     //~ Static fields/initializers -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     //=========================================================================
     // StoredProcedure
     //=========================================================================
     /** starting state */
-    START_STATE(0),
+    START_STATE,
 
     /** StoredProcedure */
-    STORED_PROCEDURE_STATE(1),
+    STORED_PROCEDURE_STATE,
 
     // Language ---------------------------------------------------------------
     /** Language */
-    LANGUAGE_STATE(2),
+    LANGUAGE_STATE,
 
     // Procedure --------------------------------------------------------------
     /** Procedure */
-    PROCEDURE_STATE(3),
+    PROCEDURE_STATE,
 
     // Parameters -------------------------------------------------------------
     /** Parameters */
-    PARAMETERS_STATE(4),
+    PARAMETERS_STATE,
 
     // Parameter --------------------------------------------------------------
     /** Parameter */
-    PARAMETER_STATE(5),
+    PARAMETER_STATE,
 
     // Parameter type ---------------------------------------------------------
     /** Parameter type */
-    PARAMETER_TYPE_STATE(6),
+    PARAMETER_TYPE_STATE,
 
     // Parameters value -------------------------------------------------------
     /** Parameter value */
-    PARAMETER_VALUE_STATE(7),
+    PARAMETER_VALUE_STATE,
 
     /** Last Stored Procedure */
-    LAST_STORED_PROCEDURE_STATE(8);
+    LAST_STORED_PROCEDURE_STATE;
 
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of StoredProcedureStatesEnum.
-     *
-     * @param state
-     */
-    StoredProcedureStatesEnum(int state)
-    {
-        this.state = state;
-    }
 
     /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
-    /**
      * Get the grammar name
      * @param grammar The grammar code
      * @return The grammar name
@@ -142,7 +111,7 @@ public enum StoredProcedureStatesEnum im
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "STORED_PROCEDURE_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "STORED_PROCEDURE_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlContainer.java Fri Oct 29 08:12:05 2010
@@ -41,7 +41,7 @@ public class EntryChangeControlContainer
         super();
         stateStack = new int[1];
         grammar = EntryChangeControlGrammar.getInstance();
-        setTransition( EntryChangeControlStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( EntryChangeControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlGrammar.java Fri Oct 29 08:12:05 2010
@@ -67,7 +67,7 @@ public final class EntryChangeControlGra
         setName( EntryChangeControlGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[EntryChangeControlStatesEnum.LAST_EC_STATE.getState()][256];
+        super.transitions = new GrammarTransition[EntryChangeControlStatesEnum.LAST_EC_STATE.ordinal()][256];
 
         // ============================================================================================
         // Transition from start state to Entry Change sequence
@@ -76,7 +76,7 @@ public final class EntryChangeControlGra
         //     ...
         //
         // Initialization of the structure
-        super.transitions[EntryChangeControlStatesEnum.START_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
+        super.transitions[EntryChangeControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
             new GrammarTransition( EntryChangeControlStatesEnum.START_STATE, 
                                     EntryChangeControlStatesEnum.EC_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), null );
@@ -89,7 +89,7 @@ public final class EntryChangeControlGra
         //     ...
         //
         // Evaluates the changeType
-        super.transitions[EntryChangeControlStatesEnum.EC_SEQUENCE_STATE.getState()][UniversalTag.ENUMERATED.getValue()] = 
+        super.transitions[EntryChangeControlStatesEnum.EC_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED.getValue()] = 
             new GrammarTransition( EntryChangeControlStatesEnum.EC_SEQUENCE_STATE,
                                     EntryChangeControlStatesEnum.CHANGE_TYPE_STATE, 
                                     UniversalTag.ENUMERATED.getValue(),
@@ -148,7 +148,7 @@ public final class EntryChangeControlGra
         //
         // Set the previousDN into the structure. We first check that it's a
         // valid DN
-        super.transitions[EntryChangeControlStatesEnum.CHANGE_TYPE_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[EntryChangeControlStatesEnum.CHANGE_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( EntryChangeControlStatesEnum.CHANGE_TYPE_STATE, 
                                     EntryChangeControlStatesEnum.PREVIOUS_DN_STATE,
                                     UniversalTag.OCTET_STRING.getValue(),
@@ -233,7 +233,7 @@ public final class EntryChangeControlGra
         // }
         //
         // Set the changeNumber into the structure
-        super.transitions[EntryChangeControlStatesEnum.PREVIOUS_DN_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[EntryChangeControlStatesEnum.PREVIOUS_DN_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( EntryChangeControlStatesEnum.PREVIOUS_DN_STATE, 
                                     EntryChangeControlStatesEnum.CHANGE_NUMBER_STATE, 
                                     UniversalTag.INTEGER.getValue(),
@@ -248,7 +248,7 @@ public final class EntryChangeControlGra
         // }
         //
         // Set the changeNumber into the structure
-        super.transitions[EntryChangeControlStatesEnum.CHANGE_TYPE_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[EntryChangeControlStatesEnum.CHANGE_TYPE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( EntryChangeControlStatesEnum.CHANGE_TYPE_STATE, 
                                     EntryChangeControlStatesEnum.CHANGE_NUMBER_STATE, 
                                     UniversalTag.INTEGER.getValue(),

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeControlStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,8 +28,6 @@ import org.apache.directory.shared.asn1.
  * This class store the EntryChangeControl'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 enum EntryChangeControlStatesEnum implements States
@@ -37,62 +35,32 @@ public enum EntryChangeControlStatesEnum
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // Entry change control grammar states
     // =========================================================================
 
     /** Sequence Tag */
-    START_STATE(0),
+    START_STATE,
 
     /** Sequence */
-    EC_SEQUENCE_STATE(1),
+    EC_SEQUENCE_STATE,
 
     /** changeType */
-    CHANGE_TYPE_STATE(2),
+    CHANGE_TYPE_STATE,
 
     /** previousDN */
-    PREVIOUS_DN_STATE(3),
+    PREVIOUS_DN_STATE,
 
     /** changeNumber */
-    CHANGE_NUMBER_STATE(4),
+    CHANGE_NUMBER_STATE,
 
     /** terminal state */
-    LAST_EC_STATE(5);
-
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of EntryChangeControlStatesEnum.
-     *
-     * @param state
-     */
-    EntryChangeControlStatesEnum(int state)
-    {
-        this.state = state;
-    }
+    LAST_EC_STATE;
 
     /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
-    /**
      * Get the grammar name
      * 
      * @param grammar The grammar code
@@ -129,7 +97,7 @@ public enum EntryChangeControlStatesEnum
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "EC_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "EC_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlContainer.java Fri Oct 29 08:12:05 2010
@@ -43,7 +43,7 @@ public class PagedResultsControlContaine
         super();
         stateStack = new int[1];
         grammar = PagedResultsControlGrammar.getInstance();
-        setTransition( PagedResultsControlStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( PagedResultsControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlGrammar.java Fri Oct 29 08:12:05 2010
@@ -69,7 +69,7 @@ public final class PagedResultsControlGr
         setName( PagedResultsControlGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[PagedResultsControlStatesEnum.LAST_PAGED_SEARCH_STATE.getState()][256];
+        super.transitions = new GrammarTransition[PagedResultsControlStatesEnum.LAST_PAGED_SEARCH_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to PagedSearch sequence
@@ -78,8 +78,8 @@ public final class PagedResultsControlGr
          *     
          * Nothing to do
          */
-        super.transitions[PagedResultsControlStatesEnum.INIT_GRAMMAR_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( PagedResultsControlStatesEnum.INIT_GRAMMAR_STATE, 
+        super.transitions[PagedResultsControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( PagedResultsControlStatesEnum.START_STATE, 
                                     PagedResultsControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), null );
 
@@ -93,7 +93,7 @@ public final class PagedResultsControlGr
          *     
          * Stores the size value
          */
-        super.transitions[PagedResultsControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[PagedResultsControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( PagedResultsControlStatesEnum.PAGED_SEARCH_SEQUENCE_STATE, 
                 PagedResultsControlStatesEnum.SIZE_STATE, 
                 UniversalTag.INTEGER.getValue(),
@@ -141,7 +141,7 @@ public final class PagedResultsControlGr
          *     
          * Stores the cookie flag
          */
-        super.transitions[PagedResultsControlStatesEnum.SIZE_STATE.getState()][UniversalTag.OCTET_STRING.getValue()] = 
+        super.transitions[PagedResultsControlStatesEnum.SIZE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = 
             new GrammarTransition( PagedResultsControlStatesEnum.SIZE_STATE,
                                     PagedResultsControlStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction( "Set PagedSearchControl cookie" )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsControlStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,8 +28,6 @@ import org.apache.directory.shared.asn1.
  * This class store the PagedSearchControl'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 enum PagedResultsControlStatesEnum implements States
@@ -37,58 +35,29 @@ public enum PagedResultsControlStatesEnu
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // Paged search control grammar states
     // =========================================================================
     /** Initial state */
-    START_STATE(0),
+    START_STATE,
 
     /** Sequence Value */
-    PAGED_SEARCH_SEQUENCE_STATE(1),
+    PAGED_SEARCH_SEQUENCE_STATE,
 
     /** Size Value */
-    SIZE_STATE(2),
+    SIZE_STATE,
     
     /** Cookie Value */
-    COOKIE_STATE(3),
+    COOKIE_STATE,
 
     /** terminal state */
-    LAST_PAGED_SEARCH_STATE(4);
+    LAST_PAGED_SEARCH_STATE;
 
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of PagedResultsControlStatesEnum.
-     *
-     * @param state
-     */
-    PagedResultsControlStatesEnum(int state)
-    {
-        this.state = state;
-    }
 
     /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
-    /**
      * Get the grammar name
      * 
      * @param grammar The grammar code
@@ -125,7 +94,7 @@ public enum PagedResultsControlStatesEnu
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "PAGED_SEARCH_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "PAGED_SEARCH_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java Fri Oct 29 08:12:05 2010
@@ -41,7 +41,7 @@ public class PersistentSearchControlCont
         super();
         stateStack = new int[1];
         grammar = PersistentSearchControlGrammar.getInstance();
-        setTransition( PersistentSearchControlStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( PersistentSearchControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java Fri Oct 29 08:12:05 2010
@@ -77,7 +77,7 @@ public final class PersistentSearchContr
         setName( PersistentSearchControlGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[PersistentSearchControlStatesEnum.LAST_PSEARCH_STATE.getState()][256];
+        super.transitions = new GrammarTransition[PersistentSearchControlStatesEnum.LAST_PSEARCH_STATE.ordinal()][256];
 
         /** 
          * Transition from initial state to Psearch sequence
@@ -86,8 +86,8 @@ public final class PersistentSearchContr
          *     
          * Initialize the persistence search object
          */
-        super.transitions[PersistentSearchControlStatesEnum.INIT_GRAMMAR_STATE.getState()][UniversalTag.SEQUENCE.getValue()] = 
-            new GrammarTransition( PersistentSearchControlStatesEnum.INIT_GRAMMAR_STATE, 
+        super.transitions[PersistentSearchControlStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = 
+            new GrammarTransition( PersistentSearchControlStatesEnum.START_STATE, 
                                     PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
                                     UniversalTag.SEQUENCE.getValue(), null );
 
@@ -100,7 +100,7 @@ public final class PersistentSearchContr
          *     
          * Stores the change types value
          */
-        super.transitions[PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE.getState()][UniversalTag.INTEGER.getValue()] = 
+        super.transitions[PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = 
             new GrammarTransition( PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
                 PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE, 
                 UniversalTag.INTEGER.getValue(),
@@ -143,7 +143,7 @@ public final class PersistentSearchContr
          *     
          * Stores the change only flag
          */
-        super.transitions[PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE.getState()][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE,
                                     PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction( "Set PSearchControl changesOnly" )
@@ -182,7 +182,7 @@ public final class PersistentSearchContr
          *     
          * Stores the return ECs flag 
          */
-        super.transitions[PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE.getState()][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE, 
                                     PersistentSearchControlStatesEnum.RETURN_ECS_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction( "Set PSearchControl returnECs" )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -28,8 +28,6 @@ import org.apache.directory.shared.asn1.
  * This class store the PSearchControl'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 enum PersistentSearchControlStatesEnum implements States
@@ -37,60 +35,30 @@ public enum PersistentSearchControlState
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // Persistent search control grammar states
     // =========================================================================
     /** Initial state */
-    START_STATE(0),
+    START_STATE,
 
     /** Sequence Value */
-    PSEARCH_SEQUENCE_STATE(1),
+    PSEARCH_SEQUENCE_STATE,
 
     /** changeTypes Value */
-    CHANGE_TYPES_STATE(2),
+    CHANGE_TYPES_STATE,
     
     /** changesOnly Value */
-    CHANGES_ONLY_STATE(3),
+    CHANGES_ONLY_STATE,
 
     /** returnECs Value */
-    RETURN_ECS_STATE(4),
+    RETURN_ECS_STATE,
 
     /** terminal state */
-    LAST_PSEARCH_STATE(5);
-
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of PersistentSearchControlStatesEnum.
-     *
-     * @param state
-     */
-    PersistentSearchControlStatesEnum(int state)
-    {
-        this.state = state;
-    }
+    LAST_PSEARCH_STATE;
 
-    /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
 
     /**
      * Get the grammar name
@@ -129,7 +97,7 @@ public enum PersistentSearchControlState
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "PSEARCH_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "PSEARCH_END_STATE" : name() );
     }
 
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java Fri Oct 29 08:12:05 2010
@@ -40,7 +40,7 @@ public class SubentriesControlContainer 
         super();
         stateStack = new int[1];
         grammar = SubentriesControlGrammar.getInstance();
-        setTransition( SubentriesControlStatesEnum.INIT_GRAMMAR_STATE );
+        setTransition( SubentriesControlStatesEnum.START_STATE );
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java Fri Oct 29 08:12:05 2010
@@ -60,9 +60,9 @@ public final class SubentriesControlGram
         setName( SubentriesControlGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE.getState()][256];
+        super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE.ordinal()][256];
 
-        super.transitions[SubentriesControlStatesEnum.START_STATE.getState()][UniversalTag.BOOLEAN.getValue()] = 
+        super.transitions[SubentriesControlStatesEnum.START_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] = 
             new GrammarTransition( SubentriesControlStatesEnum.START_STATE, 
                                     SubentriesControlStatesEnum.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN.getValue(), 
                 new GrammarAction( "SubEntryControl visibility" )

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java?rev=1028638&r1=1028637&r2=1028638&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java Fri Oct 29 08:12:05 2010
@@ -35,52 +35,22 @@ public enum SubentriesControlStatesEnum 
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
 
-    /** The initial state of every grammar */
-    INIT_GRAMMAR_STATE(0),
-
-    /** The ending state for every grammars */
-    GRAMMAR_END(-1),
-
     /** The END_STATE */
-    END_STATE(-1),
+    END_STATE,
 
     // =========================================================================
     // Sub entry control grammar states
     // =========================================================================
 
     /** Starting state */
-    START_STATE(0),
+    START_STATE,
 
     /** Visibility Value */
-    SUB_ENTRY_VISIBILITY_STATE(1),
+    SUB_ENTRY_VISIBILITY_STATE,
 
     /** terminal state */
-    LAST_SUB_ENTRY_STATE(2);
+    LAST_SUB_ENTRY_STATE;
 
-    private int state;
-    
-    /**
-     * 
-     * Creates a new instance of SubentriesControlStatesEnum.
-     *
-     * @param state
-     */
-    SubentriesControlStatesEnum(int state)
-    {
-        this.state = state;
-    }
-
-    /**
-     * 
-     * Get the state.
-     *
-     * @return State as integer value
-     */
-    public int getState()
-    {
-        return state;
-    }
-    
 
     /**
      * Get the grammar name
@@ -119,7 +89,7 @@ public enum SubentriesControlStatesEnum 
      */
     public String getState( int state )
     {
-        return ( ( state == GRAMMAR_END.getState() ) ? "SUB_ENTRY_END_STATE" : name() );
+        return ( ( state == END_STATE.ordinal() ) ? "SUB_ENTRY_END_STATE" : name() );
     }
 
     



Mime
View raw message