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.endTransaction.controls; 021 022import org.apache.directory.api.asn1.ber.grammar.States; 023 024/** 025 * This class store the Controls' grammar constants. It is also used 026 * for debugging purposes. 027 * 028 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 029 */ 030public enum ControlsStates implements States 031{ 032 /** The END_STATE */ 033 END_STATE, 034 035 /** start state*/ 036 START_STATE, 037 038 /** The Control SEQUENCE */ 039 CONTROL_SEQUENCE_STATE, 040 041 /** The Control type */ 042 CONTROL_TYPE_STATE, 043 044 /** The criticality */ 045 CONTROL_CRITICALITY_STATE, 046 047 /** The value */ 048 CONTROL_VALUE_STATE, 049 050 /** Last state */ 051 LAST_STATE; 052 053 054 /** 055 * Get the grammar name 056 * 057 * @return The grammar name 058 */ 059 public String getGrammarName() 060 { 061 return "CONTROLS_GRAMMAR"; 062 } 063 064 065 /** 066 * Get the string representing the state 067 * 068 * @param state The state number 069 * @return The String representing the state 070 */ 071 public String getState( int state ) 072 { 073 return ( state == END_STATE.ordinal() ) ? "CONTROLS_GRAMMER" : name(); 074 } 075 076 077 /** 078 * {@inheritDoc} 079 */ 080 @Override 081 public boolean isEndState() 082 { 083 return this == END_STATE; 084 } 085 086 087 /** 088 * {@inheritDoc} 089 */ 090 @Override 091 public ControlsStates getStartState() 092 { 093 return START_STATE; 094 } 095}