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.controls.ad; 021 022 023import org.apache.directory.api.asn1.ber.grammar.Grammar; 024import org.apache.directory.api.asn1.ber.grammar.States; 025 026 027/** 028 * ASN.1 grammar constants of AdDirSync Control. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public enum AdDirSyncStatesEnum implements States 033{ 034 035 /** The END_STATE */ 036 END_STATE, 037 038 /***/ 039 START_STATE, 040 041 /** sequence start state */ 042 AD_DIR_SYNC_SEQUENCE_STATE, 043 044 /** flag state */ 045 FLAG_STATE, 046 047 /** maxReturnLength value state */ 048 MAX_RETURN_LENGTH_STATE, 049 050 /** cookie value state */ 051 COOKIE_STATE, 052 053 /** terminal state */ 054 LAST_AD_DIR_SYNC_STATE; 055 056 /** 057 * Get the grammar name 058 * 059 * @param grammar The grammar code 060 * @return The grammar name 061 */ 062 public String getGrammarName( int grammar ) 063 { 064 return "AD_DIR_SYNC_GRAMMAR"; 065 } 066 067 068 /** 069 * Get the grammar name 070 * 071 * @param grammar The grammar class 072 * @return The grammar name 073 */ 074 public String getGrammarName( Grammar<AdDirSyncContainer> grammar ) 075 { 076 if ( grammar instanceof AdDirSyncGrammar ) 077 { 078 return "AD_DIR_SYNC_GRAMMAR"; 079 } 080 081 return "UNKNOWN GRAMMAR"; 082 } 083 084 085 /** 086 * Get the string representing the state 087 * 088 * @param state The state number 089 * @return The String representing the state 090 */ 091 public String getState( int state ) 092 { 093 return ( ( state == END_STATE.ordinal() ) ? "AD_DIR_SYNC_GRAMMAR" : this.name() ); 094 } 095 096 097 /** 098 * {@inheritDoc} 099 */ 100 public boolean isEndState() 101 { 102 return this == END_STATE; 103 } 104 105 106 /** 107 * {@inheritDoc} 108 */ 109 public AdDirSyncStatesEnum getStartState() 110 { 111 return START_STATE; 112 } 113}