directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r902620 [1/6] - in /directory/sandbox/seelmann/hbase-partition: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/server/ src/main/java/org/a...
Date Sun, 24 Jan 2010 19:04:39 GMT
Author: seelmann
Date: Sun Jan 24 19:04:37 2010
New Revision: 902620

URL: http://svn.apache.org/viewvc?rev=902620&view=rev
Log:
Initial import of HBase partition

Added:
    directory/sandbox/seelmann/hbase-partition/pom.xml
    directory/sandbox/seelmann/hbase-partition/src/
    directory/sandbox/seelmann/hbase-partition/src/main/
    directory/sandbox/seelmann/hbase-partition/src/main/java/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Cache.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBasePartition.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Utils.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseNdnIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseSubLevelIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexReverseCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/AbstractHBaseIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseAliasIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseNdnIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneAliasIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneLevelIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBasePresenceIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseSubLevelIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserColumnIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseUserRowIndex.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexMapper.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/RowCounterMapper.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/SimpleMapper.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseColumnIndexTable.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTable.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseIndexTableBase.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTable.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBasePresenceIndexTable.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseRowIndexTable.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/table/HBaseTableHelper.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedCursorBuilder.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedEvaluatorBuilder.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOneLevelScopeCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedOptimizer.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubstringEvaluator.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/ExtendedSubtreeScopeCursor.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/IndexFilteringExtension.java
    directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/xdbmext/IndexSubstringExtension.java
    directory/sandbox/seelmann/hbase-partition/src/main/resources/
    directory/sandbox/seelmann/hbase-partition/src/test/
    directory/sandbox/seelmann/hbase-partition/src/test/java/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseClusterTestCaseAdapter.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/HBaseRunner.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/JdbmRunner.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/AbstractHBasePartitionIT.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionIT.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBasePartitionPerformanceIT.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/it/HBaseRunner.java
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/
    directory/sandbox/seelmann/hbase-partition/src/test/java/org/apache/directory/server/core/partition/hbase/table/HBaseMasterTableTest.java
    directory/sandbox/seelmann/hbase-partition/src/test/resources/
    directory/sandbox/seelmann/hbase-partition/src/test/resources/hbase-site.xml
    directory/sandbox/seelmann/hbase-partition/src/test/resources/log4j.properties
    directory/sandbox/seelmann/hbase-partition/src/test/resources/mapred-site.xml
Modified:
    directory/sandbox/seelmann/hbase-partition/   (props changed)

Propchange: directory/sandbox/seelmann/hbase-partition/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan 24 19:04:37 2010
@@ -0,0 +1,6 @@
+build
+target
+test
+.classpath
+.project
+.settings

