directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1031853 [2/3] - in /directory/sandbox/seelmann/hbase-partition: ./ src/main/java/org/apache/directory/server/core/partition/hbase/ src/main/java/org/apache/directory/server/core/partition/hbase/cursor/ src/main/java/org/apache/directory/se...
Date Fri, 05 Nov 2010 22:15:24 GMT
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBasePresenceIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBasePresenceIndex.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBasePresenceIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBasePresenceIndex.java Fri Nov  5 22:15:23 2010
@@ -24,10 +24,10 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.cursor.HBasePresenceIndexCursor;
 import org.apache.directory.server.core.partition.hbase.table.HBasePresenceIndexTable;
+import org.apache.directory.shared.ldap.entry.Entry;
 
 
 /**
@@ -37,7 +37,7 @@ import org.apache.directory.server.core.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HBasePresenceIndex extends AbstractHBaseIndex<String, ServerEntry>
+public class HBasePresenceIndex extends AbstractHBaseIndex<String, Entry>
 {
 
     private Map<String, HBasePresenceIndexTable> presenceIndexTables = new HashMap<String, HBasePresenceIndexTable>();
@@ -65,9 +65,9 @@ public class HBasePresenceIndex extends 
 
 
     @Override
-    public int count( String attributeType ) throws Exception
+    public int count( String attributeTypeOid ) throws Exception
     {
-        int count = getPresenceIndexTable( attributeType ).count();
+        int count = getPresenceIndexTable( attributeTypeOid ).count();
         return count;
     }
 

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseRdnIndex.java?rev=1031853&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseRdnIndex.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseRdnIndex.java Fri Nov  5 22:15:23 2010
@@ -0,0 +1,105 @@
+/*
+ *   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.server.core.partition.hbase.index;
+
+
+import java.util.UUID;
+
+import org.apache.directory.server.core.partition.hbase.HBaseStore;
+import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable.MasterTreeInfo;
+import org.apache.directory.server.xdbm.ParentIdAndRdn;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.name.RDN;
+
+
+/**
+ * HBase specific implementation of the rdn index.
+ * There is no special ndn index table, but the master table is used.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HBaseRdnIndex extends AbstractHBaseIndex<ParentIdAndRdn<UUID>, Entry>
+{
+
+    public HBaseRdnIndex()
+    {
+    }
+
+
+    public HBaseRdnIndex( HBaseStore store )
+    {
+        setStore( store );
+    }
+
+
+    public void close() throws Exception
+    {
+    }
+
+
+    @Override
+    public void add( ParentIdAndRdn<UUID> attrVal, UUID id ) throws Exception
+    {
+        // do nothing, RDN index is maintained by master table
+    }
+
+
+    @Override
+    public void drop( UUID id ) throws Exception
+    {
+        // do nothing, RDN index is maintained by master table
+    }
+
+
+    @Override
+    public ParentIdAndRdn<UUID> reverseLookup( UUID id ) throws Exception
+    {
+        MasterTreeInfo mti = store.getMasterTable().fetchMasterTreeInfo( id );
+        DN dn = new DN( mti.upName );
+        dn.normalize( store.getSchemaManager().getNormalizerMapping() );
+        ParentIdAndRdn<UUID> piar = new ParentIdAndRdn<UUID>( mti.parentId, dn.getRdns() );
+        return piar;
+    }
+
+
+    @Override
+    public UUID forwardLookup( ParentIdAndRdn<UUID> key ) throws Exception
+    {
+        String normName = "";
+        String upName = "";
+        for ( int i = 0; i < key.getRdns().length; i++ )
+        {
+            if ( i > 0 )
+            {
+                normName += ",";
+                upName += ",";
+            }
+            RDN rdn = key.getRdns()[i];
+            normName += rdn.getNormName();
+            upName += rdn.getName();
+        }
+        MasterTreeInfo mti = new MasterTreeInfo( key.getParentId(), normName, upName );
+        UUID id = store.getMasterTable().fetchId( mti );
+        return id;
+    }
+
+}

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubAliasIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubAliasIndex.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubAliasIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubAliasIndex.java Fri Nov  5 22:15:23 2010
@@ -22,38 +22,36 @@ package org.apache.directory.server.core
 
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.xdbm.EmptyIndexCursor;
-import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.partition.hbase.cursor.HBaseUserRowIndexCursor;
 
 
 /**
- * HBase specific implementation of the alias index.
+ * HBase specific implementation of the sub-level alias index.
  * 
- * TODO: This is just a stub, needs to be implemented.
- *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HBaseSubAliasIndex extends AbstractHBaseIndex<UUID, ServerEntry>
+public class HBaseSubAliasIndex extends HBaseUserRowIndex
 {
 
-    public void close() throws Exception
+    public HBaseSubAliasIndex()
     {
+        super( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID );
     }
 
 
     @Override
-    public boolean forward( UUID attrVal, UUID id ) throws Exception
+    public boolean forward( Object attrVal, UUID id ) throws Exception
     {
-        // TODO
-        return false;
+        return super.forward( attrVal, id );
     }
 
 
     @Override
-    public IndexCursor<UUID, ServerEntry, UUID> forwardCursor( UUID key ) throws Exception
+    public HBaseUserRowIndexCursor forwardCursor( Object value ) throws Exception
     {
-        return new EmptyIndexCursor<UUID, ServerEntry, UUID>();
+        return super.forwardCursor( value );
     }
+
 }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubLevelIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubLevelIndex.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubLevelIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubLevelIndex.java Fri Nov  5 22:15:23 2010
@@ -22,11 +22,11 @@ package org.apache.directory.server.core
 
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.cursor.HBaseSubLevelIndexCursor;
 import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
 import org.apache.directory.server.core.partition.hbase.xdbmext.IndexFilteringExtension;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 
 
@@ -37,8 +37,8 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HBaseSubLevelIndex extends AbstractHBaseIndex<UUID, ServerEntry> implements
-    IndexFilteringExtension<UUID, ServerEntry, UUID>
+public class HBaseSubLevelIndex extends AbstractHBaseIndex<UUID, Entry> implements
+    IndexFilteringExtension<UUID, Entry, UUID>
 {
 
     public HBaseSubLevelIndex()
@@ -91,4 +91,25 @@ public class HBaseSubLevelIndex extends 
         return store.getMasterTable().getSubLevelCount( baseId );
     }
 
+
+    @Override
+    public void add( UUID attrVal, UUID id ) throws Exception
+    {
+        // do nothing, there is no dedicated sub level index
+    }
+
+
+    @Override
+    public void drop( UUID entryId ) throws Exception
+    {
+        // do nothing, there is no dedicated sub level index
+    }
+
+
+    @Override
+    public void drop( UUID attrVal, UUID id ) throws Exception
+    {
+        // do nothing, there is no dedicated sub level index
+    }
+
 }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserIndex.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserIndex.java Fri Nov  5 22:15:23 2010
@@ -23,11 +23,13 @@ package org.apache.directory.server.core
 import java.util.UUID;
 import java.util.regex.Pattern;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.cursor.HBaseUserIndexReverseCursor;
 import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
 import org.apache.directory.server.core.partition.hbase.xdbmext.IndexSubstringExtension;
 import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.hadoop.hbase.util.Bytes;
 
@@ -38,8 +40,8 @@ import org.apache.hadoop.hbase.util.Byte
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public abstract class HBaseUserIndex<T extends HBaseIndexTable> extends AbstractHBaseIndex<Object, ServerEntry>
-    implements IndexSubstringExtension<Object, ServerEntry, UUID>
+public abstract class HBaseUserIndex<T extends HBaseIndexTable> extends AbstractHBaseIndex<Object, Entry> implements
+    IndexSubstringExtension<Object, Entry, UUID>
 {
 
     protected HBaseUserIndex()
@@ -55,8 +57,16 @@ public abstract class HBaseUserIndex<T e
     @Override
     public int count() throws Exception
     {
-        int count = store.getPresenceIndex().count( getAttributeId() );
-        return count;
+        if ( store.hasUserIndexOn( getAttributeId() ) )
+        {
+            int count = store.getPresenceIndex().count( getAttributeId() );
+            return count;
+        }
+        else //if ( store.hasSystemIndexOn( getAttributeId() ) )
+        {
+            int count = store.count();
+            return count;
+        }
     }
 
 
@@ -94,7 +104,7 @@ public abstract class HBaseUserIndex<T e
 
 
     @Override
-    public IndexCursor<Object, ServerEntry, UUID> reverseCursor( UUID id ) throws Exception
+    public IndexCursor<Object, Entry, UUID> reverseCursor( UUID id ) throws Exception
     {
         return new HBaseUserIndexReverseCursor( getAttributeId(), id, store );
     }
@@ -146,6 +156,30 @@ public abstract class HBaseUserIndex<T e
     }
 
 
+    @Override
+    public Object reverseLookup( UUID id ) throws Exception
+    {
+        Entry entry = store.getMasterTable().get( id );
+        if ( entry == null )
+        {
+            return null;
+        }
+        EntryAttribute attribute = entry.get( attributeId );
+        if ( attribute == null )
+        {
+            return null;
+        }
+        return attribute.get().get();
+    }
+
+
+    @Override
+    public boolean reverse( UUID id ) throws Exception
+    {
+        return reverseLookup( id ) != null;
+    }
+
+
     public int substringCount( SubstringNode node ) throws Exception
     {
         // TODO: only count 'counts':
@@ -157,7 +191,7 @@ public abstract class HBaseUserIndex<T e
         {
             //System.out.println("substringCount: scan for '" + node.getInitial() + "', totalCount=" + totalCount);
 
-            IndexCursor<Object, ServerEntry, UUID> cursor = forwardSubstringCursor( node );
+            IndexCursor<Object, Entry, UUID> cursor = forwardSubstringCursor( node );
             int substringCount = 0;
             //long t0 = System.currentTimeMillis();
             while ( cursor.next() )
@@ -193,13 +227,22 @@ public abstract class HBaseUserIndex<T e
     @Override
     public void add( Object value, UUID id ) throws Exception
     {
-        if ( value instanceof byte[] )
+        if ( value instanceof String )
+        {
+            getIndexTable().add( Bytes.toBytes( ( String ) value ), id );
+        }
+        else if ( value instanceof byte[] )
         {
             getIndexTable().add( ( byte[] ) value, id );
         }
+        else if ( value instanceof UUID )
+        {
+            //getIndexTable().add( Utils.toBytes( ( UUID ) value ), id );
+            getIndexTable().add( Bytes.toBytes( value.toString() ), id );
+        }
         else
         {
-            getIndexTable().add( Bytes.toBytes( ( String ) value ), id );
+            throw new Exception( "Unexpected type: " + value );
         }
     }
 
@@ -207,13 +250,34 @@ public abstract class HBaseUserIndex<T e
     @Override
     public void drop( Object value, UUID id ) throws Exception
     {
-        if ( value instanceof byte[] )
+        if ( value instanceof String )
+        {
+            getIndexTable().drop( Bytes.toBytes( ( String ) value ), id );
+        }
+        else if ( value instanceof byte[] )
         {
             getIndexTable().drop( ( byte[] ) value, id );
         }
+        else if ( value instanceof UUID )
+        {
+            //getIndexTable().add( Utils.toBytes( ( UUID ) value ), id );
+            getIndexTable().drop( Bytes.toBytes( value.toString() ), id );
+        }
         else
         {
-            getIndexTable().drop( Bytes.toBytes( ( String ) value ), id );
+            throw new Exception( "Unexpected type: " + value );
+        }
+    }
+
+
+    @Override
+    public void drop( UUID id ) throws Exception
+    {
+        Entry entry = store.lookup( id );
+        EntryAttribute attribute = entry.get( attributeId );
+        for ( Value<?> value : attribute )
+        {
+            drop( value.get(), id );
         }
     }
 

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexBuilder.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexBuilder.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexBuilder.java Fri Nov  5 22:15:23 2010
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.Utils;
 import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
@@ -33,6 +32,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
 import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -104,7 +104,7 @@ public class IndexBuilder extends TableM
                 store.addIndex( index );
             }
 
-            store.setSuffixDn( suffixDn.getName() );
+            store.setSuffixDn( suffixDn );
             store.setCacheSize( 100 );
             String tablePrefix = context.getConfiguration().get( TABLE_PREFIX );
             store.setTablePrefix( tablePrefix );
@@ -147,16 +147,16 @@ public class IndexBuilder extends TableM
         try
         {
             UUID id = Utils.toUUID( key.get() );
-            ServerEntry entry = store.getMasterTable().convertToServerEntry( id, result );
+            Entry entry = store.getMasterTable().convertToServerEntry( id, result );
 
             // write index tables
             for ( EntryAttribute attribute : entry )
             {
                 String attr = attribute.getId();
                 String oid = store.getSchemaManager().getAttributeTypeRegistry().getOidByName( attr );
-                if ( store.hasUserIndexOn( oid ) )
+                if ( store.hasIndexOn( oid ) )
                 {
-                    HBaseUserIndex<HBaseIndexTable> index = store.getUserIndex( oid );
+                    HBaseUserIndex<HBaseIndexTable> index = ( HBaseUserIndex<HBaseIndexTable> ) store.getIndex( oid );
                     for ( Value<?> value : attribute )
                     {
                         index.add( value.getBytes(), id );

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/LdifImporter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/LdifImporter.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/LdifImporter.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/LdifImporter.java Fri Nov  5 22:15:23 2010
@@ -26,12 +26,12 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.csn.CsnFactory;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.ldif.LdapLdifException;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
@@ -87,7 +87,7 @@ public class LdifImporter extends Mapper
             suffixDn.normalize( schemaManager.getNormalizerMapping() );
 
             store = new HBaseStore();
-            store.setSuffixDn( suffixDn.getName() );
+            store.setSuffixDn( suffixDn );
             store.setCacheSize( 100 );
             store.setTablePrefix( context.getConfiguration().get( TABLE_PREFIX ) );
             store.init( schemaManager );
@@ -160,7 +160,7 @@ public class LdifImporter extends Mapper
         try
         {
             // convert LDIF entry to server entry
-            ServerEntry entry = new DefaultServerEntry( store.getSchemaManager(), ldifEntry.getEntry() );
+            Entry entry = new DefaultEntry( store.getSchemaManager(), ldifEntry.getEntry() );
 
             // add operational attributes
             entry.put( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/TreeTableBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/TreeTableBuilder.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/TreeTableBuilder.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/TreeTableBuilder.java Fri Nov  5 22:15:23 2010
@@ -24,10 +24,10 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.Utils;
 import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.loader.ldif.JarLdifSchemaLoader;
@@ -75,7 +75,7 @@ public class TreeTableBuilder extends Ta
 
             store = new HBaseStore();
 
-            store.setSuffixDn( suffixDn.getName() );
+            store.setSuffixDn( suffixDn );
             store.setCacheSize( 100 );
             String tablePrefix = context.getConfiguration().get( TABLE_PREFIX );
             store.setTablePrefix( tablePrefix );
@@ -118,7 +118,7 @@ public class TreeTableBuilder extends Ta
         try
         {
             UUID id = Utils.toUUID( key.get() );
-            ServerEntry entry = store.getMasterTable().convertToServerEntry( id, result );
+            Entry entry = store.getMasterTable().convertToServerEntry( id, result );
 
             // write to tree table
             UUID parentId = Utils.toUUID( result.getValue( HBaseMasterTable.TREE_INFO_FAMILY,
@@ -128,7 +128,7 @@ public class TreeTableBuilder extends Ta
             String upRdn = Bytes.toString( result.getValue( HBaseMasterTable.TREE_INFO_FAMILY,
                 HBaseMasterTable.UP_RDN_QUALIFIER ) );
             HBaseMasterTable.MasterTreeInfo mti = new HBaseMasterTable.MasterTreeInfo( parentId, normRdn, upRdn );
-            store.getMasterTable().addToTree( id, mti, entry );
+            store.getMasterTable().putToTree( id, mti, entry, true );
 
             context.getCounter( Counters.TREE_ENTRIES ).increment( 1 );
         }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java Fri Nov  5 22:15:23 2010
@@ -22,7 +22,9 @@ package org.apache.directory.server.core
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.NavigableMap;
+import java.util.Set;
 import java.util.UUID;
 
 import org.apache.directory.server.core.partition.hbase.Cache;
@@ -31,13 +33,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.util.Base64;
 import org.apache.directory.shared.ldap.util.ByteBuffer;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.filter.BinaryComparator;
-import org.apache.hadoop.hbase.filter.ValueFilter;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
+import org.apache.hadoop.hbase.filter.ValueFilter;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,7 +62,7 @@ public class HBaseColumnIndexTable exten
 
 
     public HBaseColumnIndexTable( String attributeTypeOid, SchemaManager schemaManager, String tablePrefix,
-        HBaseConfiguration configuration, int cacheSize ) throws Exception
+        Configuration configuration, int cacheSize ) throws Exception
     {
         super( attributeTypeOid, schemaManager, tablePrefix, configuration, cacheSize );
         this.infoCache = new Cache<String, Info>( cacheSize );
@@ -189,7 +191,7 @@ public class HBaseColumnIndexTable exten
 
         Get get = new Get( row );
         get.addFamily( INFO_FAMILY );
-        get.setFilter( new ValueFilter( CompareOp.EQUAL, new BinaryComparator( EXISTS ) ) );
+        //get.setFilter( new ValueFilter( CompareOp.EQUAL, new BinaryComparator( EXISTS ) ) );
         Result result = HBaseTableHelper.get( getIndexTablePool(), indexTableName, get );
         if ( result.getRow() == null )
         {
@@ -215,9 +217,12 @@ public class HBaseColumnIndexTable exten
         }
 
         NavigableMap<byte[], byte[]> infoMap = result.getFamilyMap( INFO_FAMILY );
-        for ( byte[] qualifier : infoMap.keySet() )
+        for ( Entry<byte[],byte[]> entry : infoMap.entrySet() )
         {
-            info.candidates.add( Utils.toUUID( qualifier ) );
+            if(Bytes.equals( entry.getValue(), EXISTS ))
+            {
+                info.candidates.add( Utils.toUUID( entry.getKey() ) );
+            }
         }
         return info;
     }
@@ -231,7 +236,7 @@ public class HBaseColumnIndexTable exten
         exactPut.add( INFO_FAMILY, Utils.toBytes( id ), EXISTS );
         HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
 
-        // TODO: optimize - don't need to clear the ẃhole cache
+        // TODO: optimize - don't need to clear the whole cache
         infoCache.clear();
         countCache.clear();
         existsCache.clear();
@@ -246,7 +251,7 @@ public class HBaseColumnIndexTable exten
         exactPut.add( INFO_FAMILY, Utils.toBytes( id ), DELETED );
         HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
 
-        // TODO: optimize - don't need to clear the ẃhole cache
+        // TODO: optimize - don't need to clear the whole cache
         infoCache.clear();
         countCache.clear();
         existsCache.clear();

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableBase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableBase.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableBase.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableBase.java Fri Nov  5 22:15:23 2010
@@ -20,12 +20,14 @@
 package org.apache.directory.server.core.partition.hbase.table;
 
 
+import java.util.UUID;
+
 import org.apache.directory.server.core.partition.hbase.Cache;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -44,13 +46,13 @@ public abstract class HBaseIndexTableBas
     protected String indexTableName;
     private HBaseTablePool indexTablePool;
     protected SchemaManager schemaManager;
-    protected HBaseConfiguration configuration;
+    protected Configuration configuration;
     protected Cache<Object, Integer> countCache;
     protected Cache<Object, Boolean> existsCache;
 
 
     public HBaseIndexTableBase( String attributeTypeOid, SchemaManager schemaManager, String tablePrefix,
-        HBaseConfiguration configuration, int cacheSize ) throws Exception
+        Configuration configuration, int cacheSize ) throws Exception
     {
         this.attributeTypeOid = attributeTypeOid;
         this.schemaManager = schemaManager;
@@ -89,8 +91,7 @@ public abstract class HBaseIndexTableBas
         }
         else if ( value instanceof byte[] )
         {
-            Value<?> normalized = at.getEquality().getNormalizer()
-                .normalize( new ClientBinaryValue( ( byte[] ) value ) );
+            Value<?> normalized = at.getEquality().getNormalizer().normalize( new BinaryValue( ( byte[] ) value ) );
             if ( normalized.isBinary() )
             {
                 normValue = normalized.getBytes();
@@ -100,6 +101,10 @@ public abstract class HBaseIndexTableBas
                 normValue = Bytes.toBytes( normalized.getString() );
             }
         }
+        else if ( value instanceof UUID )
+        {
+            normValue = Bytes.toBytes( value.toString() );
+        }
         else
         {
             throw new Exception( "Unexpected type: " + value );

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java Fri Nov  5 22:15:23 2010
@@ -21,29 +21,31 @@ package org.apache.directory.server.core
 
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.NavigableMap;
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.DefaultServerAttribute;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerBinaryValue;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.partition.hbase.Cache;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.Utils;
+import org.apache.directory.server.xdbm.MasterTable;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.cursor.Tuple;
+import org.apache.directory.shared.ldap.entry.BinaryValue;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
@@ -61,7 +63,7 @@ import org.apache.hadoop.hbase.util.Byte
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HBaseMasterTable
+public class HBaseMasterTable implements MasterTable<UUID, Entry>
 {
     public static final UUID ROOT_ID = UUID.fromString( "00000000-0000-0000-0000-000000000000" );
     public static final byte[] ROOT_ROW = Utils.toBytes( ROOT_ID );
@@ -98,7 +100,7 @@ public class HBaseMasterTable
     public static final String MAINTAIN_COUNTERS_PROPERTY = "org.apache.directory.maintain.counters";
     public static final String COMPRESSION_ALGORITHM_PROPERTY = "org.apache.directory.compression.algorithm";
 
-    private HBaseConfiguration configuration;
+    private Configuration configuration;
     private boolean maintainCounters;
     private SchemaManager schemaManager;
     private DN suffixDn;
@@ -125,20 +127,20 @@ public class HBaseMasterTable
     private Cache<UUID, DN> dnCache;
 
     /** id -> entry */
