You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/08/05 19:40:51 UTC

svn commit: r801332 [1/5] - in /directory/shared/trunk: cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ cursor/src/test/java/org/apache/directory/shared/ldap/cursor/ ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/ ldap/src/...

Author: elecharny
Date: Wed Aug  5 17:40:50 2009
New Revision: 801332

URL: http://svn.apache.org/viewvc?rev=801332&view=rev
Log:
Removed ^M in files

Modified:
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/AbstractCursor.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/Cursor.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorClosedException.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorStateEnum.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/EmptyCursor.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InconsistentCursorStateException.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InvalidCursorPositionException.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java
    directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/SingletonCursor.java
    directory/shared/trunk/cursor/src/test/java/org/apache/directory/shared/ldap/cursor/ListCursorTest.java
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/UniversalContextFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientEntryFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/ImmutableAttributeWrapper.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/ImmutableAttributesWrapper.java

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/AbstractCursor.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/AbstractCursor.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/AbstractCursor.java Wed Aug  5 17:40:50 2009
@@ -1,96 +1,96 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-import java.util.Iterator;
-
-
-/**
- * Simple class that contains often used Cursor code.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public abstract class AbstractCursor<E> implements Cursor<E>
-{
-    /** The default associated monitor */
-    private ClosureMonitor monitor = new DefaultClosureMonitor();
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void setClosureMonitor( ClosureMonitor monitor )
-    {
-        if ( monitor == null )
-        {
-            throw new NullPointerException( "monitor" );
-        }
-        
-        this.monitor = monitor;
-    }
-    
-
-    /**
-     * Check that the cursor is not closed.
-     * 
-     * @param operation
-     * @throws Exception
-     */
-    protected final void checkNotClosed( String operation ) throws Exception
-    {
-        monitor.checkNotClosed();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final boolean isClosed()
-    {
-        return monitor.isClosed();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close( Exception cause ) throws Exception
-    {
-        monitor.close( cause );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close() throws Exception
-    {
-        monitor.close();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Iterator<E> iterator()
-    {
-        return new CursorIterator<E>( this );
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+import java.util.Iterator;
+
+
+/**
+ * Simple class that contains often used Cursor code.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractCursor<E> implements Cursor<E>
+{
+    /** The default associated monitor */
+    private ClosureMonitor monitor = new DefaultClosureMonitor();
+
+    /**
+     * {@inheritDoc}
+     */
+    public final void setClosureMonitor( ClosureMonitor monitor )
+    {
+        if ( monitor == null )
+        {
+            throw new NullPointerException( "monitor" );
+        }
+        
+        this.monitor = monitor;
+    }
+    
+
+    /**
+     * Check that the cursor is not closed.
+     * 
+     * @param operation
+     * @throws Exception
+     */
+    protected final void checkNotClosed( String operation ) throws Exception
+    {
+        monitor.checkNotClosed();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public final boolean isClosed()
+    {
+        return monitor.isClosed();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close( Exception cause ) throws Exception
+    {
+        monitor.close( cause );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws Exception
+    {
+        monitor.close();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<E> iterator()
+    {
+        return new CursorIterator<E>( this );
+    }
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/Cursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/Cursor.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/Cursor.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/Cursor.java Wed Aug  5 17:40:50 2009
@@ -1,226 +1,226 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-
-/**
- * A Cursor for bidirectional traversal over elements in a dataSet. Cursors
- * unlike Iterators or Enumerations may advance to an element by calling
- * next() or previous() which returns true or false if the request succeeds
- * with a viable element at the new position.  Operations for relative
- * positioning in larger increments are provided.  If the cursor can not
- * advance, then the Cursor is either positioned before the first element or
- * after the last element in which case the user of the Cursor must stop
- * advancing in the respective direction.  If an advance succeeds a get()
- * operation retrieves the current object at the Cursors position.
- *
- * Although this interface presumes Cursors can advance bidirectionally,
- * implementations may restrict this by throwing
- * UnsupportedOperationExceptions.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public interface Cursor<E> extends Iterable<E>
-{
-    /**
-     * Determines whether or not a call to get() will succeed.
-     *
-     * @return true if the cursor is valid get() will succeed, false otherwise
-     */
-    boolean available();
-
-    /**
-     * Prepares this Cursor, so a subsequent call to Cursor#next() with a
-     * true return value, will have positioned the Cursor on a dataSet 
-     * element equal to or less than the element argument but not greater.  
-     * A call to Cursor#previous() with a true return value will position 
-     * the Cursor on a dataSet element less than the argument.  If 
-     * Cursor#next() returns false then the Cursor is past the last element 
-     * and so all values in the dataSet are less than the argument.  If 
-     * Cursor#previous() returns false then the Cursor is positioned before 
-     * the first element and all elements in the dataSet are greater than 
-     * the argument.
-     *
-     * @param element the element to be positioned before
-     * @throws Exception with problems accessing the underlying btree
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    void before( E element ) throws Exception;
-
-
-    /**
-     * Prepares this Cursor, so a subsequent call to Cursor#previous() with a
-     * true return value, will have positioned the Cursor on a dataSet element
-     * equal to or less than the element argument but not greater. A call to
-     * Cursor#next() with a true return value will position the Cursor on a
-     * dataSet element greater than the argument.  If Cursor#next() returns
-     * false then the Cursor is past the last element and so all values in the
-     * dataSet are less than or equal to the argument.  If Cursor#previous()
-     * returns false then the Cursor is positioned before the first element
-     * and all elements in the dataSet are greater than the argument.
-     *
-     * @param element the element to be positioned after
-     * @throws Exception if there are problems positioning this cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    void after( E element ) throws Exception;
-
-
-    /**
-     * Positions this Cursor before the first element.
-     *
-     * @throws Exception if there are problems positioning this cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    void beforeFirst() throws Exception;
-
-
-    /**
-     * Positions this Cursor after the last element.
-     *
-     * @throws Exception if there are problems positioning this Cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    void afterLast() throws Exception;
-
-
-    /**
-     * Positions this Cursor at the first element.
-     *
-     * @return true if the position has been successfully changed to the first
-     * element, false otherwise
-     * @throws Exception if there are problems positioning this Cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    boolean first() throws Exception;
-
-
-    /**
-     * Positions this Cursor at the last element.
-     *
-     * @return true if the position has been successfully changed to the last
-     * element, false otherwise
-     * @throws Exception if there are problems positioning this Cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    boolean last() throws Exception;
-
-
-    /**
-     * Checks if this Cursor is closed.  Calls to this operation should not
-     * fail with exceptions if and only if the cursor is in the closed state.
-     *
-     * @return true if this Cursor is closed, false otherwise
-     * @throws Exception if there are problems determining the cursor's closed state
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    boolean isClosed() throws Exception;
-
-
-    /**
-     * Advances this Cursor to the previous position.  If called before
-     * explicitly positioning this Cursor, the position is presumed to be
-     * after the last element and this method moves the cursor back to the
-     * last element.
-     *
-     * @return true if the advance succeeded, false otherwise
-     * @throws Exception if there are problems advancing to the next position
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    boolean previous() throws Exception;
-
-
-    /**
-     * Advances this Cursor to the next position.  If called before
-     * explicitly positioning this Cursor, the position is presumed to be
-     * before the first element and this method moves the cursor forward to
-     * the first element.
-     *
-     * @return true if the advance succeeded, false otherwise
-     * @throws Exception if there are problems advancing to this Cursor to
-     * the next position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if this method is not supported
-     */
-    boolean next() throws Exception;
-
-
-    /**
-     * Gets the object at the current position.  Cursor implementations may
-     * choose to reuse element objects by re-populating them on advances
-     * instead of creating new objects on each advance.
-     *
-     * @return the object at the current position
-     * @throws Exception if the object at this Cursor's current position
-     * cannot be retrieved, or if this Cursor is closed
-     */
-    E get() throws Exception;
-
-
-    /**
-     * Gets whether or not this Cursor will return the same element object
-     * instance on get() operations for any position of this Cursor.  Some
-     * Cursor implementations may reuse the same element copying values into
-     * it for every position rather than creating and emit new element
-     * objects on each advance.  Some Cursor implementations may return
-     * different elements for each position yet the same element instance
-     * is returned for the same position. In these cases this method should
-     * return true.
-     *
-     * @return true if elements are reused by this Cursor
-     */
-    boolean isElementReused();
-
-
-    /**
-     * Closes this Cursor and frees any resources it my have allocated.
-     * Repeated calls to this method after this Cursor has already been
-     * called should not fail with exceptions.
-     *
-     * @throws Exception if for some reason this Cursor could not be closed
-     */
-    void close() throws Exception;
-
-
-    /**
-     * Closes this Cursor and frees any resources it my have allocated.
-     * Repeated calls to this method after this Cursor has already been
-     * called should not fail with exceptions.  The reason argument is 
-     * the Exception instance thrown instead of the standard 
-     * CursorClosedException.
-     *
-     * @param reason exception thrown when this Cursor is accessed after close
-     * @throws Exception if for some reason this Cursor could not be closed
-     */
-    void close( Exception reason ) throws Exception;
-    
-    
-    /**
-     * Sets a non-null closure monitor to associate with this Cursor.
-     *
-     * @param monitor the monitor to use for detecting Cursor close events
-     */
-    void setClosureMonitor( ClosureMonitor monitor );
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+
+/**
+ * A Cursor for bidirectional traversal over elements in a dataSet. Cursors
+ * unlike Iterators or Enumerations may advance to an element by calling
+ * next() or previous() which returns true or false if the request succeeds
+ * with a viable element at the new position.  Operations for relative
+ * positioning in larger increments are provided.  If the cursor can not
+ * advance, then the Cursor is either positioned before the first element or
+ * after the last element in which case the user of the Cursor must stop
+ * advancing in the respective direction.  If an advance succeeds a get()
+ * operation retrieves the current object at the Cursors position.
+ *
+ * Although this interface presumes Cursors can advance bidirectionally,
+ * implementations may restrict this by throwing
+ * UnsupportedOperationExceptions.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface Cursor<E> extends Iterable<E>
+{
+    /**
+     * Determines whether or not a call to get() will succeed.
+     *
+     * @return true if the cursor is valid get() will succeed, false otherwise
+     */
+    boolean available();
+
+    /**
+     * Prepares this Cursor, so a subsequent call to Cursor#next() with a
+     * true return value, will have positioned the Cursor on a dataSet 
+     * element equal to or less than the element argument but not greater.  
+     * A call to Cursor#previous() with a true return value will position 
+     * the Cursor on a dataSet element less than the argument.  If 
+     * Cursor#next() returns false then the Cursor is past the last element 
+     * and so all values in the dataSet are less than the argument.  If 
+     * Cursor#previous() returns false then the Cursor is positioned before 
+     * the first element and all elements in the dataSet are greater than 
+     * the argument.
+     *
+     * @param element the element to be positioned before
+     * @throws Exception with problems accessing the underlying btree
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    void before( E element ) throws Exception;
+
+
+    /**
+     * Prepares this Cursor, so a subsequent call to Cursor#previous() with a
+     * true return value, will have positioned the Cursor on a dataSet element
+     * equal to or less than the element argument but not greater. A call to
+     * Cursor#next() with a true return value will position the Cursor on a
+     * dataSet element greater than the argument.  If Cursor#next() returns
+     * false then the Cursor is past the last element and so all values in the
+     * dataSet are less than or equal to the argument.  If Cursor#previous()
+     * returns false then the Cursor is positioned before the first element
+     * and all elements in the dataSet are greater than the argument.
+     *
+     * @param element the element to be positioned after
+     * @throws Exception if there are problems positioning this cursor or if
+     * this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    void after( E element ) throws Exception;
+
+
+    /**
+     * Positions this Cursor before the first element.
+     *
+     * @throws Exception if there are problems positioning this cursor or if
+     * this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    void beforeFirst() throws Exception;
+
+
+    /**
+     * Positions this Cursor after the last element.
+     *
+     * @throws Exception if there are problems positioning this Cursor or if
+     * this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    void afterLast() throws Exception;
+
+
+    /**
+     * Positions this Cursor at the first element.
+     *
+     * @return true if the position has been successfully changed to the first
+     * element, false otherwise
+     * @throws Exception if there are problems positioning this Cursor or if
+     * this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    boolean first() throws Exception;
+
+
+    /**
+     * Positions this Cursor at the last element.
+     *
+     * @return true if the position has been successfully changed to the last
+     * element, false otherwise
+     * @throws Exception if there are problems positioning this Cursor or if
+     * this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    boolean last() throws Exception;
+
+
+    /**
+     * Checks if this Cursor is closed.  Calls to this operation should not
+     * fail with exceptions if and only if the cursor is in the closed state.
+     *
+     * @return true if this Cursor is closed, false otherwise
+     * @throws Exception if there are problems determining the cursor's closed state
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    boolean isClosed() throws Exception;
+
+
+    /**
+     * Advances this Cursor to the previous position.  If called before
+     * explicitly positioning this Cursor, the position is presumed to be
+     * after the last element and this method moves the cursor back to the
+     * last element.
+     *
+     * @return true if the advance succeeded, false otherwise
+     * @throws Exception if there are problems advancing to the next position
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    boolean previous() throws Exception;
+
+
+    /**
+     * Advances this Cursor to the next position.  If called before
+     * explicitly positioning this Cursor, the position is presumed to be
+     * before the first element and this method moves the cursor forward to
+     * the first element.
+     *
+     * @return true if the advance succeeded, false otherwise
+     * @throws Exception if there are problems advancing to this Cursor to
+     * the next position, or if this Cursor is closed
+     * @throws UnsupportedOperationException if this method is not supported
+     */
+    boolean next() throws Exception;
+
+
+    /**
+     * Gets the object at the current position.  Cursor implementations may
+     * choose to reuse element objects by re-populating them on advances
+     * instead of creating new objects on each advance.
+     *
+     * @return the object at the current position
+     * @throws Exception if the object at this Cursor's current position
+     * cannot be retrieved, or if this Cursor is closed
+     */
+    E get() throws Exception;
+
+
+    /**
+     * Gets whether or not this Cursor will return the same element object
+     * instance on get() operations for any position of this Cursor.  Some
+     * Cursor implementations may reuse the same element copying values into
+     * it for every position rather than creating and emit new element
+     * objects on each advance.  Some Cursor implementations may return
+     * different elements for each position yet the same element instance
+     * is returned for the same position. In these cases this method should
+     * return true.
+     *
+     * @return true if elements are reused by this Cursor
+     */
+    boolean isElementReused();
+
+
+    /**
+     * Closes this Cursor and frees any resources it my have allocated.
+     * Repeated calls to this method after this Cursor has already been
+     * called should not fail with exceptions.
+     *
+     * @throws Exception if for some reason this Cursor could not be closed
+     */
+    void close() throws Exception;
+
+
+    /**
+     * Closes this Cursor and frees any resources it my have allocated.
+     * Repeated calls to this method after this Cursor has already been
+     * called should not fail with exceptions.  The reason argument is 
+     * the Exception instance thrown instead of the standard 
+     * CursorClosedException.
+     *
+     * @param reason exception thrown when this Cursor is accessed after close
+     * @throws Exception if for some reason this Cursor could not be closed
+     */
+    void close( Exception reason ) throws Exception;
+    
+    
+    /**
+     * Sets a non-null closure monitor to associate with this Cursor.
+     *
+     * @param monitor the monitor to use for detecting Cursor close events
+     */
+    void setClosureMonitor( ClosureMonitor monitor );
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorClosedException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorClosedException.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorClosedException.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorClosedException.java Wed Aug  5 17:40:50 2009
@@ -1,43 +1,43 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-/**
- * A specific form of IOException to note that an operation is being
- * attempted on a closed Cursor.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class CursorClosedException extends Exception
-{
-    private static final long serialVersionUID = -5723233489761854394L;
-
-
-    public CursorClosedException()
-    {
-    }
-
-
-    public CursorClosedException( String s )
-    {
-        super( s );
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+/**
+ * A specific form of IOException to note that an operation is being
+ * attempted on a closed Cursor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CursorClosedException extends Exception
+{
+    private static final long serialVersionUID = -5723233489761854394L;
+
+
+    public CursorClosedException()
+    {
+    }
+
+
+    public CursorClosedException( String s )
+    {
+        super( s );
+    }
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorStateEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorStateEnum.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorStateEnum.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/CursorStateEnum.java Wed Aug  5 17:40:50 2009
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-/**
- * An enumeration to represent the various states of a Cursor.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public enum CursorStateEnum
-{
-    /** the Cursor has been created and so has not been positioned yet */
-    JUST_OPENED,
-    
-    /** the Cursor is positioned just before the first element */
-    BEFORE_FIRST,
-    
-    /** the Cursor is positioned just after the last element */
-    AFTER_LAST,
-    
-    /** the Cursor is positioned just before an element but not on any element */
-    BEFORE_INNER,
-    
-    /** the Cursor is positioned just after an element but not on any element */
-    AFTER_INNER,
-    
-    /** the Cursor is positioned on the first element */
-    ON_FIRST,
-    
-    /** the Cursor is positioned on the last element */
-    ON_LAST,
-    
-    /** the Cursor is positioned on an element */
-    ON_INNER,
-    
-    /** the Cursor is closed and not operations can be performed on it */
-    CLOSED
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+/**
+ * An enumeration to represent the various states of a Cursor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum CursorStateEnum
+{
+    /** the Cursor has been created and so has not been positioned yet */
+    JUST_OPENED,
+    
+    /** the Cursor is positioned just before the first element */
+    BEFORE_FIRST,
+    
+    /** the Cursor is positioned just after the last element */
+    AFTER_LAST,
+    
+    /** the Cursor is positioned just before an element but not on any element */
+    BEFORE_INNER,
+    
+    /** the Cursor is positioned just after an element but not on any element */
+    AFTER_INNER,
+    
+    /** the Cursor is positioned on the first element */
+    ON_FIRST,
+    
+    /** the Cursor is positioned on the last element */
+    ON_LAST,
+    
+    /** the Cursor is positioned on an element */
+    ON_INNER,
+    
+    /** the Cursor is closed and not operations can be performed on it */
+    CLOSED
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/EmptyCursor.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/EmptyCursor.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/EmptyCursor.java Wed Aug  5 17:40:50 2009
@@ -1,131 +1,131 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-/**
- * An empty Cursor implementation.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class EmptyCursor<E> extends AbstractCursor<E>
-{
-    /**
-     * {@inheritDoc}
-     */
-    public boolean available()
-    {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void before( E element ) throws Exception
-    {
-        checkNotClosed( "before()" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void after( E element ) throws Exception
-    {
-        checkNotClosed( "after()" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void beforeFirst() throws Exception
-    {
-        checkNotClosed( "beforeFirst()" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void afterLast() throws Exception
-    {
-        checkNotClosed( "afterLast()" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean first() throws Exception
-    {
-        checkNotClosed( "first()" );
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean last() throws Exception
-    {
-        checkNotClosed( "last()" );
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean previous() throws Exception
-    {
-        checkNotClosed( "previous()" );
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean next() throws Exception
-    {
-        checkNotClosed( "next()" );
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public E get() throws Exception
-    {
-        checkNotClosed( "get()" );
-        throw new InvalidCursorPositionException( "This cursor is empty and cannot return elements!" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isElementReused()
-    {
-        return false;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+/**
+ * An empty Cursor implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EmptyCursor<E> extends AbstractCursor<E>
+{
+    /**
+     * {@inheritDoc}
+     */
+    public boolean available()
+    {
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void before( E element ) throws Exception
+    {
+        checkNotClosed( "before()" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void after( E element ) throws Exception
+    {
+        checkNotClosed( "after()" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void beforeFirst() throws Exception
+    {
+        checkNotClosed( "beforeFirst()" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void afterLast() throws Exception
+    {
+        checkNotClosed( "afterLast()" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean first() throws Exception
+    {
+        checkNotClosed( "first()" );
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean last() throws Exception
+    {
+        checkNotClosed( "last()" );
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean previous() throws Exception
+    {
+        checkNotClosed( "previous()" );
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean next() throws Exception
+    {
+        checkNotClosed( "next()" );
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public E get() throws Exception
+    {
+        checkNotClosed( "get()" );
+        throw new InvalidCursorPositionException( "This cursor is empty and cannot return elements!" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isElementReused()
+    {
+        return false;
+    }
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InconsistentCursorStateException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InconsistentCursorStateException.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InconsistentCursorStateException.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InconsistentCursorStateException.java Wed Aug  5 17:40:50 2009
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-/**
- * Thrown to indicate a condition in the Cursor where the state seems
- * inconsistent based on internal accounting.  This may indicate the
- * underlying structure has changed after the Cursor has been created.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class InconsistentCursorStateException extends Exception
-{
-    private static final long serialVersionUID = 6222645005251534704L;
-
-
-    public InconsistentCursorStateException()
-    {
-    }
-
-
-    public InconsistentCursorStateException( String s )
-    {
-        super( s );
-    }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+/**
+ * Thrown to indicate a condition in the Cursor where the state seems
+ * inconsistent based on internal accounting.  This may indicate the
+ * underlying structure has changed after the Cursor has been created.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InconsistentCursorStateException extends Exception
+{
+    private static final long serialVersionUID = 6222645005251534704L;
+
+
+    public InconsistentCursorStateException()
+    {
+    }
+
+
+    public InconsistentCursorStateException( String s )
+    {
+        super( s );
+    }
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InvalidCursorPositionException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InvalidCursorPositionException.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InvalidCursorPositionException.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/InvalidCursorPositionException.java Wed Aug  5 17:40:50 2009
@@ -1,43 +1,43 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-/**
- * Thrown to indicate an illegal position state for a Cursor when a call to
- * get is made.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class InvalidCursorPositionException extends Exception
-{
-    private static final long serialVersionUID = 5730037129071653272L;
-
-
-    public InvalidCursorPositionException ()
-    {
-    }
-
-
-    public InvalidCursorPositionException ( String s )
-    {
-        super( s );
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+/**
+ * Thrown to indicate an illegal position state for a Cursor when a call to
+ * get is made.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InvalidCursorPositionException extends Exception
+{
+    private static final long serialVersionUID = 5730037129071653272L;
+
+
+    public InvalidCursorPositionException ()
+    {
+    }
+
+
+    public InvalidCursorPositionException ( String s )
+    {
+        super( s );
+    }
+}

Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java?rev=801332&r1=801331&r2=801332&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java Wed Aug  5 17:40:50 2009
@@ -1,494 +1,494 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.directory.shared.ldap.cursor;
-
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Comparator;
-
-
-/**
- * A simple implementation of a Cursor on a {@link List}.  Optionally, the
- * Cursor may be limited to a specific range within the list.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class ListCursor<E> extends AbstractCursor<E>
-{
-    /** The inner List */
-    private final List<E> list;
-    
-    /** The associated comparator */
-    private final Comparator<E> comparator;
-    
-    /** The starting position for the cursor in the list. It can be > 0 */
-    private final int start;
-    
-    /** The ending position for the cursor in the list. It can be < List.size() */
-    private final int end;
-    
-    /** The current position in the list */
-    private int index = -1;
-
-
-    /**
-     * 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.
-     *
-     * @param comparator an optional comparator to use for ordering
-     * @param start the lower bound index
-     * @param list the list this ListCursor operates on
-     * @param end the upper bound index
-     */
-    public ListCursor( Comparator<E> comparator, int start, List<E> list, int end )
-    {
-        if ( ( start < 0  )|| ( start > list.size() ) )
-        {
-            throw new IllegalArgumentException( "start index '" + start + "' out of range" );
-        }
-
-        if ( ( end < 0 ) || ( end > list.size() ) )
-        {
-            throw new IllegalArgumentException( "end index '" + end + "' out of range" );
-        }
-
-        // check list is not empty list since the empty list is the only situation
-        // where we allow for start to equal the end: in other cases it makes no sense
-        if ( ( list.size() > 0 ) && ( start >= end ) )
-        {
-            throw new IllegalArgumentException( "start index '" + start + "' greater than or equal to end index '"
-                    + end + "' just does not make sense" );
-        }
-
-        this.comparator = comparator;
-
-        if ( list != null )
-        {
-            this.list = list;
-        }
-        else
-        {
-            this.list = Collections.emptyList();
-        }
-
-        this.start = start;
-        this.end = end;
-    }
-
-
-    /**
-     * 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.
-     *
-     * @param start the lower bound index
-     * @param list the list this ListCursor operates on
-     * @param end the upper bound index
-     */
-    public ListCursor( int start, List<E> list, int end )
-    {
-        this( null, start, list, end );
-    }
-
-
-    /**
-     * Creates a new ListCursor with a specific upper (exclusive) bound: the
-     * lower (inclusive) bound defaults to 0.
-     *
-     * @param list the backing for this ListCursor
-     * @param end the upper bound index representing the position after the
-     * last element
-     */
-    public ListCursor( List<E> list, int end )
-    {
-        this( null, 0, list, end );
-    }
-
-
-    /**
-     * Creates a new ListCursor with a specific upper (exclusive) bound: the
-     * lower (inclusive) bound defaults to 0. We also provide a comparator.
-     *
-     * @param comparator The comparator to use for the <E> elements
-     * @param list the backing for this ListCursor
-     * @param end the upper bound index representing the position after the
-     * last element
-     */
-    public ListCursor( Comparator<E> comparator, List<E> list, int end )
-    {
-        this( comparator, 0, list, end );
-    }
-
-
-    /**
-     * Creates a new ListCursor with a lower (inclusive) bound: the upper
-     * (exclusive) bound is the size of the list.
-     *
-     * @param start the lower (inclusive) bound index: the position of the
-     * first entry
-     * @param list the backing for this ListCursor
-     */
-    public ListCursor( int start, List<E> list )
-    {
-        this( null, start, list, list.size() );
-    }
-
-
-    /**
-     * Creates a new ListCursor with a lower (inclusive) bound: the upper
-     * (exclusive) bound is the size of the list. We also provide a comparator.
-     *
-     * @param comparator The comparator to use for the <E> elements
-     * @param start the lower (inclusive) bound index: the position of the
-     * first entry
-     * @param list the backing for this ListCursor
-     */
-    public ListCursor( Comparator<E> comparator, int start, List<E> list )
-    {
-        this( comparator, start, list, list.size() );
-    }
-
-
-    /**
-     * Creates a new ListCursor without specific bounds: the bounds are
-     * acquired from the size of the list.
-     *
-     * @param list the backing for this ListCursor
-     */
-    public ListCursor( List<E> list )
-    {
-        this( null, 0, list, list.size() );
-    }
-
-
-    /**
-     * Creates a new ListCursor without specific bounds: the bounds are
-     * acquired from the size of the list. We also provide a comparator.
-     *
-     * @param comparator The comparator to use for the <E> elements
-     * @param list the backing for this ListCursor
-     */
-    public ListCursor( Comparator<E> comparator, List<E> list )
-    {
-        this( comparator, 0, list, list.size() );
-    }
-
-
-    /**
-     * Creates a new ListCursor without any elements.
-     */
-    @SuppressWarnings("unchecked")
-    public ListCursor()
-    {
-        this( null, 0, Collections.EMPTY_LIST, 0 );
-    }
-
-
-    /**
-     * Creates a new ListCursor without any elements. We also provide 
-     * a comparator.
-     * 
-     * @param comparator The comparator to use for the <E> elements
-     */
-    @SuppressWarnings("unchecked")
-    public ListCursor( Comparator<E> comparator )
-    {
-        this( comparator, 0, Collections.EMPTY_LIST, 0 );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean available()
-    {
-        return index >= 0 && index < end;
-    }
-
-
-    /**
-     * @throws IllegalStateException if the underlying list is not sorted
-     * and/or a comparator is not provided.
-     */
-    public void before( E element ) throws Exception
-    {
-        checkNotClosed( "before()" );
-
-        if ( comparator == null )
-        {
-            throw new IllegalStateException();
-        }
-
-        // handle some special cases
-        if ( list.size() == 0 )
-        {
-            return;
-        }
-        else if ( list.size() == 1 )
-        {
-            if ( comparator.compare( element, list.get( 0 ) ) <= 0 )
-            {
-                beforeFirst();
-            }
-            else
-            {
-                afterLast();
-            }
-        }
-
-        // TODO might want to add some code here to utilize the comparator
-        throw new UnsupportedOperationException( "don't know if list is sorted and checking that is not worth it" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void after( E element ) throws Exception
-    {
-        checkNotClosed( "after()" );
-
-        if ( comparator == null )
-        {
-            throw new IllegalStateException();
-        }
-
-        // handle some special cases
-        if ( list.size() == 0 )
-        {
-            return;
-        }
-        else if ( list.size() == 1 )
-        {
-            if ( comparator.compare( element, list.get( 0 ) ) >= 0 )
-            {
-                afterLast();
-            }
-            else
-            {
-                beforeFirst();
-            }
-        }
-
-        // TODO might want to add some code here to utilize the comparator
-        throw new UnsupportedOperationException( "don't know if list is sorted and checking that is not worth it" );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void beforeFirst() throws Exception
-    {
-        checkNotClosed( "beforeFirst()" );
-        this.index = -1;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void afterLast() throws Exception
-    {
-        checkNotClosed( "afterLast()" );
-        this.index = end;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean first() throws Exception
-    {
-        checkNotClosed( "first()" );
-
-        if ( list.size() > 0 )
-        {
-            index = start;
-            return true;
-        }
-
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean last() throws Exception
-    {
-        checkNotClosed( "last()" );
-
-        if ( list.size() > 0 )
-        {
-            index = end - 1;
-            return true;
-        }
-        
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isFirst() throws Exception
-    {
-        checkNotClosed( "isFirst()" );
-        return list.size() > 0 && index == start;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isLast() throws Exception
-    {
-        checkNotClosed( "isLast()" );
-        return list.size() > 0 && index == end - 1;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isAfterLast() throws Exception
-    {
-        checkNotClosed( "isAfterLast()" );
-        return index == end;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isBeforeFirst() throws Exception
-    {
-        checkNotClosed( "isBeforeFirst()" );
-        return index == -1;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean previous() throws Exception
-    {
-        checkNotClosed( "previous()" );
-
-        // if parked at -1 we cannot go backwards
-        if ( index == -1 )
-        {
-            return false;
-        }
-
-        // if the index moved back is still greater than or eq to start then OK
-        if ( index - 1 >= start )
-        {
-            index--;
-            return true;
-        }
-
-        // if the index currently less than or equal to start we need to park it at -1 and return false
-        if ( index <= start )
-        {
-            index = -1;
-            return false;
-        }
-
-        if ( list.size() <= 0 )
-        {
-            index = -1;
-        }
-
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean next() throws Exception
-    {
-        checkNotClosed( "next()" );
-
-        // if parked at -1 we advance to the start index and return true
-        if ( list.size() > 0 && index == -1 )
-        {
-            index = start;
-            return true;
-        }
-
-        // if the index plus one is less than the end then increment and return true
-        if ( list.size() > 0 && index + 1 < end )
-        {
-            index++;
-            return true;
-        }
-
-        // if the index plus one is equal to the end then increment and return false
-        if ( list.size() > 0 && index + 1 == end )
-        {
-            index++;
-            return false;
-        }
-
-        if ( list.size() <= 0 )
-        {
-            index = end;
-        }
-
-        return false;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public E get() throws Exception
-    {
-        checkNotClosed( "get()" );
-        
-        if ( index < start || index >= end )
-        {
-            throw new IOException( "Cursor not positioned at an element" );
-        }
-
-        return list.get( index );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isElementReused()
-    {
-        return true;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.shared.ldap.cursor;
+
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Comparator;
+
+
+/**
+ * A simple implementation of a Cursor on a {@link List}.  Optionally, the
+ * Cursor may be limited to a specific range within the list.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ListCursor<E> extends AbstractCursor<E>
+{
+    /** The inner List */
+    private final List<E> list;
+    
+    /** The associated comparator */
+    private final Comparator<E> comparator;
+    
+    /** The starting position for the cursor in the list. It can be > 0 */
+    private final int start;
+    
+    /** The ending position for the cursor in the list. It can be < List.size() */
+    private final int end;
+    
+    /** The current position in the list */
+    private int index = -1;
+
+
+    /**
+     * 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.
+     *
+     * @param comparator an optional comparator to use for ordering
+     * @param start the lower bound index
+     * @param list the list this ListCursor operates on
+     * @param end the upper bound index
+     */
+    public ListCursor( Comparator<E> comparator, int start, List<E> list, int end )
+    {
+        if ( ( start < 0  )|| ( start > list.size() ) )
+        {
+            throw new IllegalArgumentException( "start index '" + start + "' out of range" );
+        }
+
+        if ( ( end < 0 ) || ( end > list.size() ) )
+        {
+            throw new IllegalArgumentException( "end index '" + end + "' out of range" );
+        }
+
+        // check list is not empty list since the empty list is the only situation
+        // where we allow for start to equal the end: in other cases it makes no sense
+        if ( ( list.size() > 0 ) && ( start >= end ) )
+        {
+            throw new IllegalArgumentException( "start index '" + start + "' greater than or equal to end index '"
+                    + end + "' just does not make sense" );
+        }
+
+        this.comparator = comparator;
+
+        if ( list != null )
+        {
+            this.list = list;
+        }
+        else
+        {
+            this.list = Collections.emptyList();
+        }
+
+        this.start = start;
+        this.end = end;
+    }
+
+
+    /**
+     * 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.
+     *
+     * @param start the lower bound index
+     * @param list the list this ListCursor operates on
+     * @param end the upper bound index
+     */
+    public ListCursor( int start, List<E> list, int end )
+    {
+        this( null, start, list, end );
+    }
+
+
+    /**
+     * Creates a new ListCursor with a specific upper (exclusive) bound: the
+     * lower (inclusive) bound defaults to 0.
+     *
+     * @param list the backing for this ListCursor
+     * @param end the upper bound index representing the position after the
+     * last element
+     */
+    public ListCursor( List<E> list, int end )
+    {
+        this( null, 0, list, end );
+    }
+
+
+    /**
+     * Creates a new ListCursor with a specific upper (exclusive) bound: the
+     * lower (inclusive) bound defaults to 0. We also provide a comparator.
+     *
+     * @param comparator The comparator to use for the <E> elements
+     * @param list the backing for this ListCursor
+     * @param end the upper bound index representing the position after the
+     * last element
+     */
+    public ListCursor( Comparator<E> comparator, List<E> list, int end )
+    {
+        this( comparator, 0, list, end );
+    }
+
+
+    /**
+     * Creates a new ListCursor with a lower (inclusive) bound: the upper
+     * (exclusive) bound is the size of the list.
+     *
+     * @param start the lower (inclusive) bound index: the position of the
+     * first entry
+     * @param list the backing for this ListCursor
+     */
+    public ListCursor( int start, List<E> list )
+    {
+        this( null, start, list, list.size() );
+    }
+
+
+    /**
+     * Creates a new ListCursor with a lower (inclusive) bound: the upper
+     * (exclusive) bound is the size of the list. We also provide a comparator.
+     *
+     * @param comparator The comparator to use for the <E> elements
+     * @param start the lower (inclusive) bound index: the position of the
+     * first entry
+     * @param list the backing for this ListCursor
+     */
+    public ListCursor( Comparator<E> comparator, int start, List<E> list )
+    {
+        this( comparator, start, list, list.size() );
+    }
+
+
+    /**
+     * Creates a new ListCursor without specific bounds: the bounds are
+     * acquired from the size of the list.
+     *
+     * @param list the backing for this ListCursor
+     */
+    public ListCursor( List<E> list )
+    {
+        this( null, 0, list, list.size() );
+    }
+
+
+    /**
+     * Creates a new ListCursor without specific bounds: the bounds are
+     * acquired from the size of the list. We also provide a comparator.
+     *
+     * @param comparator The comparator to use for the <E> elements
+     * @param list the backing for this ListCursor
+     */
+    public ListCursor( Comparator<E> comparator, List<E> list )
+    {
+        this( comparator, 0, list, list.size() );
+    }
+
+
+    /**
+     * Creates a new ListCursor without any elements.
+     */
+    @SuppressWarnings("unchecked")
+    public ListCursor()
+    {
+        this( null, 0, Collections.EMPTY_LIST, 0 );
+    }
+
+
+    /**
+     * Creates a new ListCursor without any elements. We also provide 
+     * a comparator.
+     * 
+     * @param comparator The comparator to use for the <E> elements
+     */
+    @SuppressWarnings("unchecked")
+    public ListCursor( Comparator<E> comparator )
+    {
+        this( comparator, 0, Collections.EMPTY_LIST, 0 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean available()
+    {
+        return index >= 0 && index < end;
+    }
+
+
+    /**
+     * @throws IllegalStateException if the underlying list is not sorted
+     * and/or a comparator is not provided.
+     */
+    public void before( E element ) throws Exception
+    {
+        checkNotClosed( "before()" );
+
+        if ( comparator == null )
+        {
+            throw new IllegalStateException();
+        }
+
+        // handle some special cases
+        if ( list.size() == 0 )
+        {
+            return;
+        }
+        else if ( list.size() == 1 )
+        {
+            if ( comparator.compare( element, list.get( 0 ) ) <= 0 )
+            {
+                beforeFirst();
+            }
+            else
+            {
+                afterLast();
+            }
+        }
+
+        // TODO might want to add some code here to utilize the comparator
+        throw new UnsupportedOperationException( "don't know if list is sorted and checking that is not worth it" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void after( E element ) throws Exception
+    {
+        checkNotClosed( "after()" );
+
+        if ( comparator == null )
+        {
+            throw new IllegalStateException();
+        }
+
+        // handle some special cases
+        if ( list.size() == 0 )
+        {
+            return;
+        }
+        else if ( list.size() == 1 )
+        {
+            if ( comparator.compare( element, list.get( 0 ) ) >= 0 )
+            {
+                afterLast();
+            }
+            else
+            {
+                beforeFirst();
+            }
+        }
+
+        // TODO might want to add some code here to utilize the comparator
+        throw new UnsupportedOperationException( "don't know if list is sorted and checking that is not worth it" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void beforeFirst() throws Exception
+    {
+        checkNotClosed( "beforeFirst()" );
+        this.index = -1;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void afterLast() throws Exception
+    {
+        checkNotClosed( "afterLast()" );
+        this.index = end;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean first() throws Exception
+    {
+        checkNotClosed( "first()" );
+
+        if ( list.size() > 0 )
+        {
+            index = start;
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean last() throws Exception
+    {
+        checkNotClosed( "last()" );
+
+        if ( list.size() > 0 )
+        {
+            index = end - 1;
+            return true;
+        }
+        
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isFirst() throws Exception
+    {
+        checkNotClosed( "isFirst()" );
+        return list.size() > 0 && index == start;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isLast() throws Exception
+    {
+        checkNotClosed( "isLast()" );
+        return list.size() > 0 && index == end - 1;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAfterLast() throws Exception
+    {
+        checkNotClosed( "isAfterLast()" );
+        return index == end;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isBeforeFirst() throws Exception
+    {
+        checkNotClosed( "isBeforeFirst()" );
+        return index == -1;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean previous() throws Exception
+    {
+        checkNotClosed( "previous()" );
+
+        // if parked at -1 we cannot go backwards
+        if ( index == -1 )
+        {
+            return false;
+        }
+
+        // if the index moved back is still greater than or eq to start then OK
+        if ( index - 1 >= start )
+        {
+            index--;
+            return true;
+        }
+
+        // if the index currently less than or equal to start we need to park it at -1 and return false
+        if ( index <= start )
+        {
+            index = -1;
+            return false;
+        }
+
+        if ( list.size() <= 0 )
+        {
+            index = -1;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean next() throws Exception
+    {
+        checkNotClosed( "next()" );
+
+        // if parked at -1 we advance to the start index and return true
+        if ( list.size() > 0 && index == -1 )
+        {
+            index = start;
+            return true;
+        }
+
+        // if the index plus one is less than the end then increment and return true
+        if ( list.size() > 0 && index + 1 < end )
+        {
+            index++;
+            return true;
+        }
+
+        // if the index plus one is equal to the end then increment and return false
+        if ( list.size() > 0 && index + 1 == end )
+        {
+            index++;
+            return false;
+        }
+
+        if ( list.size() <= 0 )
+        {
+            index = end;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public E get() throws Exception
+    {
+        checkNotClosed( "get()" );
+        
+        if ( index < start || index >= end )
+        {
+            throw new IOException( "Cursor not positioned at an element" );
+        }
+
+        return list.get( index );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isElementReused()
+    {
+        return true;
+    }
+}