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

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

public class BaseEntryFilteringCursor
extends java.lang.Object
implements EntryFilteringCursor

A Cursor which uses a list of filters to selectively return entries and/or modify the contents of entries. Uses lazy pre-fetching on positioning operations which means adding filters after creation will not miss candidate entries.

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

Constructor Summary
BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped, SearchingOperationContext operationContext)
          Creates a new entry filtering Cursor over an existing Cursor using a no filter initially: more can be added later after creation.
BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped, SearchingOperationContext operationContext, EntryFilter filter)
          Creates a new entry filtering Cursor over an existing Cursor using a single filter initially: more can be added later after creation.
BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped, SearchingOperationContext operationContext, java.util.List<EntryFilter> filters)
          Creates a new entry filtering Cursor over an existing Cursor using a list of filters initially: more can be added later after creation.
 
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 isClosed()
           
 boolean isElementReused()
           
 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

BaseEntryFilteringCursor

public BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped,
                                SearchingOperationContext operationContext,
                                EntryFilter filter)
Creates a new entry filtering Cursor over an existing Cursor using a single filter initially: more can be added later after creation.

Parameters:
wrapped - the underlying wrapped Cursor whose entries are filtered
searchControls - the controls of search that created this Cursor
invocation - the search operation invocation creating this Cursor
filter - a single filter to be used

BaseEntryFilteringCursor

public BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped,
                                SearchingOperationContext operationContext)
Creates a new entry filtering Cursor over an existing Cursor using a no filter initially: more can be added later after creation.

Parameters:
wrapped - the underlying wrapped Cursor whose entries are filtered
searchControls - the controls of search that created this Cursor
invocation - the search operation invocation creating this Cursor
filter - a single filter to be used

BaseEntryFilteringCursor

public BaseEntryFilteringCursor(org.apache.directory.shared.ldap.cursor.Cursor<org.apache.directory.shared.ldap.entry.ServerEntry> wrapped,
                                SearchingOperationContext operationContext,
                                java.util.List<EntryFilter> filters)
Creates a new entry filtering Cursor over an existing Cursor using a list of filters initially: more can be added later after creation.

Parameters:
wrapped - the underlying wrapped Cursor whose entries are filtered
operationContext - the operation context that created this Cursor
invocation - the search operation invocation creating this Cursor
filters - a list of filters to be used
Method Detail

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

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

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)

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)

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

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

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

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.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

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

setClosureMonitor

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

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

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

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

isElementReused

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

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

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

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

iterator

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


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