-    private Cache<UUID, ServerEntry> entryCache;
+    private Cache<UUID, Entry> entryCache;
 
 
     public HBaseMasterTable( HBaseStore store )
     {
         this.schemaManager = store.getSchemaManager();
-        this.suffixDn = store.getSuffix();
+        this.suffixDn = store.getSuffixDn();
         this.configuration = store.getConfiguration();
         this.maintainCounters = configuration.getBoolean( MAINTAIN_COUNTERS_PROPERTY, true );
         this.masterTableName = store.getTablePrefix() + MASTER_TABLE;
         this.treeTableName = store.getTablePrefix() + TREE_TABLE;
         this.suffixMti = new MasterTreeInfo( ROOT_ID, suffixDn.getNormName(), null );
 
-        this.entryCache = new Cache<UUID, ServerEntry>( store.getCacheSize() );
+        this.entryCache = new Cache<UUID, Entry>( store.getCacheSize() );
 
         int dnCacheSize = Math.max( store.getCacheSize(), store.getNdnIndex().getCacheSize() );
         this.dnCache = new Cache<UUID, DN>( dnCacheSize );
@@ -165,16 +167,20 @@ public class HBaseMasterTable
     }
 
 
-    public UUID add( ServerEntry entry ) throws Exception
+    public UUID add( Entry entry ) throws Exception
     {
-        UUID id = getId( entry );
+        UUID id = getNextId( entry );
+
         List<UUID> parentIds = fetchParentIds( entry.getDn(), false );
+        
         if ( parentIds == null )
         {
-            throw new NullPointerException( "fetchParentIds() returned null for " + entry.getDn() );
+            throw new IllegalArgumentException( "fetchParentIds() returned null for " + entry.getDn() );
         }
+        
         String upRdn;
         String normRdn;
+        
         if ( entry.getDn().equals( suffixDn ) )
         {
             upRdn = entry.getDn().getName();
@@ -182,19 +188,20 @@ public class HBaseMasterTable
         }
         else
         {
-            upRdn = entry.getDn().getRdn().getUpName();
+            upRdn = entry.getDn().getRdn().getName();
             normRdn = entry.getDn().getRdn().getNormName();
         }
+        
         MasterTreeInfo mti = new MasterTreeInfo( parentIds.get( 0 ), normRdn, upRdn );
 
-        addToMaster( id, mti, entry );
-        addToTree( id, mti, entry );
+        putToMaster( id, mti, entry );
+        putToTree( id, mti, entry, maintainCounters );
 
         return id;
     }
 
 
