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 2012/08/27 14:07:12 UTC
svn commit: r1377649 - in /directory/apacheds/branches/apacheds-mvbt:
core-api/src/main/java/org/apache/directory/server/core/api/
core-api/src/main/java/org/apache/directory/server/core/api/filtering/
core-api/src/test/java/org/apache/directory/server...
Author: elecharny
Date: Mon Aug 27 12:07:11 2012
New Revision: 1377649
URL: http://svn.apache.org/viewvc?rev=1377649&view=rev
Log:
o Made some cursors implementation extending AbstractCursor to inherit from its methods
o Removed the methods present in the AbstractCursor when they are duplicated
o Removed a useless reference to the Store in ChildrenCursor
Modified:
directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
directory/apacheds/branches/apacheds-mvbt/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java
directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java
directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java
Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java Mon Aug 27 12:07:11 2012
@@ -23,8 +23,7 @@ package org.apache.directory.server.core
import java.util.Iterator;
-import org.apache.directory.server.core.api.entry.ClonedServerEntry;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.SearchCursor;
@@ -48,7 +47,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EntryToResponseCursor implements SearchCursor
+public class EntryToResponseCursor extends AbstractCursor<Response> implements SearchCursor
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -130,7 +129,7 @@ public class EntryToResponseCursor imple
public Response get() throws Exception
{
- Entry entry = ( ClonedServerEntry ) wrapped.get();
+ Entry entry = wrapped.get();
SearchResultEntry se = new SearchResultEntryImpl( messageId );
se.setEntry( entry );
@@ -190,46 +189,6 @@ public class EntryToResponseCursor imple
/**
* {@inheritDoc}
*/
- public boolean isAfterLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isAfterLast()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isBeforeFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isBeforeFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isLast()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
public boolean isDone()
{
return done;
Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/BaseEntryFilteringCursor.java Mon Aug 27 12:07:11 2012
@@ -22,16 +22,14 @@ package org.apache.directory.server.core
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.entry.ClonedServerEntrySearch;
import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
-import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -51,7 +49,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class BaseEntryFilteringCursor implements EntryFilteringCursor
+public class BaseEntryFilteringCursor extends AbstractCursor<Entry> implements EntryFilteringCursor
{
/** the logger used by this class */
private static final Logger log = LoggerFactory.getLogger( BaseEntryFilteringCursor.class );
@@ -165,6 +163,7 @@ public class BaseEntryFilteringCursor im
return filters.add( filter );
}
+
/* (non-Javadoc)
* @see org.apache.directory.server.core.filtering.EntryFilteringCursor#removeEntryFilter(org.apache.directory.server.core.filtering.EntryFilter)
*/
@@ -173,6 +172,7 @@ public class BaseEntryFilteringCursor im
return filters.remove( filter );
}
+
/**
* {@inheritDoc}
*/
@@ -288,7 +288,7 @@ public class BaseEntryFilteringCursor im
}
beforeFirst();
-
+
return next();
}
@@ -329,7 +329,7 @@ public class BaseEntryFilteringCursor im
}
afterLast();
-
+
return previous();
}
@@ -586,7 +586,7 @@ public class BaseEntryFilteringCursor im
*/
prefetched = tempResult;
filterContents( prefetched );
-
+
return true;
}
@@ -594,53 +594,4 @@ public class BaseEntryFilteringCursor im
return false;
}
-
-
- /**
- * {@inheritDoc}
- */
- public Iterator<Entry> iterator()
- {
- return new CursorIterator<Entry>( this );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isAfterLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isAfterLast()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isBeforeFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isBeforeFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isLast()" ) ) );
- }
}
Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/filtering/CursorList.java Mon Aug 27 12:07:11 2012
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -44,7 +45,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class CursorList implements EntryFilteringCursor
+public class CursorList extends AbstractCursor<Entry> implements EntryFilteringCursor
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/test/java/org/apache/directory/server/core/api/MockCursor.java Mon Aug 27 12:07:11 2012
@@ -20,20 +20,17 @@
package org.apache.directory.server.core.api;
-import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
-import org.apache.directory.shared.ldap.model.cursor.Cursor;
-import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.util.exception.NotImplementedException;
-public class MockCursor implements Cursor<Entry>
+public class MockCursor extends AbstractCursor<Entry>
{
final int count;
int ii;
@@ -150,12 +147,6 @@ public class MockCursor implements Curso
}
- public Iterator<Entry> iterator()
- {
- return new CursorIterator<Entry>( this );
- }
-
-
public void close( Exception reason ) throws Exception
{
}
@@ -170,44 +161,4 @@ public class MockCursor implements Curso
{
this.schemaManager = schemaManager;
}
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isAfterLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isAfterLast()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isBeforeFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isBeforeFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isLast()" ) ) );
- }
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/EntryCursorAdaptor.java Mon Aug 27 12:07:11 2012
@@ -20,13 +20,10 @@
package org.apache.directory.server.core.partition.impl.btree;
-import java.util.Iterator;
-
import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
import org.apache.directory.shared.ldap.model.cursor.ClosureMonitor;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
-import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,7 +34,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EntryCursorAdaptor<ID extends Comparable<ID>> implements Cursor<Entry>
+public class EntryCursorAdaptor<ID extends Comparable<ID>> extends AbstractCursor<Entry>
{
/** A dedicated log for cursors */
private static final Logger LOG_CURSOR = LoggerFactory.getLogger( "CURSOR" );
@@ -184,53 +181,4 @@ public class EntryCursorAdaptor<ID exten
{
return indexCursor.previous();
}
-
-
- /*
- * @see Iterable#iterator()
- */
- public Iterator<Entry> iterator()
- {
- return new CursorIterator<Entry>( this );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isAfterLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isAfterLast()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isBeforeFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isBeforeFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isFirst() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isFirst()" ) ) );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean isLast() throws Exception
- {
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
- .concat( "." ).concat( "isLast()" ) ) );
- }
}
Modified: directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java?rev=1377649&r1=1377648&r2=1377649&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/cursor/ChildrenCursor.java Mon Aug 27 12:07:11 2012
@@ -49,9 +49,6 @@ public class ChildrenCursor<ID extends C
/** A Cursor over the entries in the scope of the search base */
private final Cursor<IndexEntry<ParentIdAndRdn<ID>, ID>> cursor;
- /** The entry database/store */
- private final Store<Entry, ID> db;
-
/** The Parent ID */
private ID parentId;
@@ -70,7 +67,6 @@ public class ChildrenCursor<ID extends C
throws Exception
{
LOG_CURSOR.debug( "Creating ChildrenCursor {}", this );
- this.db = db;
this.parentId = parentId;
this.cursor = cursor;
}