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 */
020package org.apache.directory.api.ldap.extras.controls.syncrepl_impl;
021
022
023import org.apache.directory.api.asn1.ber.grammar.States;
024
025
026/**
027 * This class store the SyncInfoValueControl's grammar constants. It is also used for
028 * debugging purposes.
029 * 
030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031 */
032public enum SyncInfoValueStatesEnum implements States
033{
034    // ~ Static fields/initializers
035    // -----------------------------------------------------------------
036
037    /** The END_STATE */
038    END_STATE,
039
040    // =========================================================================
041    // SyncRequestValue control grammar states
042    // =========================================================================
043    /** Initial state */
044    START_STATE,
045
046    /** NewCookie state */
047    NEW_COOKIE_STATE,
048
049    /** RefreshDelete state */
050    REFRESH_DELETE_STATE,
051
052    /** RefreshDelete cookie state */
053    REFRESH_DELETE_COOKIE_STATE,
054
055    /** RefreshDelete refreshDone state */
056    REFRESH_DELETE_REFRESH_DONE_STATE,
057
058    /** RefreshPresent state */
059    REFRESH_PRESENT_STATE,
060
061    /** RefreshPresent cookie state */
062    REFRESH_PRESENT_COOKIE_STATE,
063
064    /** RefreshPresent refreshDone state */
065    REFRESH_PRESENT_REFRESH_DONE_STATE,
066
067    /** SyncIdSet state */
068    SYNC_ID_SET_STATE,
069
070    /** SyncIdSet cookie state */
071    SYNC_ID_SET_COOKIE_STATE,
072
073    /** SyncIdSet refreshDone state */
074    SYNC_ID_SET_REFRESH_DELETES_STATE,
075
076    /** SyncIdSet SET OF UUIDs state */
077    SYNC_ID_SET_SET_OF_UUIDS_STATE,
078
079    /** SyncIdSet UUID state */
080    SYNC_ID_SET_UUID_STATE,
081
082    /** terminal state */
083    LAST_SYNC_INFO_VALUE_STATE;
084
085    /**
086     * Get the grammar name
087     * 
088     * @return The grammar name
089     */
090    public String getGrammarName()
091    {
092        return "SYNC_INFO_VALUE_GRAMMAR";
093    }
094
095
096    /**
097     * Get the string representing the state
098     * 
099     * @param state The state number
100     * @return The String representing the state
101     */
102    public String getState( int state )
103    {
104        return ( state == END_STATE.ordinal() ) ? "SYNC_INFO_VALUE_END_STATE" : this.name();
105    }
106
107
108    /**
109     * {@inheritDoc}
110     */
111    @Override
112    public boolean isEndState()
113    {
114        return this == END_STATE;
115    }
116
117
118    /**
119     * {@inheritDoc}
120     */
121    @Override
122    public SyncInfoValueStatesEnum getStartState()
123    {
124        return START_STATE;
125    }
126}