-    public void addToMaster( UUID id, MasterTreeInfo mti, ServerEntry entry ) throws Exception
+    public void putToMaster( UUID id, MasterTreeInfo mti, Entry entry ) throws Exception
     {
         // put to master table
         Put masterPut = new Put( Utils.toBytes( id ) );
@@ -220,7 +227,7 @@ public class HBaseMasterTable
     }
 
 
-    public void addToTree( UUID id, MasterTreeInfo mti, ServerEntry entry ) throws Exception
+    public void putToTree( UUID id, MasterTreeInfo mti, Entry entry, boolean updateCounters ) throws Exception
     {
         // put to tree table
         Put treePut = new Put( mti.treeTableKey );
@@ -228,7 +235,7 @@ public class HBaseMasterTable
         treePut.add( TREE_INFO_FAMILY, ID_QUALIFIER, Utils.toBytes( id ) );
         for ( EntryAttribute attribute : entry )
         {
-            String attrOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
+            String attrOid = attribute.getAttributeType().getOid();
             for ( int i = 0; i < attribute.size(); i++ )
             {
                 Value<?> value = attribute.get( i );
@@ -254,7 +261,7 @@ public class HBaseMasterTable
             }
         }
 
-        if ( maintainCounters )
+        if ( updateCounters )
         {
             updateOneAndSubLevelCounters( mti.parentId, true );
 
@@ -267,7 +274,7 @@ public class HBaseMasterTable
     }
 
 
-    public void delete( UUID id, ServerEntry entry ) throws Exception
+    public void delete( UUID id, Entry entry ) throws Exception
     {
         MasterTreeInfo key = fetchMasterTreeInfo( id );
 
@@ -326,7 +333,7 @@ public class HBaseMasterTable
     }
 
 
-    public void modify( UUID id, ServerEntry entry ) throws Exception
+    public void modify( UUID id, Entry entry ) throws Exception
     {
         // TODO: replace quick-and-dirty implementation (delete+put) with with better algorithm
         MasterTreeInfo mti = fetchMasterTreeInfo( id );
@@ -334,48 +341,9 @@ public class HBaseMasterTable
         nullout( getMasterTablePool(), masterTableName, Utils.toBytes( id ), UP_ATTRIBUTES_FAMILY, UP_ATTRIBUTES_FAMILY );
         nullout( getTreeTablePool(), treeTableName, mti.treeTableKey, NORM_ATTRIBUTES_FAMILY, NORM_ATTRIBUTES_FAMILY );
 
-        // add all attributes
-        // TODO: duplicate code
-        Put masterPut = new Put( Utils.toBytes( id ) );
-        masterPut.add( TREE_INFO_FAMILY, STATUS_QUALIFIER, EXISTS );
-        Put treePut = new Put( mti.treeTableKey );
-        treePut.add( TREE_INFO_FAMILY, STATUS_QUALIFIER, EXISTS );
-        for ( EntryAttribute attribute : entry )
-        {
-            String attr = attribute.getUpId();
-            String attrOid = ( ( ServerAttribute ) attribute ).getAttributeType().getOid();
-            for ( int i = 0; i < attribute.size(); i++ )
-            {
-                Value<?> value = attribute.get( i );
-
-                // upAttributes:
-                // objectClass:0 -> top
-                // objectClass:1 -> inetOrgPerson
-                masterPut.add( UP_ATTRIBUTES_FAMILY, Bytes.add( Bytes.toBytes( attr ), Bytes.toBytes( i ) ), value
-                    .getBytes() );
+        putToMaster( id, mti, entry );
+        putToTree( id, mti, entry, false );
 
-                // normAttributes:
-                // 2.5.4.0:top -> top
-                // 2.5.4.0:inetorgperson -> inetorgperson
-                //if ( store.hasUserIndexOn( attrOid ) )
-                {
-                    Object normalizedValue = value.getNormalizedValue();
-                    byte[] normalizedValueBytes;
-                    if ( normalizedValue instanceof String )
-                    {
-                        normalizedValueBytes = Bytes.toBytes( ( String ) normalizedValue );
-                    }
-                    else
-                    {
-                        normalizedValueBytes = ( byte[] ) normalizedValue;
-                    }
-                    treePut.add( NORM_ATTRIBUTES_FAMILY, Bytes.add( Bytes.toBytes( attrOid ),
-                        NORM_ATTRIBUTE_DELIMITER_BYTES, normalizedValueBytes ), Bytes.toBytes( i ) );
-                }
-            }
-        }
-        HBaseTableHelper.put( getMasterTablePool(), masterTableName, masterPut );
-        HBaseTableHelper.put( getTreeTablePool(), treeTableName, treePut );
     }
 
 
@@ -389,7 +357,7 @@ public class HBaseMasterTable
         }
         if ( newRdn != null )
         {
-            newMti = new MasterTreeInfo( newMti.parentId, newRdn.getNormName(), newRdn.getUpName() );
+            newMti = new MasterTreeInfo( newMti.parentId, newRdn.getNormName(), newRdn.getName() );
         }
 
         // master:treeInfo: set new parentId, upRdn and normRdn
