org.apache.directory.server.core.filtering
Class CursorList

java.lang.Object
  extended by org.apache.directory.server.core.filtering.CursorList
All Implemented Interfaces:
java.lang.Iterable<ClonedServerEntry>, EntryFilteringCursor, org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>

public class CursorList
extends java.lang.Object
implements EntryFilteringCursor

An implementation of a Cursor based on a List of Cursors. Optionally, the Cursor may be limited to a specific range within the list. This class is modeled based on the implementation of ListCursor WARN this is only used internally

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
CursorList(int start, java.util.List<EntryFilteringCursor> list, int end, SearchingOperationContext opContext)
          Creates a new ListCursor with lower (inclusive) and upper (exclusive) bounds.
CursorList(java.util.List<EntryFilteringCursor> list, SearchingOperationContext opContext)
          Creates a new ListCursor without specific bounds: the bounds are acquired from the size of the list.
 
Method Summary
 boolean addEntryFilter(EntryFilter filter)
          Adds an entry filter to this BaseEntryFilteringCursor at the very end of the filter list.
 void after(ClonedServerEntry element)
          
 void afterLast()
          
 boolean available()
          
 void before(ClonedServerEntry element)
           
 void beforeFirst()
          
 void close()
           
 void close(java.lang.Exception reason)
           
 boolean first()
          
 ClonedServerEntry get()
          
 java.util.List<EntryFilter> getEntryFilters()
          Gets an unmodifiable list of EntryFilters applied.
 SearchingOperationContext getOperationContext()
           
 boolean isAbandoned()
          Gets whether or not this BaseEntryFilteringCursor has been abandoned.
 boolean isAfterLast()
          
 boolean isBeforeFirst()
          
 boolean isClosed()
           
 boolean isElementReused()
          
 boolean isFirst()
          
 boolean isLast()
          
 java.util.Iterator<ClonedServerEntry> iterator()
           
 boolean last()
          
 boolean next()
          
 boolean previous()
          
 boolean removeEntryFilter(EntryFilter filter)
          Removes an entry filter to this BaseEntryFilteringCursor at the very end of the filter list.
 void setAbandoned(boolean abandoned)
          Sets whether this BaseEntryFilteringCursor has been abandoned.
 void setClosureMonitor(org.apache.directory.shared.ldap.cursor.ClosureMonitor monitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CursorList

public CursorList(int start,
                  java.util.List<EntryFilteringCursor> list,
                  int end,
                  SearchingOperationContext opContext)
Creates a new ListCursor with lower (inclusive) and upper (exclusive) bounds. As with all Cursors, this ListCursor requires a successful return from advance operations (next() or previous()) to properly return values using the get() operation.

Parameters:
start - the lower bound index
list - the list this ListCursor operates on
end - the upper bound index

CursorList

public CursorList(java.util.List<EntryFilteringCursor> list,
                  SearchingOperationContext opContext)
Creates a new ListCursor without specific bounds: the bounds are acquired from the size of the list.

Parameters:
list - the backing for this ListCursor
Method Detail

available

public boolean available()

Specified by:
available in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>

before

public void before(ClonedServerEntry element)
            throws java.lang.Exception
Specified by:
before in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.IllegalStateException - if the underlying list is not sorted and/or a comparator is not provided.
java.lang.Exception

after

public void after(ClonedServerEntry element)
           throws java.lang.Exception

Specified by:
after in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

beforeFirst

public void beforeFirst()
                 throws java.lang.Exception

Specified by:
beforeFirst in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

afterLast

public void afterLast()
               throws java.lang.Exception

Specified by:
afterLast in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

first

public boolean first()
              throws java.lang.Exception

Specified by:
first in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

last

public boolean last()
             throws java.lang.Exception

Specified by:
last in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

isFirst

public boolean isFirst()
                throws java.lang.Exception

Throws:
java.lang.Exception

isLast

public boolean isLast()
               throws java.lang.Exception

Throws:
java.lang.Exception

isAfterLast

public boolean isAfterLast()
                    throws java.lang.Exception

Throws:
java.lang.Exception

isBeforeFirst

public boolean isBeforeFirst()
                      throws java.lang.Exception

Throws:
java.lang.Exception

previous

public boolean previous()
                 throws java.lang.Exception

Specified by:
previous in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

next

public boolean next()
             throws java.lang.Exception

Specified by:
next in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

get

public ClonedServerEntry get()
                      throws java.lang.Exception

Specified by:
get in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

isElementReused

public boolean isElementReused()

Specified by:
isElementReused in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>

addEntryFilter

public boolean addEntryFilter(EntryFilter filter)
Description copied from interface: EntryFilteringCursor
Adds an entry filter to this BaseEntryFilteringCursor at the very end of the filter list. EntryFilters are applied in the order of addition.

Specified by:
addEntryFilter in interface EntryFilteringCursor
Parameters:
filter - a filter to apply to the entries
Returns:
the result of List.add(Object)

getEntryFilters

public java.util.List<EntryFilter> getEntryFilters()
Description copied from interface: EntryFilteringCursor
Gets an unmodifiable list of EntryFilters applied.

Specified by:
getEntryFilters in interface EntryFilteringCursor
Returns:
an unmodifiable list of EntryFilters applied

getOperationContext

public SearchingOperationContext getOperationContext()
Specified by:
getOperationContext in interface EntryFilteringCursor
Returns:
the operationContext

isAbandoned

public boolean isAbandoned()
Description copied from interface: EntryFilteringCursor
Gets whether or not this BaseEntryFilteringCursor has been abandoned.

Specified by:
isAbandoned in interface EntryFilteringCursor
Returns:
true if abandoned, false if not

removeEntryFilter

public boolean removeEntryFilter(EntryFilter filter)
Description copied from interface: EntryFilteringCursor
Removes an entry filter to this BaseEntryFilteringCursor at the very end of the filter list.

Specified by:
removeEntryFilter in interface EntryFilteringCursor
Parameters:
filter - a filter to remove from the filter list
Returns:
the result of List.remove(Object)

setAbandoned

public void setAbandoned(boolean abandoned)
Description copied from interface: EntryFilteringCursor
Sets whether this BaseEntryFilteringCursor has been abandoned.

Specified by:
setAbandoned in interface EntryFilteringCursor
Parameters:
abandoned - true if abandoned, false if not

close

public void close()
           throws java.lang.Exception
Specified by:
close in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

close

public void close(java.lang.Exception reason)
           throws java.lang.Exception
Specified by:
close in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

isClosed

public boolean isClosed()
                 throws java.lang.Exception
Specified by:
isClosed in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>
Throws:
java.lang.Exception

iterator

public java.util.Iterator<ClonedServerEntry> iterator()
Specified by:
iterator in interface java.lang.Iterable<ClonedServerEntry>

setClosureMonitor

public void setClosureMonitor(org.apache.directory.shared.ldap.cursor.ClosureMonitor monitor)
Specified by:
setClosureMonitor in interface org.apache.directory.shared.ldap.cursor.Cursor<ClonedServerEntry>


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.