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
021package org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure;
022
023
024import org.apache.directory.api.asn1.ber.grammar.Grammar;
025import org.apache.directory.api.asn1.ber.grammar.States;
026
027
028/**
029 * Constants for StoredProcedureGrammar.
030 * 
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public enum StoredProcedureStatesEnum implements States
034{
035    //~ Static fields/initializers -----------------------------------------------------------------
036
037    /** The END_STATE */
038    END_STATE,
039
040    //=========================================================================
041    // StoredProcedure
042    //=========================================================================
043    /** starting state */
044    START_STATE,
045
046    /** StoredProcedure */
047    STORED_PROCEDURE_STATE,
048
049    // Language ---------------------------------------------------------------
050    /** Language */
051    LANGUAGE_STATE,
052
053    // Procedure --------------------------------------------------------------
054    /** Procedure */
055    PROCEDURE_STATE,
056
057    // Parameters -------------------------------------------------------------
058    /** Parameters */
059    PARAMETERS_STATE,
060
061    // Parameter --------------------------------------------------------------
062    /** Parameter */
063    PARAMETER_STATE,
064
065    // Parameter type ---------------------------------------------------------
066    /** Parameter type */
067    PARAMETER_TYPE_STATE,
068
069    // Parameters value -------------------------------------------------------
070    /** Parameter value */
071    PARAMETER_VALUE_STATE,
072
073    /** Last Stored Procedure */
074    LAST_STORED_PROCEDURE_STATE;
075
076    /**
077     * Get the grammar name
078     * @param grammar The grammar code
079     * @return The grammar name
080     */
081    public String getGrammarName( int grammar )
082    {
083        return "STORED_PROCEDURE_GRAMMAR";
084    }
085
086
087    /**
088     * Get the grammar name
089     * @param grammar The grammar class
090     * @return The grammar name
091     */
092    public String getGrammarName( Grammar<StoredProcedureContainer> grammar )
093    {
094        return "STORED_PROCEDURE_GRAMMAR";
095    }
096
097
098    /**
099     * Get the string representing the state
100     * 
101     * @param state The state number
102     * @return The String representing the state
103     */
104    public String getState( int state )
105    {
106        return ( ( state == END_STATE.ordinal() ) ? "STORED_PROCEDURE_END_STATE" : name() );
107    }
108
109
110    /**
111     * {@inheritDoc}
112     */
113    public boolean isEndState()
114    {
115        return this == END_STATE;
116    }
117
118
119    /**
120     * {@inheritDoc}
121     */
122    public StoredProcedureStatesEnum getStartState()
123    {
124        return START_STATE;
125    }
126}