@@ -478,13 +446,13 @@ public class HBaseMasterTable
      * @return the server entry, null if entry doesn't exist.
      * @throws Exception the exception
      */
-    public ServerEntry fetchEntry( UUID id ) throws Exception
+    public Entry fetchEntry( UUID id ) throws Exception
     {
         if ( id == null || id.equals( ROOT_ID ) )
         {
             return null;
         }
-        ServerEntry entry = entryCache.get( id );
+        Entry entry = entryCache.get( id );
         if ( entry != null )
         {
             return entry;
@@ -505,7 +473,7 @@ public class HBaseMasterTable
     }
 
 
-    public ServerEntry convertToServerEntry( UUID id, Result result ) throws Exception
+    public Entry convertToServerEntry( UUID id, Result result ) throws Exception
     {
         UUID parentId = Utils.toUUID( result.getValue( TREE_INFO_FAMILY, PARENT_ID_QUALIFIER ) );
         String normRdn = Bytes.toString( result.getValue( TREE_INFO_FAMILY, NORM_RDN_QUALIFIER ) );
@@ -514,7 +482,7 @@ public class HBaseMasterTable
         DN dn = fetchDn( id, mti );
 
         NavigableMap<byte[], byte[]> attributesMap = result.getFamilyMap( UP_ATTRIBUTES_FAMILY );
-        ServerEntry entry = new DefaultServerEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager, dn );
         for ( Map.Entry<byte[], byte[]> attributeEntry : attributesMap.entrySet() )
         {
             if ( Bytes.equals( attributeEntry.getValue(), NULL ) )
@@ -529,17 +497,17 @@ public class HBaseMasterTable
             AttributeType attributeType = schemaManager.getAttributeTypeRegistry().lookup( attributeDescription );
             if ( attribute == null )
             {
-                attribute = new DefaultServerAttribute( attributeDescription, attributeType );
+                attribute = new DefaultEntryAttribute( attributeDescription, attributeType );
                 entry.add( attribute );
             }
             Value<?> value;
             if ( attribute.isHR() )
             {
-                value = new ServerStringValue( attributeType, Bytes.toString( attributeEntry.getValue() ) );
+                value = new StringValue( attributeType, Bytes.toString( attributeEntry.getValue() ) );
             }
             else
             {
-                value = new ServerBinaryValue( attributeType, attributeEntry.getValue() );
+                value = new BinaryValue( attributeType, attributeEntry.getValue() );
             }
             attribute.add( value );
         }
@@ -688,7 +656,14 @@ public class HBaseMasterTable
     }
 
 
