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 */ 020 021package org.apache.directory.api.ldap.extras.controls.vlv_impl; 022 023 024import org.apache.directory.api.asn1.ber.grammar.Grammar; 025import org.apache.directory.api.asn1.ber.grammar.States; 026 027 028/** 029 * This class store the VirtualListViewResponse grammar constants. It is also used for 030 * debugging purposes. 031 * 032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 033 */ 034public enum VirtualListViewResponseStates implements States 035{ 036 START_STATE, 037 VLV_SEQUENCE_STATE, 038 VLV_TARGET_POSITION_STATE, 039 VLV_CONTENT_COUNT_STATE, 040 VLV_VIRTUAL_LIST_VIEW_RESULT_STATE, 041 VLV_CONTEXT_ID_STATE, 042 END_STATE; 043 044 public String getGrammarName( int grammar ) 045 { 046 return "VLV_RESPONSE_GRAMMAR"; 047 } 048 049 050 public String getGrammarName( Grammar<?> grammar ) 051 { 052 if ( grammar instanceof VirtualListViewResponseGrammar ) 053 { 054 return "VLV_RESPONSE_GRAMMAR"; 055 } 056 057 return "UNKNOWN GRAMMAR"; 058 } 059 060 061 public String getState( int state ) 062 { 063 return ( ( state == END_STATE.ordinal() ) ? "VLV_RESPONSE_END_STATE" : name() ); 064 } 065 066 067 @Override 068 public boolean isEndState() 069 { 070 return this == END_STATE; 071 } 072 073 074 @Override 075 public Enum<?> getStartState() 076 { 077 return START_STATE; 078 } 079}