You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/11/05 23:15:24 UTC
svn commit: r1031853 [1/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...
Author: seelmann
Date: Fri Nov 5 22:15:23 2010
New Revision: 1031853
URL: http://svn.apache.org/viewvc?rev=1031853&view=rev
Log:
o Let HBase partition build with current trunk
o Use latest HBase snapshot version (0.89.0)
Added:
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseRdnIndex.java
Removed:
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/index/HBaseNdnIndex.java
Modified:
directory/sandbox/seelmann/hbase-partition/pom.xml
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/EmbeddedHBase.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.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/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/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/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/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/HBaseSubAliasIndex.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/HBaseUserIndex.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/IndexBuilder.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/LdifImporter.java
directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/mapreduce/TreeTableBuilder.java
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/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/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/table/HBaseTablePool.java
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
Modified: directory/sandbox/seelmann/hbase-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/pom.xml?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/pom.xml (original)
+++ directory/sandbox/seelmann/hbase-partition/pom.xml Fri Nov 5 22:15:23 2010
@@ -22,8 +22,9 @@
<parent>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-parent</artifactId>
- <version>1.5.6-SNAPSHOT</version>
+ <version>1.5.8-SNAPSHOT</version>
</parent>
+
<artifactId>apacheds-hbase-partition</artifactId>
<name>ApacheDS HBase Partition</name>
<packaging>jar</packaging>
@@ -33,7 +34,6 @@
</description>
<dependencies>
-
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
@@ -42,90 +42,42 @@
<!-- Dependencies to ApacheDS, for partition implementation -->
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-core</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.directory.shared</groupId>
+ <artifactId>shared-ldap</artifactId>
+ <version>${org.apache.directory.shared.version}</version>
</dependency>
+
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-xdbm-base</artifactId>
- <version>${pom.version}</version>
+ <artifactId>apacheds-core</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
+
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>apacheds-xdbm-search</artifactId>
- <version>${pom.version}</version>
+ <artifactId>apacheds-xdbm-partition</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</dependency>
+
<dependency>
- <groupId>${pom.groupId}</groupId>
<artifactId>apacheds-core-annotations</artifactId>
- <version>${pom.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <version>${project.version}</version>
</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>
+ <groupId>org.apache.hbase</groupId>
+ <version>0.89.0-SNAPSHOT</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>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>hbase-test</artifactId>
- <version>0.20.3-RC3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.hbase</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.2.2</version>
- </dependency>
- <!-- HBase transitive test depencencies -->
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0.1</version>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.14</version>
+ <artifactId>hbase</artifactId>
+ <groupId>org.apache.hbase</groupId>
+ <version>0.89.0-SNAPSHOT</version>
+ <classifier>tests</classifier>
</dependency>
+
</dependencies>
<build>
@@ -263,6 +215,7 @@
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>
@@ -270,6 +223,7 @@
<enabled>false</enabled>
</snapshots>
</repository>
+ -->
</repositories>
</project>
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/EmbeddedHBase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/EmbeddedHBase.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/EmbeddedHBase.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/EmbeddedHBase.java Fri Nov 5 22:15:23 2010
@@ -22,10 +22,9 @@ package org.apache.directory.server.core
import java.io.File;
-import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.MiniZooKeeperCluster;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HConnectionManager;
@@ -51,9 +50,8 @@ public class EmbeddedHBase
private static final EmbeddedHBase INSTANCE = new EmbeddedHBase();
private File workingDirectory;
- private HBaseConfiguration conf;
- private MiniHBaseCluster cluster;
- private MiniZooKeeperCluster zooKeeperCluster;
+ private HBaseTestingUtility hbaseTestingUtility;
+ private Configuration conf;
private int count = 0;
@@ -75,7 +73,8 @@ public class EmbeddedHBase
if ( INSTANCE.workingDirectory == null )
{
INSTANCE.workingDirectory = workingDirectory;
- INSTANCE.conf = new HBaseConfiguration();
+ INSTANCE.hbaseTestingUtility = new HBaseTestingUtility();
+ INSTANCE.conf = INSTANCE.hbaseTestingUtility.getConfiguration();
}
return INSTANCE;
}
@@ -93,7 +92,7 @@ public class EmbeddedHBase
{
if ( count == 0 )
{
- LOG.info( "Start embedded HBase" );
+ LOG.info( "Startin embedded HBase cluster" );
try
{
// hdfs working directory
@@ -105,26 +104,12 @@ public class EmbeddedHBase
// hbase working directory
conf.set( HConstants.HBASE_DIR, new File( workingDirectory, "hbase" ).toURI().toURL().toString() );
- // Note that this is done before we create the MiniHBaseCluster because we
- // need to edit the config to add the ZooKeeper servers.
- zooKeeperCluster = new MiniZooKeeperCluster();
- int clientPort = this.zooKeeperCluster.startup( workingDirectory );
- conf.set( "hbase.zookeeper.property.clientPort", Integer.toString( clientPort ) );
-
- // start the mini cluster
- cluster = new MiniHBaseCluster( conf, 1 );
+ hbaseTestingUtility.startMiniCluster();
}
catch ( Exception e )
{
- LOG.error( "Error while starting embedded HBase.", e );
- if ( cluster != null )
- {
- cluster.shutdown();
- }
- if ( zooKeeperCluster != null )
- {
- zooKeeperCluster.shutdown();
- }
+ hbaseTestingUtility.shutdownMiniCluster();
+ LOG.error( "Error while starting embedded HBase cluster", e );
throw e;
}
@@ -192,22 +177,16 @@ public class EmbeddedHBase
try
{
- LOG.info( "Shutdown embedded HBase" );
+ LOG.info( "Shutting down embedded HBase cluster" );
count = 0;
// open the META table now to ensure cluster is running before shutdown.
new HTable( conf, HConstants.META_TABLE_NAME );
- HConnectionManager.deleteConnectionInfo( conf, true );
- if ( this.cluster != null )
+ HConnectionManager.deleteConnection( conf, true );
+ if ( hbaseTestingUtility != null )
{
- LOG.debug( "Shutdown cluster..." );
- this.cluster.shutdown();
- LOG.debug( "...done" );
-
- LOG.debug( "Shutdown zookeeper..." );
- this.zooKeeperCluster.shutdown();
- LOG.debug( "...done" );
+ hbaseTestingUtility.shutdownMiniCluster();
}
}
catch ( Exception e )
@@ -222,7 +201,7 @@ public class EmbeddedHBase
*
* @return the HBase configuration
*/
- public HBaseConfiguration getConfiguration()
+ public Configuration getConfiguration()
{
return conf;
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseDistributedPartition.java Fri Nov 5 22:15:23 2010
@@ -20,29 +20,17 @@
package org.apache.directory.server.core.partition.hbase;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
-import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.hbase.index.AbstractHBaseIndex;
-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.HBaseSubAliasIndex;
-import org.apache.directory.server.core.partition.hbase.index.HBaseSubLevelIndex;
-import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
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.core.partition.impl.xdbm.AbstractXdbmPartition;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.search.impl.DefaultSearchEngine;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
@@ -76,137 +64,31 @@ public class HBaseDistributedPartition e
protected void doInit() throws Exception
{
Map<String, OidNormalizer> oidsMap = schemaManager.getAttributeTypeRegistry().getNormalizerMapping();
- this.suffix.normalize( oidsMap );
+ suffix.normalize( oidsMap );
// setup optimizer and search engine
ExtendedEvaluatorBuilder<UUID> evaluatorBuilder = new ExtendedEvaluatorBuilder<UUID>( store, schemaManager );
ExtendedCursorBuilder<UUID> cursorBuilder = new ExtendedCursorBuilder<UUID>( store, evaluatorBuilder );
- optimizer = new ExtendedOptimizer<ServerEntry, UUID>( store, cursorBuilder, evaluatorBuilder );
+ optimizer = new ExtendedOptimizer<Entry, UUID>( store, cursorBuilder, evaluatorBuilder );
searchEngine = new DefaultSearchEngine<UUID>( store, cursorBuilder, evaluatorBuilder, optimizer );
// initialize the store
- store.setSuffixDn( getSuffixDn().normalize( oidsMap ).getNormName() );
+ store.setSuffixDn( suffix );
store.setCacheSize( cacheSize );
- store.setName( id );
+ store.setId( id );
String directoryServiceInstanceName = getPartitionDir().getParentFile().getName();
( ( HBaseStore ) store ).setTablePrefix( "apacheds" + "_" + directoryServiceInstanceName + "_" + id + "_" );
- Set<Index<?, ServerEntry, UUID>> userIndices = new HashSet<Index<?, ServerEntry, UUID>>();
-
- for ( Index<?, ServerEntry, UUID> obj : getIndexedAttributes() )
+ for ( Index<?, Entry, UUID> index : getIndexedAttributes() )
{
- AbstractHBaseIndex<?, ServerEntry> index;
-
- if ( AbstractHBaseIndex.class.isAssignableFrom( obj.getClass() ) )
- {
- index = ( AbstractHBaseIndex<?, ServerEntry> ) obj;
- }
- else
- {
- index = new HBaseUserRowIndex();
- index.setAttributeId( obj.getAttributeId() );
- index.setCacheSize( obj.getCacheSize() );
- }
-
- // set the store
- index.setStore( ( HBaseStore ) store );
-
// normalize the attributeId to oid
String oid = schemaManager.getAttributeTypeRegistry().getOidByName( index.getAttributeId() );
- index.setAttributeId( oid );
-
- if ( oid.equals( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) )
- {
- if ( index instanceof HBaseAliasIndex )
- {
- store.setAliasIndex( ( HBaseAliasIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheAlias index must be of type HBaseAliasIndex" );
- }
- }
- else if ( oid.equals( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) )
- {
- if ( index instanceof HBaseOneAliasIndex )
- {
- store.setOneAliasIndex( ( HBaseOneAliasIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheOneAlias index must be of type HBaseOneAliasIndex" );
- }
- }
- else if ( oid.equals( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) )
- {
- if ( index instanceof HBaseSubAliasIndex )
- {
- store.setSubAliasIndex( ( HBaseSubAliasIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheSubAlias index must be of type HBaseSubAliasIndex" );
- }
- }
- else if ( oid.equals( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID ) )
+ if ( !index.getAttributeId().equals( oid ) )
{
- if ( index instanceof HBasePresenceIndex )
- {
- store.setPresenceIndex( ( HBasePresenceIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheExistence index must be of type HBasePresenceIndex" );
- }
+ index.setAttributeId( oid );
}
- else if ( oid.equals( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) )
- {
- if ( index instanceof HBaseOneLevelIndex )
- {
- store.setOneLevelIndex( ( HBaseOneLevelIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheOneLevel index must be of type HBaseOneLevelIndex" );
- }
- }
- else if ( oid.equals( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) )
- {
- if ( index instanceof HBaseSubLevelIndex )
- {
- store.setSubLevelIndex( ( HBaseSubLevelIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheOneLevel index must be of type HBaseSubLevelIndex" );
- }
- }
- else if ( oid.equals( ApacheSchemaConstants.APACHE_N_DN_AT_OID ) )
- {
- if ( index instanceof HBaseNdnIndex )
- {
- store.setNdnIndex( ( HBaseNdnIndex ) index );
- }
- else
- {
- throw new IllegalStateException( "apacheNdn index must be of type HBaseNdnIndex" );
- }
- }
-
- else if ( oid.equals( ApacheSchemaConstants.APACHE_UP_DN_AT_OID ) )
- {
- throw new IllegalStateException( "apacheUpdn index not supported" );
- }
-
- // TODO: handle objectClass, entryCSN, entryUUID as system indices?
-
- else
- {
- userIndices.add( index );
- }
-
+ store.addIndex( index );
}
- store.setUserIndices( userIndices );
store.init( schemaManager );
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartition.java Fri Nov 5 22:15:23 2010
@@ -53,7 +53,7 @@ public class HBaseEmbeddedPartition exte
{
// setting the working directory triggers the store to
// start up an embedded HBase server.
- store.setWorkingDirectory( getPartitionDir() );
+ store.setPartitionDir( getPartitionDir() );
super.doInit();
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseEmbeddedPartitionFactory.java Fri Nov 5 22:15:23 2010
@@ -23,11 +23,12 @@ import java.io.File;
import java.util.Set;
import java.util.UUID;
-import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.factory.PartitionFactory;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.name.DN;
/**
@@ -44,7 +45,10 @@ public class HBaseEmbeddedPartitionFacto
{
HBaseEmbeddedPartition partition = new HBaseEmbeddedPartition();
partition.setId( id );
- partition.setSuffix( suffix );
+
+ DN suffixDN = new DN( suffix );
+
+ partition.setSuffix( suffixDN );
partition.setCacheSize( 500 );
partition.setPartitionDir( workingDirectory );
return partition;
@@ -59,7 +63,7 @@ public class HBaseEmbeddedPartitionFacto
}
HBaseEmbeddedPartition hbasePartition = ( HBaseEmbeddedPartition ) partition;
- Set<Index<? extends Object, ServerEntry, UUID>> indexedAttributes = hbasePartition.getIndexedAttributes();
+ Set<Index<? extends Object, Entry, UUID>> indexedAttributes = hbasePartition.getIndexedAttributes();
HBaseUserRowIndex index = new HBaseUserRowIndex( attrbuteId );
// HBaseUserColumnIndex index = new HBaseUserColumnIndex( attrbuteId );
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/HBaseStore.java Fri Nov 5 22:15:23 2010
@@ -20,45 +20,28 @@
package org.apache.directory.server.core.partition.hbase;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import java.util.UUID;
-import org.apache.directory.server.core.entry.DefaultServerAttribute;
-import org.apache.directory.server.core.entry.ServerAttribute;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerModification;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.partition.hbase.index.AbstractHBaseIndex;
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.HBaseRdnIndex;
import org.apache.directory.server.core.partition.hbase.index.HBaseSubAliasIndex;
import org.apache.directory.server.core.partition.hbase.index.HBaseSubLevelIndex;
-import org.apache.directory.server.core.partition.hbase.index.HBaseUserIndex;
-import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
+import org.apache.directory.server.core.partition.hbase.index.HBaseUserRowIndex;
import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
-import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.xdbm.AbstractStore;
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.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.exception.LdapException;
-import org.apache.directory.shared.ldap.name.AVA;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
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.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -70,104 +53,122 @@ import org.apache.hadoop.hbase.HBaseConf
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class HBaseStore implements Store<ServerEntry, UUID>
+public class HBaseStore extends AbstractStore<Entry, UUID>
{
public static final String STRONG_CONSISTENCY_PROPERTY = "org.apache.directory.strong.consistency";
private String tablePrefix;
- private DN suffixDn;
- private String suffix;
- private String name;
- private int cacheSize;
- private SchemaManager schemaManager;
private EmbeddedHBase embeddedHBase;
- private File workingDirectory;
- private HBaseConfiguration configuration;
-
- private HBaseMasterTable masterTable;
-
- private Map<String, HBaseUserIndex<HBaseIndexTable>> userIndices = new HashMap<String, HBaseUserIndex<HBaseIndexTable>>();
- private HBasePresenceIndex presenceIndex;
- private Index<String, ServerEntry, UUID> ndnIndex;
- private Index<UUID, ServerEntry, UUID> oneLevelIndex;
- private Index<UUID, ServerEntry, UUID> subLevelIndex;
- private Index<String, ServerEntry, UUID> aliasIndex;
- private Index<UUID, ServerEntry, UUID> oneAliasIndex;
- private Index<UUID, ServerEntry, UUID> subAliasIndex;
+ private Configuration configuration;
public void init( SchemaManager schemaManager ) throws Exception
{
- if ( workingDirectory != null )
+ if ( partitionDir != null )
{
- embeddedHBase = EmbeddedHBase.getInstance( workingDirectory );
+ embeddedHBase = EmbeddedHBase.getInstance( partitionDir );
embeddedHBase.start( tablePrefix + HBaseMasterTable.TREE_TABLE );
configuration = embeddedHBase.getConfiguration();
}
else
{
- configuration = new HBaseConfiguration();
+ configuration = HBaseConfiguration.create();
}
this.schemaManager = schemaManager;
- this.suffixDn = new DN( suffix ).normalize( schemaManager.getAttributeTypeRegistry().getNormalizerMapping() );
- // setup system indices
- if ( presenceIndex == null )
+ // Initialize Attribute types used all over this method
+ OBJECT_CLASS_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT );
+ ALIASED_OBJECT_NAME_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ALIASED_OBJECT_NAME_AT );
+ ENTRY_CSN_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_CSN_AT );
+ ENTRY_UUID_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_UUID_AT );
+
+ // -------------------------------------------------------------------
+ // Initializes the user and system indices
+ // -------------------------------------------------------------------
+ setupSystemIndices();
+ setupUserIndices();
+
+ // create master table
+ getMasterTable();
+
+ // We are done !
+ initialized = true;
+ }
+
+
+ @Override
+ protected Index<?, Entry, UUID> convertAndInit( Index<?, Entry, UUID> index ) throws Exception
+ {
+ AbstractHBaseIndex<?, Entry> hbaseIndex;
+
+ if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_EXISTENCE_AT_OID ) )
{
- presenceIndex = new HBasePresenceIndex( this );
+ hbaseIndex = new HBasePresenceIndex( this );
}
- if ( ndnIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_RDN_AT_OID ) )
{
- ndnIndex = new HBaseNdnIndex( this );
+ hbaseIndex = new HBaseRdnIndex( this );
}
- if ( oneLevelIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID ) )
{
- oneLevelIndex = new HBaseOneLevelIndex( this );
+ hbaseIndex = new HBaseOneLevelIndex( this );
}
- if ( subLevelIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) )
{
- subLevelIndex = new HBaseSubLevelIndex( this );
+ hbaseIndex = new HBaseSubLevelIndex( this );
}
- // TODO: implement alias
- if ( aliasIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_ALIAS_AT_OID ) )
{
- aliasIndex = new HBaseAliasIndex();
+ hbaseIndex = new HBaseAliasIndex();
}
- if ( oneAliasIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID ) )
{
- oneAliasIndex = new HBaseOneAliasIndex();
+ hbaseIndex = new HBaseOneAliasIndex();
}
- if ( subAliasIndex == null )
+ else if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID ) )
{
- subAliasIndex = new HBaseSubAliasIndex();
+ hbaseIndex = new HBaseSubAliasIndex();
}
+ else if ( !( index instanceof AbstractHBaseIndex<?, ?> ) )
+ {
+ hbaseIndex = new HBaseUserRowIndex( index.getAttributeId() );
+ }
+ else
+ {
+ hbaseIndex = ( AbstractHBaseIndex<?, Entry> ) index;
+ }
+
+ hbaseIndex.setStore( this );
+ hbaseIndex.setCacheSize( index.getCacheSize() );
+
+ return hbaseIndex;
}
public void destroy() throws Exception
{
- if ( masterTable != null )
+ if ( master != null )
{
- masterTable.close();
- masterTable = null;
+ master.close();
+ master = null;
}
- for ( HBaseUserIndex<HBaseIndexTable> userIndex : userIndices.values() )
+ for ( Index<?, Entry, UUID> userIndex : userIndices.values() )
{
userIndex.close();
}
userIndices.clear();
- presenceIndex.close();
- ndnIndex.close();
- oneLevelIndex.close();
- subLevelIndex.close();
- aliasIndex.close();
- oneAliasIndex.close();
- subAliasIndex.close();
+ presenceIdx.close();
+ rdnIdx.close();
+ oneLevelIdx.close();
+ subLevelIdx.close();
+ aliasIdx.close();
+ oneAliasIdx.close();
+ subAliasIdx.close();
if ( embeddedHBase != null )
{
@@ -179,62 +180,37 @@ public class HBaseStore implements Store
}
- public void add( ServerEntry entry ) throws Exception
+ public HBaseMasterTable getMasterTable() throws Exception
{
- // write master and dn2id table
- UUID id = getMasterTable().add( entry );
-
- // write index tables
- for ( EntryAttribute attribute : entry )
+ if ( master == null )
{
- String attr = attribute.getId();
- String oid = getAttributeTypeOid( attr );
- if ( userIndices.containsKey( oid ) )
- {
- HBaseUserIndex<? extends HBaseIndexTable> index = userIndices.get( oid );
- for ( Value<?> value : attribute )
- {
- index.add( value.getBytes(), id );
- }
- getPresenceIndex().add( oid, id );
- }
+ master = new HBaseMasterTable( this );
}
+ return ( HBaseMasterTable ) master;
}
- public HBaseMasterTable getMasterTable() throws Exception
+ public UUID getEntryId( DN dn ) throws Exception
{
- if ( masterTable == null )
+ if ( !dn.isNormalized() )
{
- masterTable = new HBaseMasterTable( this );
+ dn.normalize( schemaManager.getNormalizerMapping() );
+ // TODO: force normalized DN
+ //throw new IllegalArgumentException( I18n.err( I18n.ERR_218, suffixDn.getName() ) );
}
- return masterTable;
- }
-
- public UUID getEntryId( String dn ) throws Exception
- {
- // TODO: is dn already normalized?
- DN normDn = new DN( dn ).normalize( schemaManager.getAttributeTypeRegistry().getNormalizerMapping() );
- UUID id = getMasterTable().fetchId( normDn );
+ UUID id = getMasterTable().fetchId( dn );
return id;
}
- public ServerEntry lookup( UUID id ) throws Exception
+ public Entry lookup( UUID id ) throws Exception
{
- ServerEntry entry = getMasterTable().fetchEntry( id );
+ Entry entry = getMasterTable().fetchEntry( id );
return entry;
}
- @SuppressWarnings("unchecked")
- public void addIndex( Index<?, ServerEntry, UUID> index )
- {
- this.userIndices.put( index.getAttributeId(), ( HBaseUserIndex<HBaseIndexTable> ) index );
- }
-
-
public int count() throws Exception
{
// we use the sub level count of the context entry
@@ -242,511 +218,37 @@ public class HBaseStore implements Store
}
- public void delete( UUID 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 ) )
- {
- HBaseUserIndex<? extends HBaseIndexTable> index = userIndices.get( oid );
- for ( Value<?> value : attribute )
- {
- index.drop( value.getBytes(), id );
- }
- getPresenceIndex().drop( oid, id );
- }
- }
-
- // write master and id2dn table
- getMasterTable().delete( id, entry );
- }
-
-
- public Index<String, ServerEntry, UUID> getAliasIndex()
- {
- return aliasIndex;
- }
-
-
- public int getCacheSize()
- {
- return cacheSize;
- }
-
-
- public int getChildCount( UUID id ) throws Exception
- {
- return oneLevelIndex.count( id );
- }
-
-
- public Index<String, ServerEntry, UUID> getEntryCsnIndex()
- {
- throw new UnsupportedOperationException();
- }
-
-
- public String getEntryDn( UUID arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public String getEntryUpdn( UUID arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public String getEntryUpdn( String arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public Index<String, ServerEntry, UUID> getEntryUuidIndex()
- {
- throw new UnsupportedOperationException();
- }
-
-
- public String getName()
- {
- return name;
- }
-
-
- public Index<String, ServerEntry, UUID> getNdnIndex()
- {
- return ndnIndex;
- }
-
-
- public Index<String, ServerEntry, UUID> getObjectClassIndex()
- {
- throw new UnsupportedOperationException();
- }
-
-
- public Index<UUID, ServerEntry, UUID> getOneAliasIndex()
- {
- return oneAliasIndex;
- }
-
-
- public Index<UUID, ServerEntry, UUID> getOneLevelIndex()
- {
- return oneLevelIndex;
- }
-
-
- public UUID getParentId( String arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public UUID getParentId( UUID arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public HBasePresenceIndex getPresenceIndex()
- {
- return presenceIndex;
- }
-
-
- public String getProperty( String arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public Index<UUID, ServerEntry, UUID> getSubAliasIndex()
- {
- return subAliasIndex;
- }
-
-
- public Index<UUID, ServerEntry, UUID> getSubLevelIndex()
- {
- return subLevelIndex;
- }
-
-
- public DN getSuffix()
- {
- return suffixDn;
- }
-
-
- public String getSuffixDn()
- {
- return suffix;
- }
-
-
- public Index<?, ServerEntry, UUID> getSystemIndex( String arg0 ) throws IndexNotFoundException
- {
- throw new UnsupportedOperationException();
- }
-
-
- public DN getUpSuffix()
- {
- return suffixDn;
- }
-
-
- public Index<String, ServerEntry, UUID> getUpdnIndex()
- {
- throw new UnsupportedOperationException();
- }
-
-
- public Index<?, ServerEntry, UUID> getIndex( String id ) throws IndexNotFoundException
- {
- return getUserIndex( id );
- }
-
-
- public HBaseUserIndex<HBaseIndexTable> 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 ( LdapException e )
- {
- throw new IndexNotFoundException( "Failed to identify OID for: " + oid, oid, e );
- }
- }
-
-
- public Set<Index<?, ServerEntry, UUID>> getUserIndices()
+ @Override
+ public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, Entry entry ) throws Exception
{
- return new HashSet<Index<?, ServerEntry, UUID>>( userIndices.values() );
- }
-
+ super.rename( dn, newRdn, deleteOldRdn, entry );
- public File getWorkingDirectory()
- {
- return workingDirectory;
+ UUID id = getEntryId( dn );
+ getMasterTable().move( id, null, newRdn );
}
- public boolean hasSystemIndexOn( String id ) throws Exception
+ @Override
+ public void moveAndRename( DN oldChildDn, DN newParentDn, RDN newRdn, Entry entry, boolean deleteOldRdn )
+ throws Exception
{
- //throw new UnsupportedOperationException();
- return false;
- }
-
-
- public boolean hasIndexOn( String id ) throws Exception
- {
- return hasUserIndexOn( id );
- }
-
-
- 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<UUID, ServerEntry, UUID> list( UUID key ) throws Exception
- {
- return getOneLevelIndex().forwardCursor( key );
- }
-
-
- public void modify( DN dn, List<Modification> mods ) throws Exception
- {
- UUID id = getEntryId( dn.getNormName() );
- ServerEntry entry = lookup( id );
-
- // 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 ) )
- {
- HBaseUserIndex<? extends HBaseIndexTable> index = userIndices.get( oid );
- for ( Value<?> value : attribute )
- {
- index.drop( value.getBytes(), id );
- }
- getPresenceIndex().drop( oid, id );
- }
- }
-
- // apply modifications
- for ( Modification mod : mods )
- {
- ServerAttribute modAttr = ( ServerAttribute ) mod.getAttribute();
- AttributeType modType = modAttr.getAttributeType();
- EntryAttribute entryAttr = entry.get( modType );
+ UUID id = getEntryId( oldChildDn );
+ super.rename( oldChildDn, newRdn, deleteOldRdn );
+ super.moveAndRename( oldChildDn, id, newParentDn, newRdn, entry );
- 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 LdapException( I18n.err( I18n.ERR_221 ) );
- }
- }
-
- // write modified entry to master and tree table
- getMasterTable().modify( id, entry );
-
- // write new indices
- for ( EntryAttribute attribute : entry )
- {
- String attr = attribute.getId();
- String oid = getAttributeTypeOid( attr );
- if ( userIndices.containsKey( oid ) )
- {
- HBaseUserIndex<? extends HBaseIndexTable> index = userIndices.get( oid );
- for ( Value<?> value : attribute )
- {
- index.add( value.getBytes(), id );
- }
- getPresenceIndex().add( oid, id );
- }
- }
- }
-
-
- public void modify( DN arg0, ModificationOperation arg1, ServerEntry arg2 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void move( DN oldChildDn, DN newParentDn ) throws Exception
- {
- move( oldChildDn, newParentDn, null, false );
- }
-
-
- public void move( DN dn, DN newParentDn, RDN newRdn, boolean deleteOldRdn ) throws Exception
- {
- UUID id = getEntryId( dn.getNormName() );
-
- if ( newRdn != null )
- {
- // apply attribute modifications
- List<Modification> mods = new ArrayList<Modification>();
- if ( deleteOldRdn )
- {
- for ( AVA ava : dn.getRdn() )
- {
- AttributeType at = schemaManager.lookupAttributeTypeRegistry( ava.getUpType() );
- DefaultServerAttribute attribute = new DefaultServerAttribute( ava.getUpType(), at, ava
- .getUpValue() );
- Modification mod = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attribute );
- mods.add( mod );
- }
- }
- for ( AVA ava : newRdn )
- {
- AttributeType at = schemaManager.lookupAttributeTypeRegistry( ava.getUpType() );
- DefaultServerAttribute attribute = new DefaultServerAttribute( ava.getUpType(), at, ava.getUpValue() );
- Modification mod = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
- mods.add( mod );
- }
- modify( dn, mods );
- }
-
-
- UUID newParentId = newParentDn != null ? getEntryId( newParentDn.getNormName() ) : null;
+ UUID newParentId = newParentDn != null ? getEntryId( newParentDn ) : null;
getMasterTable().move( id, newParentId, newRdn );
}
- public void rename( DN dn, RDN newRdn, boolean deleteOldRdn ) throws Exception
- {
- move( dn, null, newRdn, deleteOldRdn );
- }
-
-
- public void setAliasIndex( Index<String, ServerEntry, UUID> aliasIndex ) throws Exception
- {
- this.aliasIndex = aliasIndex;
- }
-
-
- public void setCacheSize( int cacheSize )
- {
- this.cacheSize = cacheSize;
- }
-
-
- public void setEntryCsnIndex( Index<String, ServerEntry, UUID> arg0 ) throws Exception
+ @Override
+ public void move( DN oldChildDn, DN newParentDn, DN newDn, Entry entry ) throws Exception
{
- throw new UnsupportedOperationException();
- }
-
-
- public void setEntryUuidIndex( Index<String, ServerEntry, UUID> arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void setName( String name )
- {
- this.name = name;
- }
-
+ super.move( oldChildDn, newParentDn, newDn, entry );
- public void setNdnIndex( Index<String, ServerEntry, UUID> ndnIndex ) throws Exception
- {
- this.ndnIndex = ndnIndex;
- }
-
-
- public void setObjectClassIndex( Index<String, ServerEntry, UUID> arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void setOneAliasIndex( Index<UUID, ServerEntry, UUID> oneAliasIndex ) throws Exception
- {
- this.oneAliasIndex = oneAliasIndex;
- }
-
-
- public void setOneLevelIndex( Index<UUID, ServerEntry, UUID> oneLevelIndex ) throws Exception
- {
- this.oneLevelIndex = oneLevelIndex;
- }
-
-
- public void setPresenceIndex( Index<String, ServerEntry, UUID> presenceIndex ) throws Exception
- {
- this.presenceIndex = ( HBasePresenceIndex ) presenceIndex;
- }
-
-
- public void setProperty( String arg0, String arg1 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void setSubAliasIndex( Index<UUID, ServerEntry, UUID> subAliasIndex ) throws Exception
- {
- this.subAliasIndex = subAliasIndex;
- }
-
-
- public void setSubLevelIndex( Index<UUID, ServerEntry, UUID> subLevelIndex ) throws Exception
- {
- this.subLevelIndex = subLevelIndex;
- }
-
-
- public void setSuffixDn( String suffix )
- {
- this.suffix = suffix;
- }
-
-
- public void setSyncOnWrite( boolean isSyncOnWrite )
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void setUpdnIndex( Index<String, ServerEntry, UUID> arg0 ) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
-
- public void setUserIndices( Set<Index<?, ServerEntry, UUID>> userIndices )
- {
- this.userIndices.clear();
- for ( Index<?, ServerEntry, UUID> index : userIndices )
- {
- addIndex( index );
- }
- }
-
-
- public void setWorkingDirectory( File workingDirectory )
- {
- this.workingDirectory = workingDirectory;
+ UUID id = getEntryId( oldChildDn );
+ UUID newParentId = newParentDn != null ? getEntryId( newParentDn ) : null;
+ getMasterTable().move( id, newParentId, null );
}
@@ -756,18 +258,6 @@ public class HBaseStore implements Store
}
- public Iterator<String> systemIndices()
- {
- throw new UnsupportedOperationException();
- }
-
-
- public Iterator<String> userIndices()
- {
- throw new UnsupportedOperationException();
- }
-
-
public void setTablePrefix( String tablePrefix )
{
this.tablePrefix = tablePrefix;
@@ -786,7 +276,7 @@ public class HBaseStore implements Store
}
- public HBaseConfiguration getConfiguration()
+ public Configuration getConfiguration()
{
return configuration;
}
@@ -797,4 +287,11 @@ public class HBaseStore implements Store
return getEntryId( getSuffixDn() );
}
+
+ @Override
+ protected UUID getRootId()
+ {
+ return HBaseMasterTable.ROOT_ID;
+ }
+
}
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/SingleColumnQualifierFilter.java Fri Nov 5 22:15:23 2010
@@ -26,14 +26,14 @@ 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.FilterBase;
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
+public class SingleColumnQualifierFilter extends FilterBase
{
private byte[] columnFamily;
private CompareOp compareOp;
@@ -110,12 +110,6 @@ public class SingleColumnQualifierFilter
}
- public boolean filterAllRemaining()
- {
- return false;
- }
-
-
public boolean filterRow()
{
return !this.matchedQualifier;
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/BaseHBaseIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -24,10 +24,10 @@ import java.util.Iterator;
import java.util.LinkedList;
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.xdbm.IndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
@@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.client.Re
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public abstract class BaseHBaseIndexCursor<V> extends AbstractHBaseIndexCursor<V, ServerEntry>
+public abstract class BaseHBaseIndexCursor<V> extends AbstractHBaseIndexCursor<V, Entry>
{
protected HBaseStore store;
@@ -51,15 +51,15 @@ public abstract class BaseHBaseIndexCurs
private static final int CAPACITY = 10;
private int count;
private int index;
- private LinkedList<IndexEntry<V, ServerEntry, UUID>> entries;
+ private LinkedList<IndexEntry<V, Entry, UUID>> entries;
- protected IndexEntry<V, ServerEntry, UUID> currentEntry;
+ protected IndexEntry<V, Entry, UUID> currentEntry;
public BaseHBaseIndexCursor( HBaseStore store )
{
this.store = store;
- this.entries = new LinkedList<IndexEntry<V, ServerEntry, UUID>>();
+ this.entries = new LinkedList<IndexEntry<V, Entry, UUID>>();
reset();
}
@@ -119,7 +119,7 @@ public abstract class BaseHBaseIndexCurs
@Override
- public final IndexEntry<V, ServerEntry, UUID> get() throws Exception
+ public final IndexEntry<V, Entry, UUID> get() throws Exception
{
return currentEntry;
}
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/EmptyIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -23,10 +23,10 @@ package org.apache.directory.server.core
import java.util.Iterator;
import java.util.UUID;
-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;
+import org.apache.directory.shared.ldap.entry.Entry;
/**
@@ -35,7 +35,7 @@ import org.apache.directory.shared.ldap.
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class EmptyIndexCursor implements IndexCursor<UUID, ServerEntry, UUID>
+public class EmptyIndexCursor implements IndexCursor<UUID, Entry, UUID>
{
public void afterValue( UUID id, UUID indexValue ) throws Exception
@@ -48,7 +48,7 @@ public class EmptyIndexCursor implements
}
- public void after( IndexEntry<UUID, ServerEntry, UUID> element ) throws Exception
+ public void after( IndexEntry<UUID, Entry, UUID> element ) throws Exception
{
}
@@ -64,7 +64,7 @@ public class EmptyIndexCursor implements
}
- public void before( IndexEntry<UUID, ServerEntry, UUID> element ) throws Exception
+ public void before( IndexEntry<UUID, Entry, UUID> element ) throws Exception
{
}
@@ -90,7 +90,7 @@ public class EmptyIndexCursor implements
}
- public IndexEntry<UUID, ServerEntry, UUID> get() throws Exception
+ public IndexEntry<UUID, Entry, UUID> get() throws Exception
{
return null;
}
@@ -131,9 +131,41 @@ public class EmptyIndexCursor implements
}
- public Iterator<IndexEntry<UUID, ServerEntry, UUID>> iterator()
+ public Iterator<IndexEntry<UUID, Entry, UUID>> iterator()
{
return null;
}
+
+ @Override
+ public boolean isAfterLast() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ @Override
+ public boolean isBeforeFirst() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ @Override
+ public boolean isFirst() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+ @Override
+ public boolean isLast() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseOneLevelIndexCursor.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.table.HBaseMasterTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
@@ -67,6 +67,12 @@ public class HBaseOneLevelIndexCursor ex
}
+ public void beforeValue( UUID id, UUID indexValue ) throws Exception
+ {
+ this.baseId = id;
+ }
+
+
@Override
public boolean doNext() throws Exception
{
@@ -90,7 +96,7 @@ public class HBaseOneLevelIndexCursor ex
}
s.setFilter( filter );
- scanner = store.getMasterTable().getScanner( s );
+ scanner = store.getMasterTable().getTreeTableScanner( s );
iterator = scanner.iterator();
}
@@ -99,16 +105,16 @@ public class HBaseOneLevelIndexCursor ex
Result next = iterator.next();
byte[] id = next.getValue( HBaseMasterTable.TREE_INFO_FAMILY, HBaseMasterTable.ID_QUALIFIER );
-// //NavigableMap<byte[],byte[]> familyMap = next.getFamilyMap( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY );
-// NavigableMap<byte[],byte[]> familyMap = next.getFamilyMap( HBaseMasterTable.TREE_INFO_FAMILY );
-// for ( byte[] key : familyMap.keySet() )
-// {
-// byte[] value = familyMap.get( key );
-// System.out.println(Utils.getPrintableString( key ) );
-// System.out.println(Utils.getPrintableString( value ) );
-// }
-
- currentEntry = new ForwardIndexEntry<UUID, ServerEntry, UUID>();
+ // //NavigableMap<byte[],byte[]> familyMap = next.getFamilyMap( HBaseMasterTable.NORM_ATTRIBUTES_FAMILY );
+ // NavigableMap<byte[],byte[]> familyMap = next.getFamilyMap( HBaseMasterTable.TREE_INFO_FAMILY );
+ // for ( byte[] key : familyMap.keySet() )
+ // {
+ // byte[] value = familyMap.get( key );
+ // System.out.println(Utils.getPrintableString( key ) );
+ // System.out.println(Utils.getPrintableString( value ) );
+ // }
+
+ currentEntry = new ForwardIndexEntry<UUID, Entry, UUID>();
currentEntry.setId( Utils.toUUID( id ) );
currentEntry.setValue( baseId );
Modified: 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=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBasePresenceIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -22,10 +22,10 @@ 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.Utils;
import org.apache.directory.server.core.partition.hbase.table.HBasePresenceIndexTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
@@ -70,7 +70,7 @@ public class HBasePresenceIndexCursor ex
{
Result next = iterator.next();
UUID id = presenceIndexTable.extractEntryIdFromPresenceKey( next.getRow() );
- currentEntry = new ForwardIndexEntry<String, ServerEntry, UUID>();
+ currentEntry = new ForwardIndexEntry<String, Entry, UUID>();
currentEntry.setId( id );
return true;
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseSubLevelIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseSubLevelIndexCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseSubLevelIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseSubLevelIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -25,13 +25,13 @@ import java.util.List;
import java.util.UUID;
import java.util.regex.Pattern;
-import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.normalization.ExpandingVisitor;
import org.apache.directory.server.core.partition.hbase.HBaseStore;
import org.apache.directory.server.core.partition.hbase.SingleColumnQualifierFilter;
import org.apache.directory.server.core.partition.hbase.Utils;
import org.apache.directory.server.core.partition.hbase.table.HBaseMasterTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -140,7 +140,7 @@ public class HBaseSubLevelIndexCursor ex
}
scan.setFilter( filter );
- scanner = store.getMasterTable().getScanner( scan );
+ scanner = store.getMasterTable().getTreeTableScanner( scan );
iterator = scanner.iterator();
}
}
@@ -204,7 +204,7 @@ public class HBaseSubLevelIndexCursor ex
private void fetchEntry( UUID id, Result next ) throws Exception
{
//System.out.println("fetchEntry " + Bytes.toLong( id ));
- currentEntry = new ForwardIndexEntry<UUID, ServerEntry, UUID>();
+ currentEntry = new ForwardIndexEntry<UUID, Entry, UUID>();
currentEntry.setId( id );
currentEntry.setValue( baseId );
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserColumnIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -26,12 +26,12 @@ import java.util.UUID;
import java.util.regex.Pattern;
import org.apache.commons.collections.iterators.EmptyIterator;
-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.HBaseColumnIndexTable;
import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
@@ -108,7 +108,7 @@ public class HBaseUserColumnIndexCursor
if ( candidates != null && candidates.hasNext() )
{
UUID next = candidates.next();
- currentEntry = new ForwardIndexEntry<Object, ServerEntry, UUID>();
+ currentEntry = new ForwardIndexEntry<Object, Entry, UUID>();
currentEntry.setId( next );
currentEntry.setValue( value );
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -22,9 +22,9 @@ 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.xdbm.IndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.SubstringNode;
@@ -70,7 +70,7 @@ public abstract class HBaseUserIndexCurs
@Override
- public void before( IndexEntry<Object, ServerEntry, UUID> element ) throws Exception
+ public void before( IndexEntry<Object, Entry, UUID> element ) throws Exception
{
value = element.getValue();
reset();
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexReverseCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexReverseCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexReverseCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserIndexReverseCursor.java Fri Nov 5 22:15:23 2010
@@ -24,11 +24,11 @@ import java.util.Iterator;
import java.util.NavigableMap;
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.table.HBaseMasterTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.hadoop.hbase.util.Bytes;
@@ -41,7 +41,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 HBaseUserIndexReverseCursor extends AbstractHBaseIndexCursor<Object, ServerEntry>
+public class HBaseUserIndexReverseCursor extends AbstractHBaseIndexCursor<Object, Entry>
{
private String attributeTypeOid;
private UUID id;
@@ -49,7 +49,7 @@ public class HBaseUserIndexReverseCursor
private NavigableMap<byte[], byte[]> attributeMap;
private Iterator<byte[]> attributeIterator;
- private IndexEntry<Object, ServerEntry, UUID> currentEntry;
+ private IndexEntry<Object, Entry, UUID> currentEntry;
public HBaseUserIndexReverseCursor( String attributeTypeOid, UUID id, HBaseStore store )
@@ -61,7 +61,7 @@ public class HBaseUserIndexReverseCursor
@Override
- public IndexEntry<Object, ServerEntry, UUID> get() throws Exception
+ public IndexEntry<Object, Entry, UUID> get() throws Exception
{
return currentEntry;
}
@@ -93,7 +93,7 @@ public class HBaseUserIndexReverseCursor
if ( oid != null && oid.equals( attributeTypeOid ) )
{
- currentEntry = new ForwardIndexEntry<Object, ServerEntry, UUID>();
+ currentEntry = new ForwardIndexEntry<Object, Entry, UUID>();
currentEntry.setId( id );
AttributeType at = store.getSchemaManager().getAttributeTypeRegistry().lookup( attributeTypeOid );
currentEntry.setValue( at.getSyntax().isHumanReadable() ? Bytes.toString( value ) : value );
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java?rev=1031853&r1=1031852&r2=1031853&view=diff
==============================================================================
--- directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/cursor/HBaseUserRowIndexCursor.java Fri Nov 5 22:15:23 2010
@@ -23,12 +23,12 @@ 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.HBaseStore;
import org.apache.directory.server.core.partition.hbase.Utils;
import org.apache.directory.server.core.partition.hbase.table.HBaseIndexTable;
import org.apache.directory.server.core.partition.hbase.table.HBaseRowIndexTable;
import org.apache.directory.server.xdbm.ForwardIndexEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
@@ -194,7 +194,7 @@ public class HBaseUserRowIndexCursor ext
Result next = iterator.next();
UUID id = indexTable.extractEntryIdFromEqualsKey( next.getRow() );
Object value = indexTable.extractValueFromEqualsKey( next.getRow() );
- currentEntry = new ForwardIndexEntry<Object, ServerEntry, UUID>();
+ currentEntry = new ForwardIndexEntry<Object, Entry, UUID>();
currentEntry.setId( id );
currentEntry.setValue( value );
return true;
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/AbstractHBaseIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/AbstractHBaseIndex.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/AbstractHBaseIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/AbstractHBaseIndex.java Fri Nov 5 22:15:23 2010
@@ -278,4 +278,9 @@ public abstract class AbstractHBaseIndex
throw new UnsupportedOperationException();
}
-}
+ //FIXME seelmann, just adding this method to make this source compile
+ // not sure if any of these indexes support duplicate keys
+ public boolean isDupsEnabled()
+ {
+ return false;
+ }}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseAliasIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseAliasIndex.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/HBaseAliasIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseAliasIndex.java Fri Nov 5 22:15:23 2010
@@ -22,29 +22,49 @@ package org.apache.directory.server.core
import java.util.UUID;
-import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
/**
* HBase specific implementation of the 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 HBaseAliasIndex extends AbstractHBaseIndex<String, ServerEntry>
+public class HBaseAliasIndex extends HBaseUserRowIndex
{
- public void close() throws Exception
+ public HBaseAliasIndex()
{
+ super( ApacheSchemaConstants.APACHE_ALIAS_AT_OID );
}
- public String reverseLookup( UUID id ) throws Exception
+ @Override
+ public Object reverseLookup( UUID id ) throws Exception
{
- // TODO
- return null;
+ Entry entry = store.getMasterTable().get( id );
+ if ( entry == null )
+ {
+ return null;
+ }
+ EntryAttribute attribute = entry.get( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID );
+ if ( attribute == null )
+ {
+ return null;
+ }
+ return attribute.get().get();
+ }
+
+
+ @Override
+ public void drop( UUID id ) throws Exception
+ {
+ Object value = reverseLookup( id );
+ drop( value, id );
}
}
Modified: directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneAliasIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneAliasIndex.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/HBaseOneAliasIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneAliasIndex.java Fri Nov 5 22:15:23 2010
@@ -22,39 +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 one-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 HBaseOneAliasIndex extends AbstractHBaseIndex<UUID, ServerEntry>
+public class HBaseOneAliasIndex extends HBaseUserRowIndex
{
- public void close() throws Exception
+ public HBaseOneAliasIndex()
{
+ super( ApacheSchemaConstants.APACHE_ONE_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/HBaseOneLevelIndex.java
URL: http://svn.apache.org/viewvc/directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneLevelIndex.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/HBaseOneLevelIndex.java (original)
+++ directory/sandbox/seelmann/hbase-partition/src/main/java/org/apache/directory/server/core/partition/hbase/index/HBaseOneLevelIndex.java Fri Nov 5 22:15:23 2010
@@ -22,10 +22,10 @@ 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.HBaseOneLevelIndexCursor;
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;
@@ -36,8 +36,8 @@ import org.apache.directory.shared.ldap.
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class HBaseOneLevelIndex extends AbstractHBaseIndex<UUID, ServerEntry> implements
- IndexFilteringExtension<UUID, ServerEntry, UUID>
+public class HBaseOneLevelIndex extends AbstractHBaseIndex<UUID, Entry> implements
+ IndexFilteringExtension<UUID, Entry, UUID>
{
public HBaseOneLevelIndex()
@@ -81,7 +81,27 @@ public class HBaseOneLevelIndex extends
public int count( UUID id ) throws Exception
{
return store.getMasterTable().getOneLevelCount( id );
+ }
+
+
+ @Override
+ public void add( UUID attrVal, UUID id ) throws Exception
+ {
+ // do nothing, there is no dedicated one level index
+ }
+
+ @Override
+ public void drop( UUID entryId ) throws Exception
+ {
+ // do nothing, there is no dedicated one level index
+ }
+
+
+ @Override
+ public void drop( UUID attrVal, UUID id ) throws Exception
+ {
+ // do nothing, there is no dedicated sub level index
}
}