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.shared.kerberos.codec.encTicketPart; 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 EncTicketPart grammar's constants. It is also used for debugging 029 * purpose 030 * 031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 032 */ 033public enum EncTicketPartStatesEnum implements States 034{ 035 // Start 036 START_STATE, // 0 037 038 ENC_TICKET_PART_TAG_STATE, // 1 039 040 ENC_TICKET_PART_SEQ_STATE, // 2 041 042 ENC_TICKET_PART_FLAGS_TAG_STATE, // 3 043 ENC_TICKET_PART_FLAGS_STATE, // 4 044 045 ENC_TICKET_PART_KEY_TAG_STATE, // 5 046 047 ENC_TICKET_PART_CREALM_TAG_STATE, // 6 048 ENC_TICKET_PART_CREALM_STATE, // 7 049 050 ENC_TICKET_PART_CNAME_TAG_STATE, // 8 051 052 ENC_TICKET_PART_TRANSITED_TAG_STATE, // 9 053 054 ENC_TICKET_PART_AUTHTIME_TAG_STATE, // 10 055 ENC_TICKET_PART_AUTHTIME_STATE, // 11 056 057 ENC_TICKET_PART_STARTTIME_TAG_STATE, // 12 058 ENC_TICKET_PART_STARTTIME_STATE, // 13 059 060 ENC_TICKET_PART_ENDTIME_TAG_STATE, // 14 061 ENC_TICKET_PART_ENDTIME_STATE, // 15 062 063 ENC_TICKET_PART_RENEWTILL_TAG_STATE, // 16 064 ENC_TICKET_PART_RENEWTILL_STATE, // 17 065 066 ENC_TICKET_PART_CADDR_TAG_STATE, // 18 067 068 ENC_TICKET_PART_AUTHZ_DATA_TAG_STATE, // 19 069 070 // End 071 LAST_ENC_TICKET_PART_STATE; // 20 072 073 /** 074 * Get the grammar name 075 * 076 * @param grammar The grammar code 077 * @return The grammar name 078 */ 079 public String getGrammarName( int grammar ) 080 { 081 return "ENC_TICKET_PART_GRAMMAR"; 082 } 083 084 085 /** 086 * Get the grammar name 087 * 088 * @param grammar The grammar class 089 * @return The grammar name 090 */ 091 public String getGrammarName( Grammar<EncTicketPartContainer> grammar ) 092 { 093 if ( grammar instanceof EncTicketPartGrammar ) 094 { 095 return "ENC_TICKET_PART_GRAMMAR"; 096 } 097 else 098 { 099 return "UNKNOWN GRAMMAR"; 100 } 101 } 102 103 104 /** 105 * Get the string representing the state 106 * 107 * @param state The state number 108 * @return The String representing the state 109 */ 110 public String getState( int state ) 111 { 112 return ( ( state == LAST_ENC_TICKET_PART_STATE.ordinal() ) ? "LAST_ENC_TICKET_PART_STATE" : name() ); 113 } 114 115 116 /** 117 * {@inheritDoc} 118 */ 119 public boolean isEndState() 120 { 121 return this == LAST_ENC_TICKET_PART_STATE; 122 } 123 124 125 /** 126 * {@inheritDoc} 127 */ 128 public EncTicketPartStatesEnum getStartState() 129 { 130 return START_STATE; 131 } 132}