directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r604464 - in /directory/sandbox/akarasulu/bigbang/apacheds: btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ core-cursor/ core-cursor/src/ core-cursor/src/main/ core-cursor/src/main/java/ core-cursor/src/main/...
Date Sat, 15 Dec 2007 17:49:01 GMT
Author: akarasulu
Date: Sat Dec 15 09:48:59 2007
New Revision: 604464

URL: http://svn.apache.org/viewvc?rev=604464&view=rev
Log:
moving cursor stuff into its own module

Added:
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/pom.xml
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/
Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java?rev=604464&r1=604463&r2=604464&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java
Sat Dec 15 09:48:59 2007
@@ -44,6 +44,7 @@
      */
     TupleBrowser beforeFirst() throws IOException;
 
+
     /**
      * Gets a TupleBrowser positioned just after the last entry if one
      * exists.  The getPrevious() method should return the last entry from

Added: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/pom.xml?rev=604464&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/pom.xml (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/pom.xml Sat Dec 15 09:48:59 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<!-- $Rev:  $ $Date:  $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>apacheds-parent</artifactId>
+    <version>1.5.2-SNAPSHOT</version>
+  </parent>
+  <artifactId>apacheds-core-cursor</artifactId>
+  <name>ApacheDS Core Cursor</name>
+
+  <description>
+    Cursor interfaces used by the server core.
+  </description>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core-constants</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+
+  <packaging>jar</packaging>
+</project>
+

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java?rev=604464&r1=604463&r2=604464&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
Sat Dec 15 09:48:59 2007
@@ -20,6 +20,7 @@
 
 
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.AbstractCursor;
 import org.apache.directory.server.core.partition.impl.btree.Tuple;
 import org.apache.directory.server.core.partition.impl.btree.TupleBrowserFactory;
 import org.apache.directory.server.core.partition.impl.btree.TupleBrowser;
@@ -35,11 +36,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BTreeTupleCursor implements Cursor
+public class BTreeTupleCursor extends AbstractCursor<Tuple>
 {
     private final Object key;
     private final Tuple tuple = new Tuple();
     private final TupleBrowserFactory factory;
+    private final Comparator comparator;
 
     private jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple();
     private TupleBrowser browser;
@@ -47,78 +49,66 @@
 
 
 
-    public BTreeTupleCursor( TupleBrowserFactory factory, Comparator<Object> comparator,
Object key, Object val,
-                             boolean beforeValue ) throws IOException
+    public BTreeTupleCursor( TupleBrowserFactory factory, Object key, Comparator comparator
)
+            throws IOException
     {
         this.key = key;
         this.factory = factory;
-
-        if ( beforeValue )
-        {
-            browser = factory.beforeKey( val );
-        }
+        this.comparator = comparator;
     }
 
 
-    /**
-     * @todo
-     *
-     * This is a little tricky. How do we know where we are positioned?  We could
-     * do some check perhaps with getNext() and backup with getPrevious().
-     *
-     * @param key
-     * @throws IOException
-     */
-    private void beforeKey( Object key ) throws IOException
-    {
-        browser = factory.beforeKey( key );
-        beforeFirst = false;
-        afterLast = false;
-        size = factory.size();
-        pos = BEFORE_FIRST;
-        success = true;
+    public boolean before( Tuple element ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
 
-        throw new NotImplementedException( "Need to fix the todo on this before going further"
);
+    public boolean after( Tuple element ) throws IOException
+    {
+        throw new NotImplementedException();
     }
 
 
     public void beforeFirst() throws IOException
     {
+        throw new NotImplementedException();
     }
 
 
     public void afterLast() throws IOException
     {
+        throw new NotImplementedException();
     }
 
 
     public boolean absolute( int absolutePosition ) throws IOException
     {
-        return false;
+        throw new NotImplementedException();
     }
 
 
     public boolean relative( int relativePosition ) throws IOException
     {
-        return false;
+        throw new NotImplementedException();
     }
 
 
     public boolean first() throws IOException
     {
-        return false;
+        throw new NotImplementedException();
     }
 
 
     public boolean last() throws IOException
     {
-        return false;
+        throw new NotImplementedException();
     }
 
 
     public boolean isFirst() throws IOException
     {
-        return false;
+        throw new NotImplementedException();
     }
 
 
@@ -140,12 +130,6 @@
     }
 
 
-    public boolean isClosed() throws IOException
-    {
-        return false;
-    }
-
-
     public boolean previous() throws IOException
     {
         return false;
@@ -158,20 +142,14 @@
     }
 
 
-    public Object get() throws IOException
+    public Tuple get() throws IOException
     {
-        return null;
+        throw new NotImplementedException();
     }
 
 
     public boolean isElementReused()
     {
-        return false;
-    }
-
-
-    public void close() throws IOException
-    {
-
+        return true;
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=604464&r1=604463&r2=604464&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Sat Dec 15 09:48:59 2007
@@ -24,7 +24,6 @@
 import jdbm.btree.BTree;
 import jdbm.helper.Serializer;
 import jdbm.helper.TupleBrowser;
-import org.apache.commons.collections.iterators.ArrayIterator;
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.cursor.EmptyCursor;
 import org.apache.directory.server.core.cursor.IteratorCursor;
@@ -32,7 +31,6 @@
 import org.apache.directory.server.core.partition.impl.btree.*;
 import org.apache.directory.server.schema.SerializableComparator;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import java.io.IOException;
 import java.util.*;
@@ -972,13 +970,13 @@
         
         if ( values == null )
         {
-            return new EmptyCursor();
+            return new EmptyCursor<Object>();
         }
         
         if ( values instanceof TreeSet )
         {
             TreeSet set = ( TreeSet ) values;
-            return new IteratorCursor( set.iterator() );
+            return new IteratorCursor<Object>( set.iterator() );
         }
         
         if ( values instanceof BTreeRedirect )
@@ -1173,8 +1171,19 @@
         
         if ( values instanceof BTreeRedirect )
         {
-            return new BTreeTupleEnumeration( getBTree( ( BTreeRedirect ) values ), 
-                comparator.getValueComparator(), key, val, isGreaterThan );
+//            return new BTreeTupleEnumeration( getBTree( ( BTreeRedirect ) values ),
+//                comparator.getValueComparator(), key, val, isGreaterThan );
+            JdbmTupleBrowserFactory factory = new JdbmTupleBrowserFactory( getBTree( ( BTreeRedirect
) values ) );
+            Cursor<Tuple> cursor = new BTreeTupleCursor( factory, key, comparator.getValueComparator()
);
+            if ( isGreaterThan )
+            {
+                cursor.after( new Tuple( key, val ) );
+            }
+            else
+            {
+                cursor.before( new Tuple( key, val ) );
+            }
+            return cursor;
         }
 
         throw new IllegalStateException( "When using duplicate keys either a TreeSet or BTree
is used for values." );



Mime
View raw message