Added: directory/sandbox/seelmann/hbase-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/pom.xml?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/pom.xml (added)
+++ directory/sandbox/seelmann/hbase-partition/pom.xml Sun Jan 24 19:04:37 2010
@@ -0,0 +1,269 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+  <!--
+    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.
+  -->
+
+<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.6-SNAPSHOT</version>
+  </parent>
+  <artifactId>apacheds-hbase-partition</artifactId>
+  <name>ApacheDS HBase Partition</name>
+  <packaging>jar</packaging>
+
+  <description>
+        A partition (based on XDBM) that stores entries and indices in an Apache Hadoop HBase database.
+  </description>
+
+  <dependencies>
+
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>3.2.1</version>
+    </dependency>
+    
+    <!-- Dependencies to ApacheDS, for partition implementation -->
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>apacheds-core</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>apacheds-xdbm-base</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>apacheds-xdbm-search</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <!-- ApacheDS integration test framework -->
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-server-integ</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- HBase dependencies -->
+    <!-- 
+      Unfortunately HBase artifacts are not yet available in public maven repo.
+      So I created a private repo under p.a.o/~seelmann and use groupId 
+      "org.apache.directory.hbase" to avoid conflicts.
+    -->
+    <dependency>
+      <groupId>org.apache.directory.hbase</groupId>
+      <artifactId>hbase</artifactId>
+      <version>0.20.3-RC3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.hbase</groupId>
+      <artifactId>hadoop-core</artifactId>
+      <version>0.20.1-hdfs127</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    
+    <!-- HBase test dependencies -->
+    <!-- 
+      Unfortunately HBase artifacts are not yet available in public maven repo.
+      So I created a private repo under p.a.o/~seelmann and use groupId 
+      "org.apache.directory.hbase" to avoid conflicts.
+    -->
+    <dependency>
+      <groupId>org.apache.directory.hbase</groupId>
+      <artifactId>hadoop-test</artifactId>
+      <version>0.20.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.hbase</groupId>
+      <artifactId>hbase-test</artifactId>
+      <version>0.20.3-RC3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.directory.hbase</groupId>
+      <artifactId>zookeeper</artifactId>
+      <version>3.2.2</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- HBase transitive test depencencies -->
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <version>3.0.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <version>1.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <version>6.1.14</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/*IT.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <!-- Delete build and test directories that were crated by hbase tests -->
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>build</directory>
+            </fileset>            
+            <fileset>
+              <directory>test</directory>
+            </fileset>            
+          </filesets>
+        </configuration>
+      </plugin>
+      
+      <!-- Install hadoop hbase artifacts, they are not available in maven repo -->
+      <!-- 
+      <plugin>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>2.3</version>
+        <executions>
+          <execution>
+            <id>install-hadoop-core</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <configuration>
+              <file>lib/hadoop-0.20.1-hdfs127-core.jar</file>
+              <localRepositoryPath>repo</localRepositoryPath>
+              <groupId>org.apache.directory.hbase</groupId>
+              <artifactId>hadoop-core</artifactId>
+              <version>0.20.1-hdfs127</version>
+              <packaging>jar</packaging>
+            </configuration>
+          </execution>
+          <execution>
+            <id>install-hadoop-test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <configuration>
+              <file>lib/hadoop-0.20.1-test.jar</file>
+              <localRepositoryPath>repo</localRepositoryPath>
+              <groupId>org.apache.directory.hbase</groupId>
+              <artifactId>hadoop-test</artifactId>
+              <version>0.20.1</version>
+              <packaging>jar</packaging>
+            </configuration>
+          </execution>
+          <execution>
+            <id>install-hbase</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <configuration>
+              <file>lib/hbase-0.20.3-RC3.jar</file>
+              <localRepositoryPath>repo</localRepositoryPath>
+              <groupId>org.apache.directory.hbase</groupId>
+              <artifactId>hbase</artifactId>
+              <version>0.20.3-RC3</version>
+              <packaging>jar</packaging>
+            </configuration>
+          </execution>
+          <execution>
+            <id>install-hbase-test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <configuration>
+              <file>lib/hbase-0.20.3-RC3-test.jar</file>
+              <localRepositoryPath>repo</localRepositoryPath>
+              <groupId>org.apache.directory.hbase</groupId>
+              <artifactId>hbase-test</artifactId>
+              <version>0.20.3-RC3</version>
+              <packaging>jar</packaging>
+            </configuration>
+          </execution>
+          <execution>
+            <id>install-zookeeper</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <configuration>
+              <file>lib/zookeeper-3.2.2.jar</file>
+              <localRepositoryPath>repo</localRepositoryPath>
+              <groupId>org.apache.directory.hbase</groupId>
+              <artifactId>zookeeper</artifactId>
+              <version>3.2.2</version>
+              <packaging>jar</packaging>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+       -->
+    </plugins>
+  </build>
+
+  <repositories>
+    <!-- 
+      Unfortunately HBase artifacts are not yet available in public maven repo.
+      So I created a private repo under p.a.o/~seelmann and use groupId 
+      "org.apache.directory.hbase" to avoid conflicts.
+    -->  
+    <repository>
+        <id>hbase-partition-private-repository</id>
+        <url>http://people.apache.org/~seelmann/hbase-partition/repository</url>
+        <snapshots>
+          <enabled>false</enabled>
+        </snapshots>
+     </repository>
+  </repositories>
+
+</project>
+
+

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Cache.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Cache.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Cache.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Cache.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,142 @@
+/*
+ *   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;
+
+
+import org.apache.commons.collections.map.LRUMap;
+
+
+/**
+ * A simple LRU cache with TTL.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Cache<K, V>
+{
+    private int ttl;
+    private LRUMap map;
+
+
+    /**
+     * Creates a new instance of Cache with size 100 and an TTL of 60 seconds.
+     */
+    public Cache()
+    {
+        this( 100, 60 * 1000 );
+    }
+
+
+    /**
+     * Creates a new instance of Cache.
+     *
+     * @param size the cache size
+     * @param ttl time to live in milliseconds
+     */
+    public Cache( int size, int ttl )
+    {
+        this.ttl = ttl;
+        this.map = new LRUMap( size );
+    }
+
+
+    /**
+     * Adds a value to the cache, removes the key if value is null.
+     * 
+     * @param key the key
+     * @param value the value
+     */
+    public synchronized void put( K key, V value )
+    {
+        if ( value == null )
+        {
+            map.remove( key );
+        }
+        else
+        {
+            map.put( key, new Entry( value ) );
+        }
+    }
+
+
+    /**
+     * Checks if the key is contained in this cache.
+     * 
+     * @param key the key
+     * 
+     * @return true, if the key is contained in the cache
+     */
+    public synchronized boolean contains( K key )
+    {
+        return get( key ) != null;
+    }
+
+
+    /**
+     * Gets the value.
+     * 
+     * @param key the key
+     * 
+     * @return the value
+     */
+    public synchronized V get( K key )
+    {
+        Entry entry = ( Entry ) map.get( key );
+        if ( entry != null )
+        {
+            if ( entry.timestamp + ttl > System.currentTimeMillis() )
+            {
+                return entry.value;
+            }
+            else
+            {
+                map.remove( key );
+                return null;
+            }
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * Clears the cache.
+     */
+    public synchronized void clear()
+    {
+        map.clear();
+    }
+
+    private class Entry
+    {
+        private V value;
+        private long timestamp;
+
+
+        public Entry( V value )
+        {
+            this.value = value;
+            this.timestamp = System.currentTimeMillis();
+        }
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBasePartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBasePartition.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBasePartition.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBasePartition.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,81 @@
+/*
+ *   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;
+
+
+import java.util.Map;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.hbase.xdbmext.ExtendedCursorBuilder;
+import org.apache.directory.server.core.partition.hbase.xdbmext.ExtendedEvaluatorBuilder;
+import org.apache.directory.server.core.partition.hbase.xdbmext.ExtendedOptimizer;
+import org.apache.directory.server.xdbm.AbstractXdbmPartition;
+import org.apache.directory.server.xdbm.search.impl.DefaultSearchEngine;
+import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
+
+
+/**
+ * A {@link Partition} that stores entries in
+ * <a href="http://hadoop.apache.org/hbase/">Hadoop HBase</a> database.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HBasePartition extends AbstractXdbmPartition
+{
+
+    /**
+     * Creates a new instance of HBasePartition.
+     */
+    public HBasePartition()
+    {
+        super( new HBaseStore() );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // L I F E C Y C L E   M E T H O D S
+    // ------------------------------------------------------------------------
+
+    /**
+     * {@inheritDoc}
+     */
+    public void initialize() throws Exception
+    {
+        Map<String, OidNormalizer> oidsMap = schemaManager.getAttributeTypeRegistry().getNormalizerMapping();
+        this.suffix.normalize( oidsMap );
+
+        // setup optimizer and search engine
+        ExtendedEvaluatorBuilder evaluatorBuilder = new ExtendedEvaluatorBuilder( store, schemaManager );
+        ExtendedCursorBuilder cursorBuilder = new ExtendedCursorBuilder( store, evaluatorBuilder );
+        optimizer = new ExtendedOptimizer<ServerEntry>( store, cursorBuilder, evaluatorBuilder );
+        searchEngine = new DefaultSearchEngine( store, cursorBuilder, evaluatorBuilder, optimizer );
+
+        // initialize the store
+        store.setSuffixDn( getSuffixDn().normalize( oidsMap ).getNormName() );
+        store.setCacheSize( cacheSize );
+        store.setName( id );
+        ( ( HBaseStore ) store ).setTablePrefix( "apacheds" + "_" + id + "_" );
+
+        store.init( schemaManager );
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,747 @@
+/*
+ *   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;
+
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.partition.hbase.index.HBaseAliasIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseNdnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseOneAliasIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseOneLevelIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBasePresenceIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseSubLevelIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserColumnIndex;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
+import org.apache.directory.server.core.partition.hbase.table.HBaseColumnIndexTable;
+import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
+import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
+import org.apache.directory.server.core.partition.hbase.table.HBasePresenceIndexTable;
+import org.apache.directory.server.core.partition.hbase.table.HBaseRowIndexTable;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.IndexNotFoundException;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.RDN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
+
+
+/**
+ * The {@link Store} implementation of the {@link HBasePartition}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HBaseStore implements Store<ServerEntry>
+{
+
+    private String tablePrefix;
+
+    private LdapDN suffixDn;
+    private String suffix;
+    private String name;
+    private int cacheSize;
+    private SchemaManager schemaManager;
+    // private String id;
+
+    private HBaseMasterTable masterTable;
+    private Map<String, HBaseIndexTable> indexTables = new HashMap<String, HBaseIndexTable>();
+    private Map<String, HBasePresenceIndexTable> presenceIndexTables = new HashMap<String, HBasePresenceIndexTable>();
+
+    private Map<String, Index<?, ServerEntry>> userIndices = new HashMap<String, Index<?, ServerEntry>>();
+
+    private HBaseNdnIndex ndnIndex;
+    private HBaseOneLevelIndex oneLevelIndex;
+    private HBaseSubLevelIndex subLevelIndex;
+    private Index<String, ServerEntry> aliasIndex;
+    private Index<Long, ServerEntry> oneAliasIndex;
+    private Index<Long, ServerEntry> subAliasIndex;
+
+
+    public void init( SchemaManager schemaManager ) throws Exception
+    {
+        this.schemaManager = schemaManager;
+        this.suffixDn = new LdapDN( suffix )
+            .normalize( schemaManager.getAttributeTypeRegistry().getNormalizerMapping() );
+
+        // TODO: make indexed attributes configurable
+        String[] userIndexAttributes =
+            { "objectClass", "dc", "o", "ou", "cn", "uid", "entryCSN" };
+        for ( String userIndexAttribute : userIndexAttributes )
+        {
+            String oid = schemaManager.getAttributeTypeRegistry().getOidByName( userIndexAttribute );
+            // TODO: make configurable
+            if ( oid.equals( SchemaConstants.CN_AT_OID ) || oid.equals( SchemaConstants.UID_AT_OID ) )
+            {
+                userIndices.put( oid, new HBaseUserColumnIndex( oid, ( HBaseColumnIndexTable ) getIndexTable( oid ),
+                    this ) );
+            }
+            else
+            {
+                userIndices.put( oid, new HBaseUserRowIndex( oid, ( HBaseRowIndexTable ) getIndexTable( oid ), this ) );
+            }
+        }
+
+        ndnIndex = new HBaseNdnIndex( this );
+        oneLevelIndex = new HBaseOneLevelIndex( this );
+        subLevelIndex = new HBaseSubLevelIndex( this );
+
+        // TODO: implement alias
+        aliasIndex = new HBaseAliasIndex();
+        oneAliasIndex = new HBaseOneAliasIndex();
+        subAliasIndex = new HBaseOneAliasIndex();
+    }
+
+
+    public void destroy() throws Exception
+    {
+        if ( masterTable != null )
+        {
+            masterTable.destroy();
+            masterTable = null;
+        }
+        if ( indexTables != null )
+        {
+            for ( HBaseIndexTable indexTable : indexTables.values() )
+            {
+                indexTable.destroy();
+            }
+            indexTables.clear();
+            indexTables = null;
+        }
+        if ( presenceIndexTables != null )
+        {
+            for ( HBasePresenceIndexTable presenceIndexTable : presenceIndexTables.values() )
+            {
+                presenceIndexTable.destroy();
+            }
+            presenceIndexTables.clear();
+            presenceIndexTables = null;
+        }
+        schemaManager = null;
+    }
+
+
+    public void add( ServerEntry entry ) throws Exception
+    {
+        // write master and dn2id table
+        Long id = getMasterTable().add( entry );
+
+        // write index tables
+        for ( EntryAttribute attribute : entry )
+        {
+            String attr = attribute.getId();
+            String oid = getAttributeTypeOid( attr );
+            if ( userIndices.containsKey( oid ) )
+            {
+                getIndexTable( oid ).add( attribute, id );
+                getPresenceIndexTable( oid ).add( id );
+            }
+        }
+    }
+
+
+    public HBaseMasterTable getMasterTable() throws Exception
+    {
+        if ( masterTable == null )
+        {
+            masterTable = new HBaseMasterTable( getSchemaManager(), getSuffix(), getTablePrefix() );
+        }
+        return masterTable;
+    }
+
+
+    public HBaseIndexTable getIndexTable( String attributeTypeOid ) throws Exception
+    {
+        if ( indexTables.containsKey( attributeTypeOid ) )
+        {
+            return indexTables.get( attributeTypeOid );
+        }
+        else
+        {
+            HBaseIndexTable indexTable;
+            // TODO: make configurable
+            if ( attributeTypeOid.equals( SchemaConstants.CN_AT_OID )
+                || attributeTypeOid.equals( SchemaConstants.UID_AT_OID ) )
+            {
+                indexTable = new HBaseColumnIndexTable( attributeTypeOid, schemaManager, tablePrefix );
+            }
+            else
+            {
+                indexTable = new HBaseRowIndexTable( attributeTypeOid, schemaManager, tablePrefix );
+            }
+            indexTables.put( attributeTypeOid, indexTable );
+            return indexTable;
+        }
+    }
+
+
+    public HBasePresenceIndexTable getPresenceIndexTable( String attributeTypeOid ) throws Exception
+    {
+        if ( presenceIndexTables.containsKey( attributeTypeOid ) )
+        {
+            return presenceIndexTables.get( attributeTypeOid );
+        }
+        else
+        {
+            HBasePresenceIndexTable presenceIndexTable = new HBasePresenceIndexTable( attributeTypeOid, schemaManager,
+                tablePrefix );
+            presenceIndexTables.put( attributeTypeOid, presenceIndexTable );
+            return presenceIndexTable;
+        }
+    }
+
+
+    public Long getEntryId( String dn ) throws Exception
+    {
+        //System.out.println(System.currentTimeMillis() + " getEntryId() dn=" + dn);
+        // TODO: is dn already normalized?
+        LdapDN normDn = new LdapDN( dn ).normalize( schemaManager.getAttributeTypeRegistry().getNormalizerMapping() );
+        Long id = getMasterTable().fetchId( normDn );
+        return id;
+    }
+
+
+    public ServerEntry lookup( Long id ) throws Exception
+    {
+        //System.out.println(System.currentTimeMillis() + " lookup() id=" + id);
+        ServerEntry entry = getMasterTable().fetchEntry( id );
+        //System.out.println("  --> " + entry.getDn());
+        return entry;
+    }
+
+
+    public void addIndex( Index<?, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public int count() throws Exception
+    {
+        // we use the sub level count of the context entry
+        return getSubLevelIndex().count( getEntryId( getSuffixDn() ) );
+    }
+
+
+    public void delete( Long id ) throws Exception
+    {
+        ServerEntry entry = lookup( id );
+
+        // write index tables
+        for ( EntryAttribute attribute : entry )
+        {
+            String attr = attribute.getId();
+            String oid = getAttributeTypeOid( attr );
+            if ( userIndices.containsKey( oid ) )
+            {
+                getIndexTable( oid ).delete( attribute, id );
+                getPresenceIndexTable( oid ).delete( id );
+            }
+        }
+
+        // write master and id2dn table
+        getMasterTable().delete( id, entry );
+    }
+
+
+    public Index<String, ServerEntry> getAliasIndex()
+    {
+        return aliasIndex;
+    }
+
+
+    public int getCacheSize()
+    {
+        return cacheSize;
+    }
+
+
+    public int getChildCount( Long id ) throws Exception
+    {
+        return oneLevelIndex.count( id );
+    }
+
+
+    public Index<String, ServerEntry> getEntryCsnIndex()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public String getEntryDn( Long arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public String getEntryUpdn( Long arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public String getEntryUpdn( String arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Index<String, ServerEntry> getEntryUuidIndex()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public Index<String, ServerEntry> getNdnIndex()
+    {
+        return ndnIndex;
+    }
+
+
+    public Index<String, ServerEntry> getObjectClassIndex()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Index<Long, ServerEntry> getOneAliasIndex()
+    {
+        return oneAliasIndex;
+    }
+
+
+    public Index<Long, ServerEntry> getOneLevelIndex()
+    {
+        return oneLevelIndex;
+    }
+
+
+    public Long getParentId( String arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Long getParentId( Long arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Index<String, ServerEntry> getPresenceIndex()
+    {
+        return new HBasePresenceIndex( this );
+    }
+
+
+    public String getProperty( String arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Index<Long, ServerEntry> getSubAliasIndex()
+    {
+        return subAliasIndex;
+    }
+
+
+    public Index<Long, ServerEntry> getSubLevelIndex()
+    {
+        return subLevelIndex;
+    }
+
+
+    public LdapDN getSuffix()
+    {
+        return suffixDn;
+    }
+
+
+    public String getSuffixDn()
+    {
+        return suffix;
+    }
+
+
+    public Index<?, ServerEntry> getSystemIndex( String arg0 ) throws IndexNotFoundException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public LdapDN getUpSuffix()
+    {
+        return suffixDn;
+    }
+
+
+    public Index<String, ServerEntry> getUpdnIndex()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Index<?, ServerEntry> getUserIndex( String id ) throws IndexNotFoundException
+    {
+        id = getAttributeTypeOid( id );
+
+        if ( userIndices.containsKey( id ) )
+        {
+            return userIndices.get( id );
+        }
+
+        throw new IndexNotFoundException( "A user index on attribute " + id + " (" + name + ") does not exist!" );
+    }
+
+
+    private String getAttributeTypeOid( String oid ) throws IndexNotFoundException
+    {
+        try
+        {
+            return schemaManager.getAttributeTypeRegistry().getOidByName( oid );
+        }
+        catch ( NamingException e )
+        {
+            throw new IndexNotFoundException( "Failed to identify OID for: " + oid, oid, e );
+        }
+    }
+
+
+    public Set<Index<?, ServerEntry>> getUserIndices()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public File getWorkingDirectory()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public boolean hasSystemIndexOn( String id ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public boolean hasUserIndexOn( String id ) throws Exception
+    {
+        return userIndices.containsKey( schemaManager.getAttributeTypeRegistry().getOidByName( id ) );
+    }
+
+
+    public boolean isInitialized()
+    {
+        return schemaManager != null;
+    }
+
+
+    public boolean isSyncOnWrite()
+    {
+        return true;
+    }
+
+
+    public IndexCursor<Long, ServerEntry> list( Long key ) throws Exception
+    {
+        return getOneLevelIndex().forwardCursor( key );
+    }
+
+
+    public void modify( LdapDN dn, List<Modification> mods ) throws Exception
+    {
+        Long id = getEntryId( dn.getNormName() );
+        ServerEntry entry = lookup( id );
+        //System.out.println("before modify: " + entry);
+
+        // TODO: quick and dirty implementation to update the indices
+        // remove old indices
+        for ( EntryAttribute attribute : entry )
+        {
+            String attr = attribute.getId();
+            String oid = getAttributeTypeOid( attr );
+            if ( userIndices.containsKey( oid ) )
+            {
+                getIndexTable( oid ).delete( attribute, id );
+                getPresenceIndexTable( oid ).delete( id );
+            }
+        }
+
+        // apply modifications
+        for ( Modification mod : mods )
+        {
+            ServerAttribute modAttr = ( ServerAttribute ) mod.getAttribute();
+            AttributeType modType = modAttr.getAttributeType();
+            EntryAttribute entryAttr = entry.get( modType );
+
+            switch ( mod.getOperation() )
+            {
+                case ADD_ATTRIBUTE:
+                    for ( Value<?> value : modAttr )
+                    {
+                        entry.add( modType, value );
+                    }
+                    break;
+
+                case REMOVE_ATTRIBUTE:
+                    if ( modAttr.size() == 0 )
+                    {
+                        entry.removeAttributes( modType );
+                    }
+                    else
+                    {
+                        for ( Value<?> value : modAttr )
+                        {
+                            entryAttr.remove( value );
+                        }
+                        if ( entryAttr.size() == 0 )
+                        {
+                            entry.removeAttributes( modType );
+                        }
+                    }
+                    break;
+
+                case REPLACE_ATTRIBUTE:
+                    if ( modAttr.size() == 0 )
+                    {
+                        entry.removeAttributes( modType );
+                    }
+                    else
+                    {
+                        entry.put( modAttr );
+                    }
+                    break;
+
+                default:
+                    throw new NamingException( "Unidentified modification operation" );
+            }
+        }
+
+        // write modified entry to id2entry table
+        getMasterTable().modify( id, entry );
+
+        // write new indices
+        for ( EntryAttribute attribute : entry )
+        {
+            String attr = attribute.getId();
+            String oid = getAttributeTypeOid( attr );
+            if ( userIndices.containsKey( oid ) )
+            {
+                getIndexTable( oid ).add( attribute, id );
+                getPresenceIndexTable( oid ).add( id );
+            }
+        }
+
+        //System.out.println("after modify: " + entry);
+    }
+
+
+    public void modify( LdapDN arg0, ModificationOperation arg1, ServerEntry arg2 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void move( LdapDN arg0, LdapDN arg1 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void move( LdapDN arg0, LdapDN arg1, RDN arg2, boolean arg3 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void rename( LdapDN arg0, RDN arg1, boolean arg2 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setAliasIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setCacheSize( int cacheSize )
+    {
+        this.cacheSize = cacheSize;
+    }
+
+
+    public void setEntryCsnIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setEntryUuidIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public void setNdnIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setObjectClassIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setOneAliasIndex( Index<Long, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setOneLevelIndex( Index<Long, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setPresenceIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setProperty( String arg0, String arg1 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setSubAliasIndex( Index<Long, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setSubLevelIndex( Index<Long, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setSuffixDn( String suffix )
+    {
+        this.suffix = suffix;
+    }
+
+
+    public void setSyncOnWrite( boolean isSyncOnWrite )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setUpdnIndex( Index<String, ServerEntry> arg0 ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setUserIndices( Set<Index<?, ServerEntry>> arg0 )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setWorkingDirectory( File arg0 )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void sync() throws Exception
+    {
+        // always synched
+    }
+
+
+    public Iterator<String> systemIndices()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public Iterator<String> userIndices()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    public void setTablePrefix( String tablePrefix )
+    {
+        this.tablePrefix = tablePrefix;
+    }
+
+
+    public String getTablePrefix()
+    {
+        return tablePrefix;
+    }
+
+
+    public SchemaManager getSchemaManager()
+    {
+        return schemaManager;
+    }
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,152 @@
+/*
+ *   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;
+
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
+import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
+import org.apache.hadoop.hbase.io.HbaseObjectWritable;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+public class SingleColumnQualifierFilter implements Filter
+{
+    private byte[] columnFamily;
+    private CompareOp compareOp;
+    private WritableByteArrayComparable comparator;
+
+    private boolean matchedQualifier = false;
+
+
+    /**
+     * Writable constructor, do not use.
+     */
+    public SingleColumnQualifierFilter()
+    {
+    }
+
+
+    public SingleColumnQualifierFilter( final byte[] family, final CompareOp compareOp,
+        final WritableByteArrayComparable comparator )
+    {
+        this.columnFamily = family;
+        this.compareOp = compareOp;
+        this.comparator = comparator;
+    }
+
+
+    public boolean filterRowKey( byte[] rowKey, int offset, int length )
+    {
+        return false;
+    }
+
+
+    public ReturnCode filterKeyValue( KeyValue keyValue )
+    {
+        if ( this.matchedQualifier )
+        {
+            // We already found and matched the qualifier, all keys now pass
+            return ReturnCode.INCLUDE;
+        }
+
+        if ( !keyValue.matchingFamily( this.columnFamily ) )
+        {
+            return ReturnCode.INCLUDE;
+        }
+
+        if ( filterQualifier( keyValue.getBuffer(), keyValue.getQualifierOffset(), keyValue.getQualifierLength() ) )
+        {
+            return ReturnCode.INCLUDE;
+        }
+        this.matchedQualifier = true;
+        return ReturnCode.INCLUDE;
+    }
+
+
+    private boolean filterQualifier( final byte[] data, final int offset, final int length )
+    {
+        int compareResult = this.comparator.compareTo( Arrays.copyOfRange( data, offset, offset + length ) );
+        switch ( this.compareOp )
+        {
+            case LESS:
+                return compareResult <= 0;
+            case LESS_OR_EQUAL:
+                return compareResult < 0;
+            case EQUAL:
+                return compareResult != 0;
+            case NOT_EQUAL:
+                return compareResult == 0;
+            case GREATER_OR_EQUAL:
+                return compareResult > 0;
+            case GREATER:
+                return compareResult >= 0;
+            default:
+                throw new RuntimeException( "Unknown Compare op " + compareOp.name() );
+        }
+    }
+
+
+    public boolean filterAllRemaining()
+    {
+        return false;
+    }
+
+
+    public boolean filterRow()
+    {
+        return !this.matchedQualifier;
+    }
+
+
+    public void reset()
+    {
+        matchedQualifier = false;
+    }
+
+
+    public void readFields( final DataInput in ) throws IOException
+    {
+        this.columnFamily = Bytes.readByteArray( in );
+        if ( this.columnFamily.length == 0 )
+        {
+            this.columnFamily = null;
+        }
+        this.compareOp = CompareOp.valueOf( in.readUTF() );
+        this.comparator = ( WritableByteArrayComparable ) HbaseObjectWritable.readObject( in, null );
+        this.matchedQualifier = in.readBoolean();
+    }
+
+
+    public void write( final DataOutput out ) throws IOException
+    {
+        Bytes.writeByteArray( out, this.columnFamily );
+        out.writeUTF( compareOp.name() );
+        HbaseObjectWritable.writeObject( out, comparator, WritableByteArrayComparable.class, null );
+        out.writeBoolean( matchedQualifier );
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Utils.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Utils.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Utils.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/Utils.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,75 @@
+/*
+ *   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;
+
+
+import org.apache.directory.server.xdbm.search.impl.SubstringEvaluator;
+import org.apache.directory.shared.ldap.filter.SubstringNode;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+public class Utils
+{
+
+    public static String getPrintableString( byte[] bytes )
+    {
+        StringBuffer sb = new StringBuffer();
+        for ( int i = 0; bytes != null && i < bytes.length; i++ )
+        {
+            byte b = bytes[i];
+            if ( b == 0 && bytes.length >= i + 8 )
+            {
+                // might be the start of a long
+                long l = Bytes.toLong( bytes, i, 8 );
+                i += 7;
+                sb.append( l );
+            }
+            else if ( b > 32 && b < 127 )
+            {
+                sb.append( ( char ) b );
+            }
+            else
+            {
+                sb.append( "0x" );
+                sb.append( StringTools.toHexString( new byte[]
+                    { b } ) );
+                sb.append( "" );
+            }
+        }
+        return sb.toString();
+    }
+
+
+    public static String getValuePattern( SubstringNode node, HBaseStore store ) throws Exception
+    {
+        String valuePattern = new SubstringEvaluator( node, store, store.getSchemaManager() ).getPattern().toString();
+        if ( valuePattern.charAt( 0 ) == '^' )
+        {
+            // indicates that the value pattern has an initial pattern, filter out the '^'
+            return valuePattern.substring( 1 );
+        }
+        else
+        {
+            return valuePattern;
+        }
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,146 @@
+/*
+ *   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.cursor;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.shared.ldap.cursor.AbstractCursor;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+
+
+/**
+ * Abstract implementation if an {@link Cursor} that throws an 
+ * {@link UnsupportedOperationException} for each operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractHBaseCursor<E> extends AbstractCursor<E>
+{
+
+    /**
+     * {@inheritDoc}
+     */
+    public void after( E element ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void afterLast() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean available()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void before( E element ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void beforeFirst() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean first() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public E get() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isElementReused()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean last() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean next() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean previous() throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<E> iterator()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/AbstractHBaseIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,73 @@
+/*
+ *   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.cursor;
+
+
+import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.IndexEntry;
+
+
+/**
+ * Abstract implementation if an {@link IndexCursor} that throws an 
+ * {@link UnsupportedOperationException} for each operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractHBaseIndexCursor<V, E> extends AbstractHBaseCursor<IndexEntry<V, E>> implements
+    IndexCursor<V, E>
+{
+
+    /**
+     * {@docRoot}
+     */
+    public void afterValue( Long id, V indexValue ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@docRoot}
+     */
+    public void beforeValue( Long id, V indexValue ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@docRoot}
+     */
+    public void after( IndexEntry<V, E> element ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+
+    /**
+     * {@docRoot}
+     */
+    public void before( IndexEntry<V, E> element ) throws Exception
+    {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,171 @@
+/*
+ *   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.cursor;
+
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.partition.hbase.HBaseStore;
+import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+
+
+/**
+ * Base implementation of an {@link IndexCursor} that is backed by
+ * an HBase {@link ResultScanner}. As an {@link ResultScanner} can only
+ * be advanced in one direction this implementation simulates the
+ * reverse direction.  
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseHBaseIndexCursor<V> extends AbstractHBaseIndexCursor<V, ServerEntry>
+{
+
+    protected HBaseStore store;
+    protected ResultScanner scanner;
+    protected Iterator<Result> iterator;
+
+    private static final int CAPACITY = 10;
+    private int count;
+    private int index;
+    private LinkedList<IndexEntry<V, ServerEntry>> entries;
+
+    protected IndexEntry<V, ServerEntry> currentEntry;
+
+
+    public BaseHBaseIndexCursor( HBaseStore store )
+    {
+        this.store = store;
+        this.entries = new LinkedList<IndexEntry<V, ServerEntry>>();
+        reset();
+    }
+
+
+    public void close() throws Exception
+    {
+        reset();
+        super.close();
+    }
+
+
+    public void close( Exception reason ) throws Exception
+    {
+        close();
+    }
+
+
+    public void reset()
+    {
+        if ( scanner != null )
+        {
+            scanner.close();
+            scanner = null;
+        }
+        iterator = null;
+
+        entries.clear();
+        count = 0;
+        index = -1;
+
+        currentEntry = null;
+    }
+
+
+    @Override
+    public final void beforeFirst() throws Exception
+    {
+        if ( count < CAPACITY && entries.size() > 0 )
+        {
+            /*
+             * We can only go before first if no entry was removed from the entry list.
+             */
+            index = -1;
+        }
+        else
+        {
+            reset();
+        }
+    }
+
+
+    @Override
+    public final boolean available()
+    {
+        return currentEntry != null;
+    }
+
+
+    @Override
+    public final IndexEntry<V, ServerEntry> get() throws Exception
+    {
+        return currentEntry;
+    }
+
+
+    @Override
+    public final boolean next() throws Exception
+    {
+        if ( entries.size() > 0 && index < entries.size() - 1 )
+        {
+            index++;
+            currentEntry = entries.get( index );
+            return true;
+        }
+        else if ( doNext() )
+        {
+            entries.addLast( currentEntry );
+            count++;
+            if ( entries.size() > CAPACITY )
+            {
+                entries.removeFirst();
+            }
+            index = entries.size() - 1;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    protected abstract boolean doNext() throws Exception;
+
+
+    @Override
+    public final boolean previous() throws Exception
+    {
+        if ( entries.size() > 0 && index > -1 )
+        {
+            index--;
+            currentEntry = entries.get( index );
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,138 @@
+/*
+ *   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.cursor;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.xdbm.IndexCursor;
+import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.shared.ldap.cursor.ClosureMonitor;
+
+
+/**
+ * An empty index cursor implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EmptyIndexCursor implements IndexCursor<Long, ServerEntry>
+{
+
+    public void afterValue( Long id, Long indexValue ) throws Exception
+    {
+    }
+
+
+    public void beforeValue( Long id, Long indexValue ) throws Exception
+    {
+    }
+
+
+    public void after( IndexEntry<Long, ServerEntry> element ) throws Exception
+    {
+    }
+
+
+    public void afterLast() throws Exception
+    {
+    }
+
+
+    public boolean available()
+    {
+        return false;
+    }
+
+
+    public void before( IndexEntry<Long, ServerEntry> element ) throws Exception
+    {
+    }
+
+
+    public void beforeFirst() throws Exception
+    {
+    }
+
+
+    public void close() throws Exception
+    {
+    }
+
+
+    public void close( Exception reason ) throws Exception
+    {
+    }
+
+
+    public boolean first() throws Exception
+    {
+        return false;
+    }
+
+
+    public IndexEntry<Long, ServerEntry> get() throws Exception
+    {
+        return null;
+    }
+
+
+    public boolean isClosed() throws Exception
+    {
+        return false;
+    }
+
+
+    public boolean isElementReused()
+    {
+        return false;
+    }
+
+
+    public boolean last() throws Exception
+    {
+        return false;
+    }
+
+
+    public boolean next() throws Exception
+    {
+        return false;
+    }
+
+
+    public boolean previous() throws Exception
+    {
+        return false;
+    }
+
+
+    public void setClosureMonitor( ClosureMonitor monitor )
+    {
+    }
+
+
+    public Iterator<IndexEntry<Long, ServerEntry>> iterator()
+    {
+        return null;
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseNdnIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseNdnIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseNdnIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseNdnIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,79 @@
+/*
+ *   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.cursor;
+
+
+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.server.xdbm.ForwardIndexEntry;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+/**
+ * HBase specific implementation of the ndn (normalized DN) index cursor.
+ * 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 HBaseNdnIndexCursor extends BaseHBaseIndexCursor<String>
+{
+
+    public HBaseNdnIndexCursor( HBaseStore store )
+    {
+        super( store );
+    }
+
+
+    @Override
+    public boolean doNext() throws Exception
+    {
+        if ( scanner == null )
+        {
+            Scan s = new Scan();
+            s.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
+            //s.addFamily( HBaseId2entryTable.UP_ATTRIBUTES_FAMILY );
+            scanner = store.getMasterTable().getScanner( s );
+            iterator = scanner.iterator();
+        }
+
+        if ( iterator.hasNext() )
+        {
+            Result next = iterator.next();
+            byte[] id = next.getRow();
+            currentEntry = new ForwardIndexEntry<String, ServerEntry>();
+            currentEntry.setId( Bytes.toLong( id ) );
+            //currentEntry.setValue( entry.getDn().getNormName() );
+
+            //ServerEntry entry = store.getId2entryTable().convertToServerEntry( id, next );
+            //currentEntry.setObject( entry );
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,99 @@
+/*
+ *   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.cursor;
+
+
+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.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+/**
+ * HBase specific implementation of the one-level index cursor.
+ * There is no special one-level index table, but the tree table is used.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HBaseOneLevelIndexCursor extends BaseHBaseIndexCursor<Long>
+{
+
+    private Long baseId;
+    private ExprNode filter;
+
+
+    public HBaseOneLevelIndexCursor( Long baseId, HBaseStore store )
+    {
+        super( store );
+        this.baseId = baseId;
+    }
+
+
+    public HBaseOneLevelIndexCursor( Long baseId, ExprNode filter, HBaseStore store )
+    {
+        this( baseId, store );
+        this.filter = filter;
+    }
+
+
+    @Override
+    public boolean doNext() throws Exception
+    {
+        if ( scanner == null )
+        {
+            byte[] start = Bytes.toBytes( baseId );
+            byte[] stop = Bytes.toBytes( baseId + 1 );
+            Scan s = new Scan( start, stop );
+            s.addFamily( HBaseMasterTable.TREE_INFO_FAMILY );
+            s.addFamily( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY );
+            s.setFilter( HBaseSubLevelIndexCursor.getFilter( filter, store ) );
+            scanner = store.getMasterTable().getScanner( s );
+            iterator = scanner.iterator();
+        }
+
+        if ( iterator.hasNext() )
+        {
+            Result next = iterator.next();
+            byte[] id = next.getValue( HBaseMasterTable.TREE_INFO_FAMILY, HBaseMasterTable.ID_QUALIFIER );
+
+            currentEntry = new ForwardIndexEntry<Long, ServerEntry>();
+            currentEntry.setId( Bytes.toLong( id ) );
+            currentEntry.setValue( baseId );
+            if ( filter != null )
+            {
+                //                //ServerEntry entry = store.getMasterTable().convertToServerEntry( Bytes.toLong( id ), next );
+                //                ServerEntry entry = store.lookup( Bytes.toLong( id ) );
+                //                currentEntry.setObject( entry );
+            }
+
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+}

Added: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java?rev=902620&view=auto
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java (added)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java Sun Jan 24 19:04:37 2010
@@ -0,0 +1,86 @@
+/*
+ *   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.cursor;
+
+
+/**
+ * HBase specific implementation of the presence index cursor.
+ * There is no special presence index table, but the index tables are used.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+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.HBasePresenceIndexTable;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+public class HBasePresenceIndexCursor extends BaseHBaseIndexCursor<String>
+{
+
+    private String attributeTypeOid;
+
+
+    public HBasePresenceIndexCursor( String attributeTypeOid, HBaseStore store )
+    {
+        super( store );
+        this.attributeTypeOid = attributeTypeOid;
+    }
+
+
+    @Override
+    public boolean doNext() throws Exception
+    {
+        if ( scanner == null )
+        {
+            HBasePresenceIndexTable indexTable = store.getPresenceIndexTable( attributeTypeOid );
+            byte[] start;
+            byte[] stop;
+            start = indexTable.getPresenceKey( HBasePresenceIndexTable.VALUE_SCAN_FIRST_ENTRYID );
+            stop = indexTable.getPresenceKey( HBasePresenceIndexTable.VALUE_SCAN_LAST_ENTRYID );
+            Scan s = new Scan( start, stop );
+            s.addFamily( HBasePresenceIndexTable.INFO_FAMILY );
+            scanner = indexTable.getScanner( s );
+            iterator = scanner.iterator();
+        }
+
+        while ( iterator.hasNext() )
+        {
+            Result next = iterator.next();
+            //byte[] row = next.getRow();
+            byte[] id = next.getValue( HBasePresenceIndexTable.INFO_FAMILY, HBasePresenceIndexTable.ID_QUALIFIER );
+
+            currentEntry = new ForwardIndexEntry<String, ServerEntry>();
+            currentEntry.setId( Bytes.toLong( id ) );
+            //currentEntry.setValue( null );
+
+            //                ServerEntry entry = store.getId2entryTable().fetchEntry( currentId );
+            //                currentEntry.setObject( entry );
+            //                System.out.println("presenceIndex: next() " + entry.getDn().getUpName());
+            return true;
+        }
+        return false;
+    }
+
+}



Mime
View raw message