You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/02/07 18:49:44 UTC

svn commit: r741920 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls: pSearch/ replication/syncRequestValue/

Author: elecharny
Date: Sat Feb  7 17:49:43 2009
New Revision: 741920

URL: http://svn.apache.org/viewvc?rev=741920&view=rev
Log:
o Added code for the syncRequestValue control
o Fixed the PSearch control

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java?rev=741920&r1=741919&r2=741920&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java Sat Feb  7 17:49:43 2009
@@ -46,16 +46,16 @@
     public static final int PSEARCH_SEQUENCE_STATE = 1;
 
     /** changeTypes Value */
-    public static final int CHANGE_TYPES_STATE = 3;
+    public static final int CHANGE_TYPES_STATE = 2;
     
     /** changesOnly Value */
-    public static final int CHANGES_ONLY_STATE = 5;
+    public static final int CHANGES_ONLY_STATE = 3;
 
     /** returnECs Value */
-    public static final int RETURN_ECS_STATE = 7;
+    public static final int RETURN_ECS_STATE = 4;
 
     /** terminal state */
-    public static final int LAST_PSEARCH_STATE = 8;
+    public static final int LAST_PSEARCH_STATE = 5;
 
     // =========================================================================
     // States debug strings

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java?rev=741920&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java Sat Feb  7 17:49:43 2009
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.replication.syncRequestValue;
+
+
+import org.apache.directory.shared.asn1.ber.AbstractContainer;
+
+
+/**
+ * A container for the SyncRequestValue control
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 741888 $, $Date: 2009-02-07 13:57:03 +0100 (Sat, 07 Feb 2009) $, 
+ */
+public class SyncRequestValueControlContainer extends AbstractContainer
+{
+    /** SyncRequestValueControl */
+    private SyncRequestValueControlCodec control;
+
+
+    /**
+     * Creates a new SyncRequestValueControlContainer object. We will store one grammar,
+     * it's enough ...
+     */
+    public SyncRequestValueControlContainer()
+    {
+        super();
+        stateStack = new int[1];
+        grammar = SyncRequestValueControlGrammar.getInstance();
+        states = SyncRequestValueControlStatesEnum.getInstance();
+    }
+
+
+    /**
+     * @return Returns the syncRequestValue control.
+     */
+    public SyncRequestValueControlCodec getSyncRequestValueControl()
+    {
+        return control;
+    }
+
+
+    /**
+     * Set a SyncRequestValueControl Object into the container. It will be completed by
+     * the ldapDecoder.
+     * 
+     * @param control the SyncRequestValueControl to set.
+     */
+    public void setSyncRequestValueControl( SyncRequestValueControlCodec control )
+    {
+        this.control = control;
+    }
+
+    /**
+     * Clean the container
+     */
+    public void clean()
+    {
+        super.clean();
+        control = null;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java?rev=741920&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java Sat Feb  7 17:49:43 2009
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.replication.syncRequestValue;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.ControlDecoder;
+import org.apache.directory.shared.ldap.message.control.replication.SyncRequestValueControl;
+
+
+/**
+ * A decoder for SyncRequestValueControl.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 741888 $, $Date: 2009-02-07 13:57:03 +0100 (Sat, 07 Feb 2009) $, 
+ */
+public class SyncRequestValueControlDecoder extends Asn1Decoder implements ControlDecoder
+{
+    /** An instance of this decoder */
+    private static final Asn1Decoder decoder = new Asn1Decoder();
+
+    /**
+     * Return the syncRequestValue OID
+     * 
+     * @see org.apache.directory.shared.ldap.codec.ControlDecoder#getControlType()
+     */
+    public String getControlType()
+    {
+        return SyncRequestValueControl.CONTROL_OID;
+    }
+
+    /**
+     * Decode the syncRequestValue control
+     * 
+     * @param controlBytes The bytes array which contains the encoded syncRequestValue
+     * 
+     * @return A valid SyncRequestValueControl object
+     * 
+     * @throws DecoderException If the decoding found an error
+     * @throws NamingException It will never be throw by this method
+     */
+    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    {
+        ByteBuffer bb = ByteBuffer.wrap( controlBytes );
+        SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
+        decoder.decode( bb, container );
+        return container.getSyncRequestValueControl();
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java?rev=741920&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java Sat Feb  7 17:49:43 2009
@@ -0,0 +1,287 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.replication.syncRequestValue;
+
+
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
+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.IGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.IStates;
+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;
+import org.apache.directory.shared.asn1.util.BooleanDecoder;
+import org.apache.directory.shared.asn1.util.BooleanDecoderException;
+import org.apache.directory.shared.asn1.util.IntegerDecoder;
+import org.apache.directory.shared.asn1.util.IntegerDecoderException;
+import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class implements the SyncRequestValueControl. All the actions are declared in
+ * this class. As it is a singleton, these declaration are only done once.
+ * 
+ * The decoded grammar is the following :
+ * 
+ * syncRequestValue ::= SEQUENCE {
+ *     mode ENUMERATED {
+ *     -- 0 unused
+ *     refreshOnly       (1),
+ *     -- 2 reserved
+ *     refreshAndPersist (3)
+ *     },
+ *     cookie     syncCookie OPTIONAL,
+ *     reloadHint BOOLEAN DEFAULT FALSE
+ * }
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 741888 $, $Date: 2009-02-07 13:57:03 +0100 (Sat, 07 Feb 2009) $, 
+ */
+public class SyncRequestValueControlGrammar extends AbstractGrammar
+{
+    /** The logger */
+    static final Logger log = LoggerFactory.getLogger( SyncRequestValueControlGrammar.class );
+
+    /** Speedup for logs */
+    static final boolean IS_DEBUG = log.isDebugEnabled();
+
+    /** The instance of grammar. SyncRequestValueControlGrammar is a singleton */
+    private static IGrammar instance = new SyncRequestValueControlGrammar();
+
+
+    /**
+     * Creates a new SyncRequestValueControlGrammar object.
+     */
+    private SyncRequestValueControlGrammar()
+    {
+        name = SyncRequestValueControlGrammar.class.getName();
+        statesEnum = SyncRequestValueControlStatesEnum.getInstance();
+
+        // Create the transitions table
+        super.transitions = new GrammarTransition[SyncRequestValueControlStatesEnum.LAST_SYNC_REQUEST_VALUE_STATE][256];
+
+        /** 
+         * Transition from initial state to SyncRequestValue sequence
+         * SyncRequestValue ::= SEQUENCE OF {
+         *     ...
+         *     
+         * Initialize the syncRequestValue object
+         */
+        super.transitions[IStates.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE_TAG] = 
+            new GrammarTransition( IStates.INIT_GRAMMAR_STATE, 
+                                    SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
+                                    UniversalTag.SEQUENCE_TAG, 
+                new GrammarAction( "Init SyncRequestValueControl" )
+            {
+                public void action( IAsn1Container container )
+                {
+                    SyncRequestValueControlContainer SyncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
+                    SyncRequestValueControlCodec control = new SyncRequestValueControlCodec();
+                    SyncRequestValueContainer.setSyncRequestValueControl( control );
+                }
+            } );
+
+
+        /** 
+         * Transition from SyncRequestValue sequence to Change types
+         * SyncRequestValue ::= SEQUENCE OF {
+         *     mode ENUMERATED {
+         *         -- 0 unused
+         *         refreshOnly       (1),
+         *         -- 2 reserved
+         *         refreshAndPersist (3)
+         *     },
+         *     ...
+         *     
+         * Stores the mode value
+         */
+        super.transitions[SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE][UniversalTag.ENUMERATED_TAG] = 
+            new GrammarTransition( SyncRequestValueControlStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE, 
+                SyncRequestValueControlStatesEnum.MODE_STATE, 
+                UniversalTag.ENUMERATED_TAG,
+                new GrammarAction( "Set SyncRequestValueControl mode" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    SyncRequestValueControlContainer SyncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
+                    Value value = SyncRequestValueContainer.getCurrentTLV().getValue();
+
+                    try
+                    {
+                        // Check that the value is into the allowed interval
+                        int mode = IntegerDecoder.parse( value, 
+                            SynchronizationModeEnum.UNUSED.getValue(), 
+                            SynchronizationModeEnum.REFRESH_AND_PERSIST.getValue() );
+                        
+                        SynchronizationModeEnum modeEnum = SynchronizationModeEnum.getSyncMode( mode );
+                        
+                        if ( IS_DEBUG )
+                        {
+                            log.debug( "Mode = " + modeEnum );
+                        }
+
+                        SyncRequestValueContainer.getSyncRequestValueControl().setMode( modeEnum );
+                    }
+                    catch ( IntegerDecoderException e )
+                    {
+                        String msg = "failed to decode the mode for SyncRequestValueControl";
+                        log.error( msg, e );
+                        throw new DecoderException( msg );
+                    }
+                }
+            } );
+
+
+        /** 
+         * Transition from mode to cookie
+         * SyncRequestValue ::= SEQUENCE OF {
+         *     ...
+         *     cookie     syncCookie OPTIONAL,
+         *     ...
+         *     
+         * Stores the cookie
+         */
+        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE][UniversalTag.OCTET_STRING_TAG] = 
+            new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
+                                    SyncRequestValueControlStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING_TAG,
+                new GrammarAction( "Set SyncRequestValueControl cookie" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    SyncRequestValueControlContainer SyncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
+                    Value value = SyncRequestValueContainer.getCurrentTLV().getValue();
+
+                    byte[] cookie = value.getData();
+
+                    if ( IS_DEBUG )
+                    {
+                        log.debug( "cookie = " + StringTools.dumpBytes( cookie ) );
+                    }
+
+                    SyncRequestValueContainer.getSyncRequestValueControl().setCookie( cookie );
+
+                    // We can have an END transition
+                    SyncRequestValueContainer.grammarEndAllowed( true );
+                }
+            } );
+
+
+        /** 
+         * Transition from mode to reloadHint
+         * SyncRequestValue ::= SEQUENCE OF {
+         *     ...
+         *     reloadHint BOOLEAN DEFAULT FALSE
+         * }
+         *     
+         * Stores the reloadHint flag
+         */
+        super.transitions[SyncRequestValueControlStatesEnum.MODE_STATE][UniversalTag.BOOLEAN_TAG] = 
+            new GrammarTransition( SyncRequestValueControlStatesEnum.MODE_STATE,
+                                    SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN_TAG,
+                new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    SyncRequestValueControlContainer SyncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
+                    Value value = SyncRequestValueContainer.getCurrentTLV().getValue();
+
+                    try
+                    {
+                        boolean reloadHint = BooleanDecoder.parse( value );
+
+                        if ( IS_DEBUG )
+                        {
+                            log.debug( "reloadHint = " + reloadHint );
+                        }
+
+                        SyncRequestValueContainer.getSyncRequestValueControl().setReloadHint( reloadHint );
+
+                        // We can have an END transition
+                        SyncRequestValueContainer.grammarEndAllowed( true );
+                    }
+                    catch ( BooleanDecoderException e )
+                    {
+                        String msg = "failed to decode the reloadHint flag for SyncRequestValueControl";
+                        log.error( msg, e );
+                        throw new DecoderException( msg );
+                    }
+                }
+            } );
+
+
+        /** 
+         * Transition from cookie to reloadHint
+         * SyncRequestValue ::= SEQUENCE OF {
+         *     ...
+         *     reloadHint BOOLEAN DEFAULT FALSE
+         * }
+         *     
+         * Stores the reloadHint flag
+         */
+        super.transitions[SyncRequestValueControlStatesEnum.COOKIE_STATE][UniversalTag.BOOLEAN_TAG] = 
+            new GrammarTransition( SyncRequestValueControlStatesEnum.COOKIE_STATE,
+                                    SyncRequestValueControlStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN_TAG,
+                new GrammarAction( "Set SyncRequestValueControl reloadHint flag" )
+            {
+                public void action( IAsn1Container container ) throws DecoderException
+                {
+                    SyncRequestValueControlContainer SyncRequestValueContainer = ( SyncRequestValueControlContainer ) container;
+                    Value value = SyncRequestValueContainer.getCurrentTLV().getValue();
+
+                    try
+                    {
+                        boolean reloadHint = BooleanDecoder.parse( value );
+
+                        if ( IS_DEBUG )
+                        {
+                            log.debug( "reloadHint = " + reloadHint );
+                        }
+
+                        SyncRequestValueContainer.getSyncRequestValueControl().setReloadHint( reloadHint );
+
+                        // We can have an END transition
+                        SyncRequestValueContainer.grammarEndAllowed( true );
+                    }
+                    catch ( BooleanDecoderException e )
+                    {
+                        String msg = "failed to decode the reloadHint flag for SyncRequestValueControl";
+                        log.error( msg, e );
+                        throw new DecoderException( msg );
+                    }
+                }
+            } );
+    }
+
+
+    /**
+     * This class is a singleton.
+     * 
+     * @return An instance on this grammar
+     */
+    public static IGrammar getInstance()
+    {
+        return instance;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java?rev=741920&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java Sat Feb  7 17:49:43 2009
@@ -0,0 +1,141 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.codec.search.controls.replication.syncRequestValue;
+
+
+import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
+import org.apache.directory.shared.asn1.ber.grammar.IStates;
+
+
+/**
+ * This class store the SyncRequestValueControl's grammar constants. It is also used for
+ * debugging purposes.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 741888 $, $Date: 2009-02-07 13:57:03 +0100 (Sat, 07 Feb 2009) $, 
+ */
+public class SyncRequestValueControlStatesEnum implements IStates
+{
+    // ~ Static fields/initializers
+    // -----------------------------------------------------------------
+
+    // =========================================================================
+    // SyncRequestValue control grammar states
+    // =========================================================================
+    /** Initial state */
+    public static final int START_STATE = 0;
+
+    /** Sequence Value */
+    public static final int SYNC_REQUEST_VALUE_SEQUENCE_STATE = 1;
+
+    /** mode Value */
+    public static final int MODE_STATE = 2;
+    
+    /** cookie Value */
+    public static final int COOKIE_STATE = 3;
+
+    /** reloadHint Value */
+    public static final int RELOAD_HINT_STATE = 4;
+
+    /** terminal state */
+    public static final int LAST_SYNC_REQUEST_VALUE_STATE = 5;
+
+    // =========================================================================
+    // States debug strings
+    // =========================================================================
+    /** A string representation of all the states */
+    private static String[] syncRequestValueString = 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 IStates getInstance()
+    {
+        return instance;
+    }
+
+
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar code
+     * @return The grammar name
+     */
+    public String getGrammarName( int grammar )
+    {
+        return "SYNC_REQUEST_VALUE_GRAMMAR";
+    }
+
+
+    /**
+     * Get the grammar name
+     * 
+     * @param grammar The grammar class
+     * @return The grammar name
+     */
+    public String getGrammarName( IGrammar grammar )
+    {
+        if ( grammar instanceof SyncRequestValueControlGrammar )
+        {
+            return "SYNC_REQUEST_VALUE_GRAMMAR";
+        }
+
+        return "UNKNOWN GRAMMAR";
+    }
+
+
+    /**
+     * Get the string representing the state
+     * 
+     * @param state The state number
+     * @return The String representing the state
+     */
+    public String getState( int state )
+    {
+        return ( ( state == GRAMMAR_END ) ? "SYNC_REQUEST_VALUE_END_STATE" : syncRequestValueString[state] );
+    }
+}