directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1510118 - in /directory/apacheds/trunk: core-annotations/pom.xml core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java pom.xml
Date Sun, 04 Aug 2013 09:37:39 GMT
Author: kayyagari
Date: Sun Aug  4 09:37:39 2013
New Revision: 1510118

URL: http://svn.apache.org/r1510118
Log:
o partition factory for mavibot backend
o enabled mavibot partition (now mavibot snapshots are available in maven repo)

Added:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
Modified:
    directory/apacheds/trunk/core-annotations/pom.xml
    directory/apacheds/trunk/pom.xml

Modified: directory/apacheds/trunk/core-annotations/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/pom.xml?rev=1510118&r1=1510117&r2=1510118&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/pom.xml (original)
+++ directory/apacheds/trunk/core-annotations/pom.xml Sun Aug  4 09:37:39 2013
@@ -68,9 +68,9 @@
       <artifactId>apacheds-xdbm-partition</artifactId>
     </dependency>
 
-    <!-- dependency>
-      <groupId>org.apache.labs.mavibot</groupId>
-      <artifactId>apache-mavibot</artifactId>
+    <dependency>
+      <groupId>org.apache.directory.mavibot</groupId>
+      <artifactId>apacheds-mavibot</artifactId>
       <version>1.0.0-SNAPSHOT</version>
     </dependency>
 
@@ -78,7 +78,7 @@
       <groupId>${project.groupId}</groupId>
       <artifactId>apacheds-mavibot-partition</artifactId>
       <version>${project.version}</version>
-    </dependency -->
+    </dependency>
 
     <dependency>
       <groupId>commons-io</groupId>

Added: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java?rev=1510118&view=auto
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
(added)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
Sun Aug  4 09:37:39 2013
@@ -0,0 +1,82 @@
+/*
+ * 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.factory;
+
+
+import java.io.File;
+import java.util.Set;
+
+import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.partition.impl.btree.mavibot.MavibotIndex;
+import org.apache.directory.server.core.partition.impl.btree.mavibot.MavibotPartition;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.mavibot.btree.RecordManager;
+
+
+/**
+ * A factory used to generate {@link MavibotPartition}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class MavibotPartitionFactory implements PartitionFactory
+{
+
+    /**
+     * {@inheritDoc}
+     */
+    public MavibotPartition createPartition( SchemaManager schemaManager, String id, String
suffix, int cacheSize,
+        File workingDirectory )
+        throws Exception
+    {
+        MavibotPartition partition = new MavibotPartition( schemaManager );
+        partition.setId( id );
+        partition.setSuffixDn( new Dn( suffix ) );
+        partition.setCacheSize( 500 );
+        partition.setPartitionPath( workingDirectory.toURI() );
+
+        return partition;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addIndex( Partition partition, String attributeId, int cacheSize ) throws
Exception
+    {
+        if ( !( partition instanceof MavibotPartition ) )
+        {
+            throw new IllegalArgumentException( "Partition must be a MavibotPartition" );
+        }
+
+        MavibotPartition mavibotPartition = ( MavibotPartition ) partition;
+        Set<Index<?, ?, String>> indexedAttributes = mavibotPartition.getIndexedAttributes();
+
+        RecordManager recordMan = ( ( MavibotPartition ) partition ).getRecordMan();
+        
+        MavibotIndex<Object, Entry> index = new MavibotIndex<Object, Entry>(
recordMan, attributeId, false );
+        index.setCacheSize( cacheSize );
+
+        indexedAttributes.add( index );
+        mavibotPartition.setIndexedAttributes( indexedAttributes );
+    }
+
+}

Modified: directory/apacheds/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/pom.xml?rev=1510118&r1=1510117&r2=1510118&view=diff
==============================================================================
--- directory/apacheds/trunk/pom.xml (original)
+++ directory/apacheds/trunk/pom.xml Sun Aug  4 09:37:39 2013
@@ -97,7 +97,7 @@
     <module>i18n</module>
     <module>all</module>
     <module>jdbm-partition</module>
-    <!-- module>mavibot-partition</module -->
+    <module>mavibot-partition</module>
     <module>xdbm-partition</module>
     <module>core-shared</module>
     <module>core-api</module>



Mime
View raw message