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.encTgsRepPart; 021 022 023import org.apache.directory.api.asn1.ber.grammar.AbstractGrammar; 024import org.apache.directory.api.asn1.ber.grammar.Grammar; 025import org.apache.directory.api.asn1.ber.grammar.GrammarTransition; 026import org.apache.directory.shared.kerberos.KerberosConstants; 027import org.apache.directory.shared.kerberos.codec.encTgsRepPart.actions.StoreEncTgsRepPart; 028import org.slf4j.Logger; 029import org.slf4j.LoggerFactory; 030 031 032/** 033 * This class implements the EncTgsRepPart structure. All the actions are declared 034 * in this class. As it is a singleton, these declaration are only done once. If 035 * an action is to be added or modified, this is where the work is to be done ! 036 * 037 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 038 */ 039public final class EncTgsRepPartGrammar extends AbstractGrammar<EncTgsRepPartContainer> 040{ 041 /** The logger */ 042 static final Logger LOG = LoggerFactory.getLogger( EncTgsRepPartGrammar.class ); 043 044 /** A speedup for logger */ 045 static final boolean IS_DEBUG = LOG.isDebugEnabled(); 046 047 /** The instance of grammar. EncTgsRepPartGrammar is a singleton */ 048 private static Grammar<EncTgsRepPartContainer> instance = new EncTgsRepPartGrammar(); 049 050 051 /** 052 * Creates a new EncTgsRepPartGrammar object. 053 */ 054 @SuppressWarnings("unchecked") 055 private EncTgsRepPartGrammar() 056 { 057 setName( EncTgsRepPartGrammar.class.getName() ); 058 059 // Create the transitions table 060 super.transitions = new GrammarTransition[EncTgsRepPartStatesEnum.LAST_ENC_TGS_REP_PART_STATE.ordinal()][256]; 061 062 // ============================================================================================ 063 // EncTgsRepPart 064 // ============================================================================================ 065 // -------------------------------------------------------------------------------------------- 066 // Transition from EncTgsRepPart init to EncKDCRepPart 067 // -------------------------------------------------------------------------------------------- 068 // EncASRepPart ::= [APPLICATION 25] EncKDCRepPart 069 super.transitions[EncTgsRepPartStatesEnum.START_STATE.ordinal()][KerberosConstants.ENC_TGS_REP_PART_TAG] = 070 new GrammarTransition<EncTgsRepPartContainer>( 071 EncTgsRepPartStatesEnum.START_STATE, 072 EncTgsRepPartStatesEnum.ENC_TGS_REP_PART_STATE, 073 KerberosConstants.ENC_TGS_REP_PART_TAG, 074 new StoreEncTgsRepPart() ); 075 } 076 077 078 /** 079 * Get the instance of this grammar 080 * 081 * @return An instance on the EncAsRepPart Grammar 082 */ 083 public static Grammar<EncTgsRepPartContainer> getInstance() 084 { 085 return instance; 086 } 087}