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.gracefulShutdown; 021 022 023import org.apache.directory.api.asn1.ber.grammar.States; 024 025 026/** 027 * This class store the GracefulShutdown's grammar constants. It is also used 028 * for debugging purposes. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public enum GracefulShutdownStatesEnum implements States 033{ 034 // ~ Static fields/initializers 035 // ----------------------------------------------------------------- 036 037 /** The END_STATE */ 038 END_STATE, 039 040 // ========================================================================= 041 // GracefulShutdown grammar states 042 // ========================================================================= 043 044 /** Initial state */ 045 START_STATE, 046 047 /** Sequence */ 048 GRACEFUL_SHUTDOWN_SEQUENCE_STATE, 049 050 /** Time offline */ 051 TIME_OFFLINE_STATE, 052 053 /** Delay */ 054 DELAY_STATE, 055 056 /** terminal state */ 057 LAST_GRACEFUL_SHUTDOWN_STATE; 058 059 /** 060 * Get the grammar name 061 * 062 * @return The grammar name 063 */ 064 public String getGrammarName() 065 { 066 return "GRACEFUL_SHUTDOWN_GRAMMAR"; 067 } 068 069 070 /** 071 * Get the string representing the state 072 * 073 * @param state The state number 074 * @return The String representing the state 075 */ 076 public String getState( int state ) 077 { 078 return ( state == END_STATE.ordinal() ) ? "GRACEFUL_SHUTDOWN_END_STATE" : name(); 079 } 080 081 082 /** 083 * {@inheritDoc} 084 */ 085 @Override 086 public boolean isEndState() 087 { 088 return this == END_STATE; 089 } 090 091 092 /** 093 * {@inheritDoc} 094 */ 095 @Override 096 public GracefulShutdownStatesEnum getStartState() 097 { 098 return START_STATE; 099 } 100}