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.extended.ads_impl.pwdModify;
021
022
023import org.apache.directory.api.asn1.ber.grammar.Grammar;
024import org.apache.directory.api.asn1.ber.grammar.States;
025
026
027/**
028 * This class store the PasswordModifyRequest's grammar constants. It is also used
029 * for debugging purposes.
030 * 
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public enum PasswordModifyRequestStatesEnum implements States
034{
035
036    /** The END_STATE */
037    END_STATE,
038
039    /** start state*/
040    START_STATE,
041
042    /** sequence*/
043    PASSWORD_MODIFY_REQUEST_SEQUENCE_STATE,
044
045    /** the UserIdentity */
046    USER_IDENTITY_STATE,
047
048    /** the old password */
049    OLD_PASSWORD_STATE,
050
051    /** the new password*/
052    NEW_PASSWORD_STATE,
053
054    /** Last state */
055    LAST_PASSWORD_MODIFY_REQUEST_STATE;
056
057    /**
058     * Get the grammar name
059     * 
060     * @param grammar The grammar class
061     * @return The grammar name
062     */
063    public String getGrammarName( Grammar<PasswordModifyRequestContainer> grammar )
064    {
065        return "PASSWORD_MODIFY_REQUEST_GRAMMER";
066    }
067
068
069    /**
070     * Get the grammar name
071     * 
072     * @param grammar The grammar code
073     * @return The grammar name
074     */
075    public String getGrammarName( int grammar )
076    {
077        return "PASSWORD_MODIFY_REQUEST_GRAMMER";
078    }
079
080
081    /**
082     * Get the string representing the state
083     * 
084     * @param state The state number
085     * @return The String representing the state
086     */
087    public String getState( int state )
088    {
089        return ( ( state == END_STATE.ordinal() ) ? "PASSWORD_MODIFY_REQUEST_GRAMMER" : this.name() );
090    }
091
092
093    /**
094     * {@inheritDoc}
095     */
096    public boolean isEndState()
097    {
098        return this == END_STATE;
099    }
100
101
102    /**
103     * {@inheritDoc}
104     */
105    public PasswordModifyRequestStatesEnum getStartState()
106    {
107        return START_STATE;
108    }
109}