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.whoAmI; 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 WhoAmIResponse'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 WhoAmIResponseStatesEnum implements States 034{ 035 036 /** The END_STATE */ 037 END_STATE, 038 039 /** start state*/ 040 START_STATE, 041 042 /** the authzid */ 043 AUTHZ_ID_RESPONSE_STATE, 044 045 /** Last state */ 046 LAST_WHO_AM_I_RESPONSE_STATE; 047 048 /** 049 * Get the grammar name 050 * 051 * @param grammar The grammar class 052 * @return The grammar name 053 */ 054 public String getGrammarName( Grammar<WhoAmIResponseContainer> grammar ) 055 { 056 return "WHO_AM_I_RESPONSE_GRAMMER"; 057 } 058 059 060 /** 061 * Get the grammar name 062 * 063 * @param grammar The grammar code 064 * @return The grammar name 065 */ 066 public String getGrammarName( int grammar ) 067 { 068 return "WHO_AM_I_RESPONSE_GRAMMER"; 069 } 070 071 072 /** 073 * Get the string representing the state 074 * 075 * @param state The state number 076 * @return The String representing the state 077 */ 078 public String getState( int state ) 079 { 080 return ( ( state == END_STATE.ordinal() ) ? "WHO_AM_I_RESPONSE_GRAMMER" : this.name() ); 081 } 082 083 084 /** 085 * {@inheritDoc} 086 */ 087 public boolean isEndState() 088 { 089 return this == END_STATE; 090 } 091 092 093 /** 094 * {@inheritDoc} 095 */ 096 public WhoAmIResponseStatesEnum getStartState() 097 { 098 return START_STATE; 099 } 100}