001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue;
021    
022    import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
023    import org.apache.directory.shared.asn1.ber.grammar.IStates;
024    
025    /**
026     * 
027     * ASN.1 grammer constants of SyncDoneValueControl.
028     *
029     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
030     * @version $Rev$, $Date$
031     */
032    public class SyncDoneValueControlStatesEnum implements IStates
033    {
034        /***/
035        public static final int START_STATE = 0;
036        
037        /** sequence start state */
038        public static final int SYNC_DONE_VALUE_SEQUENCE_STATE = 1;
039        
040        /** cookie value state */
041        public static final int COOKIE_STATE = 2;
042        
043        /** refreshDeletes value state */
044        public static final int REFRESH_DELETES_STATE = 3;
045        
046        /** terminal state */
047        public static final int LAST_SYNC_DONE_VALUE_STATE = 4;
048        
049        public static String[] syncDoneValueString = new String[]
050           {
051           "START_STATE",
052           "SYNC_DONE_VALUE_SEQUENCE_STATE",
053           "COOKIE_STATE",
054           "REFRESH_DELETES_STATE",
055           };
056        
057        private static SyncDoneValueControlStatesEnum instance = new SyncDoneValueControlStatesEnum();
058        
059        private SyncDoneValueControlStatesEnum()
060        {
061        }
062        
063        /**
064         * Get an instance of this class
065         * 
066         * @return An instance on this class
067         */
068        public static IStates getInstance()
069        {
070            return instance;
071        }
072    
073    
074        /**
075         * Get the grammar name
076         * 
077         * @param grammar The grammar code
078         * @return The grammar name
079         */
080        public String getGrammarName( int grammar )
081        {
082            return "SYNC_DONE_VALUE_GRAMMAR";
083        }
084    
085    
086        /**
087         * Get the grammar name
088         * 
089         * @param grammar The grammar class
090         * @return The grammar name
091         */
092        public String getGrammarName( IGrammar grammar )
093        {
094            if ( grammar instanceof SyncDoneValueControlGrammar )
095            {
096                return "SYNC_DONE_VALUE_GRAMMAR";
097            }
098    
099            return "UNKNOWN GRAMMAR";
100        }
101    
102    
103        /**
104         * Get the string representing the state
105         * 
106         * @param state The state number
107         * @return The String representing the state
108         */
109        public String getState( int state )
110        {
111            return ( ( state == GRAMMAR_END ) ? "SYNC_DONE_VALUE_GRAMMAR" : syncDoneValueString[state] );
112        }
113        
114    }