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  package org.apache.directory.api.ldap.codec;
21  
22  
23  import org.apache.directory.api.asn1.ber.grammar.States;
24  
25  
26  /**
27   * This class store the Ldap grammar's constants. It is also used for debugging
28   * purpose
29   *
30   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31   */
32  public enum LdapStatesEnum implements States
33  {
34      /** The END_STATE */
35      END_STATE,
36  
37      START_STATE,
38      LDAP_MESSAGE_STATE,
39      MESSAGE_ID_STATE,
40      BIND_REQUEST_STATE,
41      BIND_RESPONSE_STATE,
42      UNBIND_REQUEST_STATE,
43      SEARCH_REQUEST_STATE,
44      SEARCH_RESULT_ENTRY_STATE,
45      SEARCH_RESULT_DONE_STATE,
46      SEARCH_RESULT_REFERENCE_STATE,
47      MODIFY_REQUEST_STATE,
48      MODIFY_RESPONSE_STATE,
49      ADD_REQUEST_STATE,
50      ADD_RESPONSE_STATE,
51      DEL_REQUEST_STATE,
52      DEL_RESPONSE_STATE,
53      MODIFY_DN_REQUEST_STATE,
54      MODIFY_DN_RESPONSE_STATE,
55      COMPARE_REQUEST_STATE,
56      COMPARE_RESPONSE_STATE,
57      ABANDON_REQUEST_STATE,
58      EXTENDED_REQUEST_STATE,
59      EXTENDED_RESPONSE_STATE,
60      VERSION_STATE,
61      NAME_STATE,
62      SIMPLE_STATE,
63      SASL_STATE,
64      MECHANISM_STATE,
65      CREDENTIALS_STATE,
66      RESULT_CODE_BR_STATE,
67      MATCHED_DN_BR_STATE,
68      ERROR_MESSAGE_BR_STATE,
69      REFERRALS_BR_STATE,
70      REFERRAL_BR_STATE,
71      SERVER_SASL_CREDENTIALS_STATE,
72      RESULT_CODE_STATE,
73      MATCHED_DN_STATE,
74      ERROR_MESSAGE_STATE,
75      REFERRALS_STATE,
76      REFERRAL_STATE,
77      REQUEST_NAME_STATE,
78      REQUEST_VALUE_STATE,
79      RESPONSE_NAME_STATE,
80      RESPONSE_STATE,
81      RESULT_CODE_ER_STATE,
82      MATCHED_DN_ER_STATE,
83      ERROR_MESSAGE_ER_STATE,
84      REFERRALS_ER_STATE,
85      REFERRAL_ER_STATE,
86      ENTRY_STATE,
87      ATTRIBUTES_STATE,
88      ATTRIBUTE_STATE,
89      TYPE_STATE,
90      VALUES_STATE,
91      VALUE_STATE,
92      OBJECT_STATE,
93      MODIFICATIONS_STATE,
94      MODIFICATIONS_SEQ_STATE,
95      OPERATION_STATE,
96      MODIFICATION_STATE,
97      TYPE_MOD_STATE,
98      VALS_STATE,
99      ATTRIBUTE_VALUE_STATE,
100     ENTRY_MOD_DN_STATE,
101     NEW_RDN_STATE,
102     DELETE_OLD_RDN_STATE,
103     NEW_SUPERIOR_STATE,
104     ENTRY_COMP_STATE,
105     AVA_STATE,
106     ATTRIBUTE_DESC_STATE,
107     ASSERTION_VALUE_STATE,
108     BASE_OBJECT_STATE,
109     SCOPE_STATE,
110     DEREF_ALIAS_STATE,
111     SIZE_LIMIT_STATE,
112     TIME_LIMIT_STATE,
113     TYPES_ONLY_STATE,
114     AND_STATE,
115     OR_STATE,
116     NOT_STATE,
117     EQUALITY_MATCH_STATE,
118     SUBSTRING_FILTER_STATE,
119     GREATER_OR_EQUAL_STATE,
120     LESS_OR_EQUAL_STATE,
121     PRESENT_STATE,
122     APPROX_MATCH_STATE,
123     EXTENSIBLE_MATCH_STATE,
124     ATTRIBUTE_DESC_FILTER_STATE,
125     ASSERTION_VALUE_FILTER_STATE,
126     ATTRIBUTE_DESCRIPTION_LIST_STATE,
127     ATTRIBUTE_DESCRIPTION_STATE,
128     TYPE_SUBSTRING_STATE,
129     SUBSTRINGS_STATE,
130     INITIAL_STATE,
131     ANY_STATE,
132     FINAL_STATE,
133     MATCHING_RULE_STATE,
134     TYPE_MATCHING_RULE_STATE,
135     MATCH_VALUE_STATE,
136     DN_ATTRIBUTES_STATE,
137     OBJECT_NAME_STATE,
138     ATTRIBUTES_SR_STATE,
139     PARTIAL_ATTRIBUTES_LIST_STATE,
140     TYPE_SR_STATE,
141     VALS_SR_STATE,
142     ATTRIBUTE_VALUE_SR_STATE,
143     REFERENCE_STATE,
144     CONTROLS_STATE,
145     CONTROL_STATE,
146     CONTROL_TYPE_STATE,
147     CRITICALITY_STATE,
148     CONTROL_VALUE_STATE,
149     INTERMEDIATE_RESPONSE_STATE,
150     INTERMEDIATE_RESPONSE_NAME_STATE,
151     INTERMEDIATE_RESPONSE_VALUE_STATE,
152     LAST_LDAP_STATE;
153 
154     /**
155      * Get the grammar name
156      *
157      * @return The grammar name
158      */
159     public String getGrammarName()
160     {
161         return "LDAP_MESSAGE_GRAMMAR";
162     }
163 
164 
165     /**
166      * Get the string representing the state
167      *
168      * @param state The state number
169      * @return The String representing the state
170      */
171     public String getState( int state )
172     {
173         return ( state == END_STATE.ordinal() ) ? "LDAP_MESSAGE_END_STATE" : name();
174     }
175 
176 
177     /**
178      * {@inheritDoc}
179      */
180     @Override
181     public boolean isEndState()
182     {
183         return this == END_STATE;
184     }
185 
186 
187     /**
188      * {@inheritDoc}
189      */
190     @Override
191     public LdapStatesEnum getStartState()
192     {
193         return START_STATE;
194     }
195 }