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 package org.apache.directory.server.xdbm; 020 021 022 import org.apache.directory.server.i18n.I18n; 023 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException; 024 025 026 /** 027 * An empty Cursor implementation. 028 * 029 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 030 * @version $Rev$, $Date$ 031 */ 032 public class EmptyIndexCursor<K, E, ID> extends AbstractIndexCursor<K, E, ID> 033 { 034 public boolean available() 035 { 036 return false; 037 } 038 039 040 public void before( IndexEntry<K, E, ID> element ) throws Exception 041 { 042 checkNotClosed( "before()" ); 043 } 044 045 046 public void after( IndexEntry<K, E, ID> element ) throws Exception 047 { 048 checkNotClosed( "after()" ); 049 } 050 051 052 public void beforeFirst() throws Exception 053 { 054 checkNotClosed( "beforeFirst()" ); 055 } 056 057 058 public void afterLast() throws Exception 059 { 060 checkNotClosed( "afterLast()" ); 061 } 062 063 064 public boolean first() throws Exception 065 { 066 checkNotClosed( "first()" ); 067 return false; 068 } 069 070 071 public boolean last() throws Exception 072 { 073 checkNotClosed( "last()" ); 074 return false; 075 } 076 077 078 public boolean previous() throws Exception 079 { 080 checkNotClosed( "previous()" ); 081 return false; 082 } 083 084 085 public boolean next() throws Exception 086 { 087 checkNotClosed( "next()" ); 088 return false; 089 } 090 091 092 public IndexEntry<K, E, ID> get() throws Exception 093 { 094 checkNotClosed( "get()" ); 095 throw new InvalidCursorPositionException( I18n.err( I18n.ERR_703 ) ); 096 } 097 098 099 public boolean isElementReused() 100 { 101 return false; 102 } 103 104 105 public void afterValue( ID id, K indexValue ) throws Exception 106 { 107 checkNotClosed( "after()" ); 108 } 109 110 111 public void beforeValue( ID id, K indexValue ) throws Exception 112 { 113 checkNotClosed( "after()" ); 114 } 115 }