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.syncrepl_impl; 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 SyncInfoValueControl's grammar constants. It is also used for 029 * debugging purposes. 030 * 031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 032 */ 033public enum SyncInfoValueStatesEnum implements States 034{ 035 // ~ Static fields/initializers 036 // ----------------------------------------------------------------- 037 038 /** The END_STATE */ 039 END_STATE, 040 041 // ========================================================================= 042 // SyncRequestValue control grammar states 043 // ========================================================================= 044 /** Initial state */ 045 START_STATE, 046 047 /** NewCookie state */ 048 NEW_COOKIE_STATE, 049 050 /** RefreshDelete state */ 051 REFRESH_DELETE_STATE, 052 053 /** RefreshDelete cookie state */ 054 REFRESH_DELETE_COOKIE_STATE, 055 056 /** RefreshDelete refreshDone state */ 057 REFRESH_DELETE_REFRESH_DONE_STATE, 058 059 /** RefreshPresent state */ 060 REFRESH_PRESENT_STATE, 061 062 /** RefreshPresent cookie state */ 063 REFRESH_PRESENT_COOKIE_STATE, 064 065 /** RefreshPresent refreshDone state */ 066 REFRESH_PRESENT_REFRESH_DONE_STATE, 067 068 /** SyncIdSet state */ 069 SYNC_ID_SET_STATE, 070 071 /** SyncIdSet cookie state */ 072 SYNC_ID_SET_COOKIE_STATE, 073 074 /** SyncIdSet refreshDone state */ 075 SYNC_ID_SET_REFRESH_DELETES_STATE, 076 077 /** SyncIdSet SET OF UUIDs state */ 078 SYNC_ID_SET_SET_OF_UUIDS_STATE, 079 080 /** SyncIdSet UUID state */ 081 SYNC_ID_SET_UUID_STATE, 082 083 /** terminal state */ 084 LAST_SYNC_INFO_VALUE_STATE; 085 086 /** 087 * Get the grammar name 088 * 089 * @param grammar The grammar code 090 * @return The grammar name 091 */ 092 public String getGrammarName( int grammar ) 093 { 094 return "SYNC_INFO_VALUE_GRAMMAR"; 095 } 096 097 098 /** 099 * Get the grammar name 100 * 101 * @param grammar The grammar class 102 * @return The grammar name 103 */ 104 public String getGrammarName( Grammar<SyncInfoValueContainer> grammar ) 105 { 106 if ( grammar instanceof SyncInfoValueGrammar ) 107 { 108 return "SYNC_INFO_VALUE_GRAMMAR"; 109 } 110 111 return "UNKNOWN GRAMMAR"; 112 } 113 114 115 /** 116 * Get the string representing the state 117 * 118 * @param state The state number 119 * @return The String representing the state 120 */ 121 public String getState( int state ) 122 { 123 return ( ( state == END_STATE.ordinal() ) ? "SYNC_INFO_VALUE_END_STATE" : this.name() ); 124 } 125 126 127 /** 128 * {@inheritDoc} 129 */ 130 public boolean isEndState() 131 { 132 return this == END_STATE; 133 } 134 135 136 /** 137 * {@inheritDoc} 138 */ 139 public SyncInfoValueStatesEnum getStartState() 140 { 141 return START_STATE; 142 } 143}