-    public ResultScanner getScanner( Scan scan ) throws Exception
+    public ResultScanner getMasterTableScanner( Scan scan ) throws Exception
+    {
+        ResultScanner scanner = HBaseTableHelper.getScanner( getMasterTablePool(), treeTableName, scan );
+        return scanner;
+    }
+
+
+    public ResultScanner getTreeTableScanner( Scan scan ) throws Exception
     {
         ResultScanner scanner = HBaseTableHelper.getScanner( getTreeTablePool(), treeTableName, scan );
         return scanner;
@@ -697,7 +672,7 @@ public class HBaseMasterTable
 
     private List<UUID> fetchParentIds( DN dn, boolean includeChild ) throws Exception
     {
-        if ( !dn.startsWith( suffixDn ) )
+        if ( !dn.isChildOf( suffixDn ) )
         {
             return null;
         }
@@ -737,14 +712,6 @@ public class HBaseMasterTable
     }
 
 
-    private UUID getId( ServerEntry entry ) throws LdapInvalidAttributeValueException
-    {
-        String name = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
-        UUID uuid = UUID.fromString( name );
-        return uuid;
-    }
-
-
     private HBaseTablePool getMasterTablePool() throws Exception
     {
         if ( masterTablePool == null )
@@ -767,7 +734,7 @@ public class HBaseMasterTable
     }
 
 
-    private UUID fetchId( MasterTreeInfo mti ) throws Exception
+    public UUID fetchId( MasterTreeInfo mti ) throws Exception
     {
         UUID id = idCache.get( mti.string );
         if ( id != null )
@@ -796,7 +763,7 @@ public class HBaseMasterTable
      * @return the master tree info, null if entry doesn't exist
      * @throws Exception
      */
-    private MasterTreeInfo fetchMasterTreeInfo( UUID id ) throws Exception
+    public MasterTreeInfo fetchMasterTreeInfo( UUID id ) throws Exception
     {
         if ( id == null || id.equals( ROOT_ID ) )
         {
@@ -828,9 +795,9 @@ public class HBaseMasterTable
 
     public static class MasterTreeInfo
     {
-        private final UUID parentId;
-        private final String normName;
-        private final String upName;
+        public final UUID parentId;
+        public final String normName;
+        public final String upName;
         public final byte[] treeTableKey;
         public final String string;
 
@@ -865,4 +832,203 @@ public class HBaseMasterTable
         return masterTableName;
     }
 
+
+    @Override
+    public void delete( UUID id ) throws Exception
+    {
+        delete( id, null );
+    }
+
+
+    @Override
+    public Entry get( UUID id ) throws Exception
+    {
+        return fetchEntry( id );
+    }
+
+
+    @Override
+    public UUID getCurrentId( Entry entry ) throws Exception
+    {
+        return getNextId( entry );
+    }
+
+
+    @Override
+    public UUID getNextId( Entry entry ) throws Exception
+    {
+        String name = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
+        UUID uuid = UUID.fromString( name );
+        return uuid;
+    }
+
+
+    @Override
+    public String getProperty( String property ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public void put( UUID id, Entry entry ) throws Exception
+    {
+        MasterTreeInfo mti = fetchMasterTreeInfo( id );
+        if ( mti != null )
+        {
+            modify( id, entry );
+        }
+        else
+        {
+            add( entry );
+        }
+    }
+
+
+    @Override
+    public void setProperty( String property, String value ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public int count() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public int count( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public Cursor<Tuple<UUID, Entry>> cursor() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public Cursor<Tuple<UUID, Entry>> cursor( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public Comparator<UUID> getKeyComparator()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public String getName()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public Comparator<Entry> getValueComparator()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public int greaterThanCount( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean has( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean has( UUID key, Entry value ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean hasGreaterOrEqual( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean hasGreaterOrEqual( UUID key, Entry val ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean hasLessOrEqual( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean hasLessOrEqual( UUID key, Entry val ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean isCountExact()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public boolean isDupsEnabled()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public int lessThanCount( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public void remove( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public void remove( UUID key, Entry value ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    @Override
+    public Cursor<Entry> valueCursor( UUID key ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
 }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java Fri Nov  5 22:15:23 2010
@@ -22,11 +22,11 @@ package org.apache.directory.server.core
 
 import java.util.UUID;
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
 import org.apache.directory.server.core.partition.hbase.Utils;
 import org.apache.directory.server.core.partition.hbase.index.HBaseUserIndex;
 import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.ByteBuffer;
 import org.apache.hadoop.hbase.client.Get;
@@ -144,8 +144,9 @@ public class HBaseRowIndexTable extends 
         }
 
         // TODO: scan directly instead of using the cursor?
-        HBaseUserIndex<HBaseIndexTable> index = store.getUserIndex( attributeTypeOid );
-        IndexCursor<Object, ServerEntry, UUID> cursor = index.forwardCursor( value );
+        HBaseUserIndex<HBaseIndexTable> index = ( HBaseUserIndex<HBaseIndexTable> ) store
+            .getIndex( attributeTypeOid );
+        IndexCursor<Object, Entry, UUID> cursor = index.forwardCursor( value );
         int count = 0;
         int limit = 100;
         while ( cursor.next() && count <= limit )
@@ -194,7 +195,7 @@ public class HBaseRowIndexTable extends 
         exactPut.add( INFO_FAMILY, STATUS_QUALIFIER, EXISTS );
         HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
 
-        // TODO: optimize - don't need to clear the ẃhole cache
+        // TODO: optimize - don't need to clear the whole cache
         countCache.clear();
         existsCache.clear();
     }
@@ -207,7 +208,7 @@ public class HBaseRowIndexTable extends 
         exactPut.add( INFO_FAMILY, STATUS_QUALIFIER, DELETED );
         HBaseTableHelper.put( getIndexTablePool(), indexTableName, exactPut );
 
-        // TODO: optimize - don't need to clear the ẃhole cache
+        // TODO: optimize - don't need to clear the whole cache
         countCache.clear();
         existsCache.clear();
     }

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTableHelper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTableHelper.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTableHelper.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTableHelper.java Fri Nov  5 22:15:23 2010
@@ -23,7 +23,7 @@ package org.apache.directory.server.core
 import java.util.UUID;
 
 import org.apache.directory.server.core.partition.hbase.Utils;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.Delete;
@@ -449,7 +449,7 @@ public class HBaseTableHelper
      * 
      * @throws Exception the exception
      */
-    public static void createTable( HBaseConfiguration configuration, String tableName, byte[]... families )
+    public static void createTable( Configuration configuration, String tableName, byte[]... families )
         throws Exception
     {
         // create table on the fly if it doesn't exist yet

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTablePool.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTablePool.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTablePool.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTablePool.java Fri Nov  5 22:15:23 2010
@@ -24,7 +24,7 @@ import java.util.LinkedList;
 import java.util.Queue;
 
 import org.apache.directory.server.core.partition.hbase.HBaseStore;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.HTable;
 
 
@@ -38,7 +38,7 @@ public class HBaseTablePool
 {
 
     protected String tableName;
-    protected HBaseConfiguration configuration;
+    protected Configuration configuration;
     protected boolean strongConsistency;
     protected Queue<HTable> available;
     protected Queue<HTable> used;
@@ -50,7 +50,7 @@ public class HBaseTablePool
      * @param tableName the table name
      * @param configuration the HBase configuration
      */
-    public HBaseTablePool( String tableName, HBaseConfiguration configuration )
+    public HBaseTablePool( String tableName, Configuration configuration )
     {
         this.tableName = tableName;
         this.configuration = configuration;

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedCursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedCursorBuilder.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedCursorBuilder.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedCursorBuilder.java Fri Nov  5 22:15:23 2010
@@ -20,12 +20,12 @@
 package org.apache.directory.server.core.partition.hbase.xdbmext;
 
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.impl.CursorBuilder;
 import org.apache.directory.server.xdbm.search.impl.OneLevelScopeEvaluator;
 import org.apache.directory.server.xdbm.search.impl.SubtreeScopeEvaluator;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.AssertionType;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -39,10 +39,10 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 659774 $
  */
-public class ExtendedCursorBuilder<ID> extends CursorBuilder<ID>
+public class ExtendedCursorBuilder<ID extends Comparable<ID>> extends CursorBuilder<ID>
 {
     /** The database used by this builder */
-    private Store<ServerEntry, ID> db = null;
+    private Store<Entry, ID> db = null;
 
     /** Evaluator dependency on a EvaluatorBuilder */
     private ExtendedEvaluatorBuilder<ID> evaluatorBuilder;
@@ -54,7 +54,7 @@ public class ExtendedCursorBuilder<ID> e
      * @param db database used by this enumerator
      * @param evaluatorBuilder the evaluator builder
      */
-    public ExtendedCursorBuilder( Store<ServerEntry, ID> db, ExtendedEvaluatorBuilder<ID> evaluatorBuilder )
+    public ExtendedCursorBuilder( Store<Entry, ID> db, ExtendedEvaluatorBuilder<ID> evaluatorBuilder )
     {
         super( db, evaluatorBuilder );
         this.db = db;
@@ -62,7 +62,7 @@ public class ExtendedCursorBuilder<ID> e
     }
 
 
-    public IndexCursor<?, ServerEntry, ID> build( ExprNode node ) throws Exception
+    public IndexCursor<?, Entry, ID> build( ExprNode node ) throws Exception
     {
         // set the "real" filter node as annotation to the scope node
         if ( node.getAssertionType() == AssertionType.AND )
@@ -84,12 +84,12 @@ public class ExtendedCursorBuilder<ID> e
 
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
-                    return new ExtendedOneLevelScopeCursor<ID>( db, filter, ( OneLevelScopeEvaluator<ServerEntry, ID> ) evaluatorBuilder
+                    return new ExtendedOneLevelScopeCursor<ID>( db, filter, ( OneLevelScopeEvaluator<Entry, ID> ) evaluatorBuilder
                         .build( node ) );
                 }
                 else
                 {
-                    return new ExtendedSubtreeScopeCursor<ID>( db, filter, ( SubtreeScopeEvaluator<ServerEntry, ID> ) evaluatorBuilder
+                    return new ExtendedSubtreeScopeCursor<ID>( db, filter, ( SubtreeScopeEvaluator<Entry, ID> ) evaluatorBuilder
                         .build( node ) );
                 }
 

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedEvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedEvaluatorBuilder.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedEvaluatorBuilder.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedEvaluatorBuilder.java Fri Nov  5 22:15:23 2010
@@ -20,10 +20,10 @@
 package org.apache.directory.server.core.partition.hbase.xdbmext;
 
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.server.xdbm.search.impl.EvaluatorBuilder;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.AssertionType;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
@@ -36,9 +36,9 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 659774 $
  */
-public class ExtendedEvaluatorBuilder<ID> extends EvaluatorBuilder<ID>
+public class ExtendedEvaluatorBuilder<ID extends Comparable<ID>> extends EvaluatorBuilder<ID>
 {
-    private final Store<ServerEntry, ID> db;
+    private final Store<Entry, ID> db;
     private final SchemaManager schemaManager;
 
 
@@ -50,7 +50,7 @@ public class ExtendedEvaluatorBuilder<ID
      * @param registries the schema registries
      * @throws Exception failure to access db or lookup schema in registries
      */
-    public ExtendedEvaluatorBuilder( Store<ServerEntry, ID> db, SchemaManager schemaManager ) throws Exception
+    public ExtendedEvaluatorBuilder( Store<Entry, ID> db, SchemaManager schemaManager ) throws Exception
     {
         super( db, schemaManager );
         this.db = db;
@@ -58,7 +58,7 @@ public class ExtendedEvaluatorBuilder<ID
     }
 
 
-    public Evaluator<? extends ExprNode, ServerEntry, ID> build( ExprNode node ) throws Exception
+    public Evaluator<? extends ExprNode, Entry, ID> build( ExprNode node ) throws Exception
     {
         if ( node.getAssertionType() == AssertionType.SUBSTRING )
         {

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOneLevelScopeCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOneLevelScopeCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOneLevelScopeCursor.java Fri Nov  5 22:15:23 2010
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.partition.hbase.xdbmext;
 
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.AbstractIndexCursor;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexCursor;
@@ -29,6 +28,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.search.impl.OneLevelScopeEvaluator;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 
 
@@ -39,25 +39,25 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ExtendedOneLevelScopeCursor<ID> extends AbstractIndexCursor<ID, ServerEntry, ID>
+public class ExtendedOneLevelScopeCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<ID, Entry, ID>
 {
     /** Error message for unsupported operations */
     private static final String UNSUPPORTED_MSG = "Scope Cursors are not ordered and do not support positioning by element.";
 
     /** The entry database/store */
-    private final Store<ServerEntry, ID> db;
+    private final Store<Entry, ID> db;
 
     /** A onelevel ScopeNode Evaluator */
-    private final OneLevelScopeEvaluator<ServerEntry, ID> evaluator;
+    private final OneLevelScopeEvaluator<Entry, ID> evaluator;
 
     /** A Cursor over the entries in the scope of the search base */
-    private final IndexCursor<ID, ServerEntry, ID> scopeCursor;
+    private final IndexCursor<ID, Entry, ID> scopeCursor;
 
     /** A Cursor over entries brought into scope by alias dereferencing */
-    private final Cursor<IndexEntry<ID, ServerEntry, ID>> dereferencedCursor;
+    private final Cursor<IndexEntry<ID, Entry, ID>> dereferencedCursor;
 
     /** Currently active Cursor: we switch between two cursors */
-    private Cursor<IndexEntry<ID, ServerEntry, ID>> cursor;
+    private Cursor<IndexEntry<ID, Entry, ID>> cursor;
 
     /** Whether or not this Cursor is positioned so an entry is available */
     private boolean available = false;
@@ -71,16 +71,16 @@ public class ExtendedOneLevelScopeCursor
      * @param evaluator an IndexEntry (candidate) evaluator
      * @throws Exception on db access failures
      */
-    public ExtendedOneLevelScopeCursor( Store<ServerEntry, ID> db, ExprNode filter,
-        OneLevelScopeEvaluator<ServerEntry, ID> evaluator ) throws Exception
+    public ExtendedOneLevelScopeCursor( Store<Entry, ID> db, ExprNode filter,
+        OneLevelScopeEvaluator<Entry, ID> evaluator ) throws Exception
     {
         this.db = db;
         this.evaluator = evaluator;
 
-        Index<ID, ServerEntry, ID> oneLevelIndex = db.getOneLevelIndex();
+        Index<ID, Entry, ID> oneLevelIndex = db.getOneLevelIndex();
         if ( oneLevelIndex instanceof IndexFilteringExtension<?, ?, ?> )
         {
-            IndexFilteringExtension<ID, ServerEntry, ID> filteringIndex = ( IndexFilteringExtension<ID, ServerEntry, ID> ) oneLevelIndex;
+            IndexFilteringExtension<ID, Entry, ID> filteringIndex = ( IndexFilteringExtension<ID, Entry, ID> ) oneLevelIndex;
             scopeCursor = filteringIndex.forwardFilteringCursor( evaluator.getBaseId(), filter );
         }
         else
@@ -117,13 +117,13 @@ public class ExtendedOneLevelScopeCursor
     }
 
 
-    public void before( IndexEntry<ID, ServerEntry, ID> element ) throws Exception
+    public void before( IndexEntry<ID, Entry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<ID, ServerEntry, ID> element ) throws Exception
+    public void after( IndexEntry<ID, Entry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -301,7 +301,7 @@ public class ExtendedOneLevelScopeCursor
     }
 
 
-    public IndexEntry<ID, ServerEntry, ID> get() throws Exception
+    public IndexEntry<ID, Entry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( available )

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOptimizer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOptimizer.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOptimizer.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOptimizer.java Fri Nov  5 22:15:23 2010
@@ -33,7 +33,7 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 777037 $
  */
-public class ExtendedOptimizer<E, ID> extends DefaultOptimizer<E, ID>
+public class ExtendedOptimizer<E, ID extends Comparable<ID>> extends DefaultOptimizer<E, ID>
 {
     /** the database this optimizer operates on */
     private final Store<E, ID> db;
@@ -93,9 +93,9 @@ public class ExtendedOptimizer<E, ID> ex
 
     private long getSubstringScan( SubstringNode node ) throws Exception
     {
-        if ( db.hasUserIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttribute() ) )
         {
-            Index<?, E, ID> idx = db.getUserIndex( node.getAttribute() );
+            Index<?, E, ID> idx = db.getIndex( node.getAttribute() );
             if ( idx instanceof IndexSubstringExtension<?, ?, ?> )
             {
                 IndexSubstringExtension<?, E, ID> substringIdx = ( IndexSubstringExtension<?, E, ID> ) idx;

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringCursor.java Fri Nov  5 22:15:23 2010
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.partition.hbase.xdbmext;
 
 
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.AbstractIndexCursor;
 import org.apache.directory.server.xdbm.ForwardIndexEntry;
 import org.apache.directory.server.xdbm.Index;
@@ -28,6 +27,7 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.entry.Entry;
 
 
 /**
@@ -36,27 +36,27 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ExtendedSubstringCursor<ID> extends AbstractIndexCursor<String, ServerEntry, ID>
+public class ExtendedSubstringCursor<ID extends Comparable<ID>> extends AbstractIndexCursor<String, Entry, ID>
 {
     private static final String UNSUPPORTED_MSG = "SubstringCursors may not be ordered and do not support positioning by element.";
     private final boolean hasIndex;
-    private final IndexCursor<String, ServerEntry, ID> wrapped;
+    private final IndexCursor<String, Entry, ID> wrapped;
     private final ExtendedSubstringEvaluator<ID> evaluator;
-    private final ForwardIndexEntry<String, ServerEntry, ID> indexEntry = new ForwardIndexEntry<String, ServerEntry, ID>();
+    private final ForwardIndexEntry<String, Entry, ID> indexEntry = new ForwardIndexEntry<String, Entry, ID>();
     private boolean available = false;
 
 
     @SuppressWarnings("unchecked")
-    public ExtendedSubstringCursor( Store<ServerEntry, ID> db, final ExtendedSubstringEvaluator substringEvaluator )
+    public ExtendedSubstringCursor( Store<Entry, ID> db, final ExtendedSubstringEvaluator substringEvaluator )
         throws Exception
     {
         evaluator = substringEvaluator;
-        hasIndex = db.hasUserIndexOn( evaluator.getExpression().getAttribute() );
+        hasIndex = db.hasIndexOn( evaluator.getExpression().getAttribute() );
 
         if ( hasIndex )
         {
-            Index<String, ServerEntry, ID> idx = ( Index<String, ServerEntry, ID> ) db.getUserIndex( evaluator.getExpression()
-                .getAttribute() );
+            Index<String, Entry, ID> idx = ( Index<String, Entry, ID> ) db.getIndex( evaluator
+                .getExpression().getAttribute() );
             if ( idx instanceof IndexSubstringExtension<?, ?, ?> )
             {
                 wrapped = ( ( IndexSubstringExtension ) idx ).forwardSubstringCursor( evaluator.getExpression() );
@@ -105,13 +105,13 @@ public class ExtendedSubstringCursor<ID>
     }
 
 
-    public void before( IndexEntry<String, ServerEntry, ID> element ) throws Exception
+    public void before( IndexEntry<String, Entry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
 
 
-    public void after( IndexEntry<String, ServerEntry, ID> element ) throws Exception
+    public void after( IndexEntry<String, Entry, ID> element ) throws Exception
     {
         throw new UnsupportedOperationException( UNSUPPORTED_MSG );
     }
@@ -122,7 +122,7 @@ public class ExtendedSubstringCursor<ID>
         checkNotClosed( "beforeFirst()" );
         if ( evaluator.getExpression().getInitial() != null && hasIndex )
         {
-            ForwardIndexEntry<String, ServerEntry, ID> indexEntry = new ForwardIndexEntry<String, ServerEntry, ID>();
+            ForwardIndexEntry<String, Entry, ID> indexEntry = new ForwardIndexEntry<String, Entry, ID>();
             indexEntry.setValue( evaluator.getExpression().getInitial() );
             wrapped.before( indexEntry );
         }
@@ -163,7 +163,7 @@ public class ExtendedSubstringCursor<ID>
     }
 
 
-    private boolean evaluateCandidate( IndexEntry<String, ServerEntry, ID> indexEntry ) throws Exception
+    private boolean evaluateCandidate( IndexEntry<String, Entry, ID> indexEntry ) throws Exception
     {
         if ( hasIndex )
         {
@@ -188,7 +188,7 @@ public class ExtendedSubstringCursor<ID>
         while ( wrapped.previous() )
         {
             checkNotClosed( "previous()" );
-            IndexEntry<String, ServerEntry, ID> entry = wrapped.get();
+            IndexEntry<String, Entry, ID> entry = wrapped.get();
             if ( evaluateCandidate( entry ) )
             {
                 available = true;
@@ -209,7 +209,7 @@ public class ExtendedSubstringCursor<ID>
         while ( wrapped.next() )
         {
             checkNotClosed( "next()" );
-            IndexEntry<String, ServerEntry, ID> entry = wrapped.get();
+            IndexEntry<String, Entry, ID> entry = wrapped.get();
             if ( evaluateCandidate( entry ) )
             {
                 available = true;
@@ -225,7 +225,7 @@ public class ExtendedSubstringCursor<ID>
     }
 
 
-    public IndexEntry<String, ServerEntry, ID> get() throws Exception
+    public IndexEntry<String, Entry, ID> get() throws Exception
     {
         checkNotClosed( "get()" );
         if ( available )

Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringEvaluator.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringEvaluator.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringEvaluator.java Fri Nov  5 22:15:23 2010
@@ -23,13 +23,13 @@ package org.apache.directory.server.core
 import java.util.Iterator;
 import java.util.regex.Pattern;
 
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -45,10 +45,10 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 764131 $
  */
-public class ExtendedSubstringEvaluator<ID> implements Evaluator<SubstringNode, ServerEntry, ID>
+public class ExtendedSubstringEvaluator<ID extends Comparable<ID>> implements Evaluator<SubstringNode, Entry, ID>
 {
     /** Database used while evaluating candidates */
-    private final Store<ServerEntry, ID> db;
+    private final Store<Entry, ID> db;
 
     /** Schema manager used to translate attributeIds to OIDs */
     private final SchemaManager schemaManager;
@@ -63,7 +63,7 @@ public class ExtendedSubstringEvaluator<
 
     private final Normalizer normalizer;
 
-    private final Index<String, ServerEntry, ID> idx;
+    private final Index<String, Entry, ID> idx;
 
 
     /**
@@ -74,7 +74,7 @@ public class ExtendedSubstringEvaluator<
      * @param registries the set of registries
      * @throws Exception if there are failures accessing resources and the db
      */
-    public ExtendedSubstringEvaluator( SubstringNode node, Store<ServerEntry, ID> db, SchemaManager schemaManager )
+    public ExtendedSubstringEvaluator( SubstringNode node, Store<Entry, ID> db, SchemaManager schemaManager )
         throws Exception
     {
         this.db = db;
@@ -103,10 +103,10 @@ public class ExtendedSubstringEvaluator<
         // compile the regular expression to search for a matching attribute
         regex = node.getRegex( normalizer );
 
-        if ( db.hasUserIndexOn( node.getAttribute() ) )
+        if ( db.hasIndexOn( node.getAttribute() ) )
         {
             //noinspection unchecked
-            idx = ( Index<String, ServerEntry, ID> ) db.getUserIndex( node.getAttribute() );
+            idx = ( Index<String, Entry, ID> ) db.getIndex( node.getAttribute() );
         }
         else
         {
@@ -115,13 +115,13 @@ public class ExtendedSubstringEvaluator<
     }
 
 
-    public boolean evaluate( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
+    public boolean evaluate( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
     {
 
         if ( idx == null || indexEntry.getObject() != null )
         {
             //noinspection unchecked
-            return evaluateWithoutIndex( ( IndexEntry<String, ServerEntry, ID> ) indexEntry );
+            return evaluateWithoutIndex( ( IndexEntry<String, Entry, ID> ) indexEntry );
         }
         else
         {
@@ -145,7 +145,7 @@ public class ExtendedSubstringEvaluator<
     }
 
 
-    public boolean evaluateEntry( ServerEntry entry ) throws Exception
+    public boolean evaluateEntry( Entry entry ) throws Exception
     {
 
         if ( idx == null )
@@ -172,7 +172,7 @@ public class ExtendedSubstringEvaluator<
     }
 
 
-    private boolean evaluateWithIndex( IndexEntry<?, ServerEntry, ID> indexEntry ) throws Exception
+    private boolean evaluateWithIndex( IndexEntry<?, Entry, ID> indexEntry ) throws Exception
     {
         /*
          * Note that this is using the reverse half of the index giving a
@@ -180,12 +180,12 @@ public class ExtendedSubstringEvaluator<
          * Otherwise we would have to scan the entire index if there were
          * no reverse lookups.
          */
-        Cursor<IndexEntry<String, ServerEntry, ID>> entries = idx.reverseCursor( indexEntry.getId() );
+        Cursor<IndexEntry<String, Entry, ID>> entries = idx.reverseCursor( indexEntry.getId() );
 
         // cycle through the attribute values testing for a match
         while ( entries.next() )
         {
-            IndexEntry<String, ServerEntry, ID> rec = entries.get();
+            IndexEntry<String, Entry, ID> rec = entries.get();
 
             // once match is found cleanup and return true
             if ( regex.matcher( rec.getValue() ).matches() )
@@ -200,9 +200,9 @@ public class ExtendedSubstringEvaluator<
     }
 
 
-    private boolean evaluateWithIndex( ServerEntry entry ) throws Exception
+    private boolean evaluateWithIndex( Entry entry ) throws Exception
     {
-        throw new UnsupportedOperationException( "This is too inefficient without getId() on ServerEntry" );
+        throw new UnsupportedOperationException( "This is too inefficient without getId() on Entry" );
     }
 
 
@@ -214,12 +214,12 @@ public class ExtendedSubstringEvaluator<
          * Otherwise we would have to scan the entire index if there were
          * no reverse lookups.
          */
-        Cursor<IndexEntry<String, ServerEntry, ID>> entries = idx.reverseCursor( id );
+        Cursor<IndexEntry<String, Entry, ID>> entries = idx.reverseCursor( id );
 
         // cycle through the attribute values testing for a match
         while ( entries.next() )
         {
-            IndexEntry<String, ServerEntry, ID> rec = entries.get();
+            IndexEntry<String, Entry, ID> rec = entries.get();
 
             // once match is found cleanup and return true
             if ( regex.matcher( rec.getValue() ).matches() )
@@ -244,10 +244,10 @@ public class ExtendedSubstringEvaluator<
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluateWithoutIndex( ServerEntry entry ) throws Exception
+    private boolean evaluateWithoutIndex( Entry entry ) throws Exception
     {
         // get the attribute
-        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute exists and the pattern matches return true
         if ( attr != null )
@@ -288,7 +288,7 @@ public class ExtendedSubstringEvaluator<
             {
                 AttributeType descendant = descendants.next();
 
-                attr = ( ServerAttribute ) entry.get( descendant );
+                attr = entry.get( descendant );
 
                 if ( null != attr )
                 {
@@ -321,9 +321,9 @@ public class ExtendedSubstringEvaluator<
 
     // TODO - determine if comaparator and index entry should have the Value
     // wrapper or the raw normalized value
-    private boolean evaluateWithoutIndex( IndexEntry<String, ServerEntry, ID> indexEntry ) throws Exception
+    private boolean evaluateWithoutIndex( IndexEntry<String, Entry, ID> indexEntry ) throws Exception
     {
-        ServerEntry entry = indexEntry.getObject();
+        Entry entry = indexEntry.getObject();
 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
@@ -333,13 +333,13 @@ public class ExtendedSubstringEvaluator<
         }
 
         /*
-         * Don't make a call here to evaluateWithoutIndex( ServerEntry ) for
+         * Don't make a call here to evaluateWithoutIndex( Entry ) for
          * code reuse since we do want to set the value on the indexEntry on
          * matches.
          */
 
         // get the attribute
-        ServerAttribute attr = ( ServerAttribute ) entry.get( type );
+        EntryAttribute attr = entry.get( type );
 
         // if the attribute exists and the pattern matches return true
         if ( attr != null )
@@ -382,7 +382,7 @@ public class ExtendedSubstringEvaluator<
             {
                 AttributeType descendant = descendants.next();
 
-                attr = ( ServerAttribute ) entry.get( descendant );
+                attr = entry.get( descendant );
 
                 if ( null != attr )
                 {



Mime
View raw message