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 *    https://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.extended.ads_impl.endTransaction;
021
022
023import org.apache.directory.api.asn1.ber.grammar.States;
024
025
026/**
027 * This class store the EndTransactionResponse's grammar constants. It is also used
028 * for debugging purposes.
029 * 
030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031 */
032public enum EndTransactionResponseStates implements States
033{
034    /** The END_STATE */
035    END_STATE,
036    
037    /** start state*/
038    START_STATE,
039    
040    /** The initial SEQUENCE */
041    END_TRANSACTION_SEQUENCE_STATE,
042    
043    /** The failed message ID */
044    FAILED_MESSAGE_ID_STATE,
045    
046    /** The update controls SEQ */
047    UPDATE_CONTROLS_SEQ_STATE,
048    
049    /** The update control SEQ */
050    UPDATE_CONTROL_SEQ_STATE,
051    
052    /** THe control's message ID state */
053    CONTROL_MESSAGE_ID_STATE,
054    
055    /** The control's state */
056    CONTROLS_STATE,
057
058    /** Last state */
059    LAST_STATE;
060
061
062    /**
063     * Get the grammar name
064     * 
065     * @return The grammar name
066     */
067    public String getGrammarName()
068    {
069        return "END_TRANSACTION_RESPONSE_GRAMMER";
070    }
071
072
073    /**
074     * Get the string representing the state
075     * 
076     * @param state The state number
077     * @return The String representing the state
078     */
079    public String getState( int state )
080    {
081        return ( state == END_STATE.ordinal() ) ? "END_TRANSACTION_RESPONSE_GRAMMER" : name();
082    }
083
084
085    /**
086     * {@inheritDoc}
087     */
088    @Override
089    public boolean isEndState()
090    {
091        return this == END_STATE;
092    }
093
094
095    /**
096     * {@inheritDoc}
097     */
098    @Override
099    public EndTransactionResponseStates getStartState()
100    {
101        return START_STATE;
102    }
103}