View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  
21  package org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure;
22  
23  
24  import org.apache.directory.api.asn1.ber.grammar.Grammar;
25  import org.apache.directory.api.asn1.ber.grammar.States;
26  
27  
28  /**
29   * Constants for StoredProcedureGrammar.
30   * 
31   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
32   */
33  public enum StoredProcedureStatesEnum implements States
34  {
35      //~ Static fields/initializers -----------------------------------------------------------------
36  
37      /** The END_STATE */
38      END_STATE,
39  
40      //=========================================================================
41      // StoredProcedure
42      //=========================================================================
43      /** starting state */
44      START_STATE,
45  
46      /** StoredProcedure */
47      STORED_PROCEDURE_STATE,
48  
49      // Language ---------------------------------------------------------------
50      /** Language */
51      LANGUAGE_STATE,
52  
53      // Procedure --------------------------------------------------------------
54      /** Procedure */
55      PROCEDURE_STATE,
56  
57      // Parameters -------------------------------------------------------------
58      /** Parameters */
59      PARAMETERS_STATE,
60  
61      // Parameter --------------------------------------------------------------
62      /** Parameter */
63      PARAMETER_STATE,
64  
65      // Parameter type ---------------------------------------------------------
66      /** Parameter type */
67      PARAMETER_TYPE_STATE,
68  
69      // Parameters value -------------------------------------------------------
70      /** Parameter value */
71      PARAMETER_VALUE_STATE,
72  
73      /** Last Stored Procedure */
74      LAST_STORED_PROCEDURE_STATE;
75  
76      /**
77       * Get the grammar name
78       * @param grammar The grammar code
79       * @return The grammar name
80       */
81      public String getGrammarName( int grammar )
82      {
83          return "STORED_PROCEDURE_GRAMMAR";
84      }
85  
86  
87      /**
88       * Get the grammar name
89       * @param grammar The grammar class
90       * @return The grammar name
91       */
92      public String getGrammarName( Grammar<StoredProcedureContainer> grammar )
93      {
94          return "STORED_PROCEDURE_GRAMMAR";
95      }
96  
97  
98      /**
99       * 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 }