directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r905135 - in /directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core: annotations/CreateIndex.java factory/DSAnnotationProcessor.java
Date Sun, 31 Jan 2010 23:10:52 GMT
Author: seelmann
Date: Sun Jan 31 23:10:51 2010
New Revision: 905135

URL: http://svn.apache.org/viewvc?rev=905135&view=rev
Log:
Index creation depending on type

Modified:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateIndex.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateIndex.java?rev=905135&r1=905134&r2=905135&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateIndex.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateIndex.java
Sun Jan 31 23:10:51 2010
@@ -24,6 +24,7 @@
 import java.lang.annotation.Target;
 
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
+import org.apache.directory.server.xdbm.Index;
 
 /**
  * An annotation for the Index creation. It's used when we need to inject an
@@ -47,8 +48,8 @@
 @Target( {ElementType.METHOD, ElementType.TYPE } )
 public @interface CreateIndex
 {
-    /** The Factory to use to create an Index */
-    Class<?> factory() default JdbmIndex.class;
+    /** The index implementation class */
+    Class<? extends Index> type() default JdbmIndex.class;
     
     /** The cache size */
     int cacheSize() default 1000;

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=905135&r1=905134&r2=905135&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Sun Jan 31 23:10:51 2010
@@ -39,7 +39,6 @@
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
@@ -103,12 +102,11 @@
                 // Process the indexes if any
                 CreateIndex[] indexes = createPartition.indexes();
 
-                // TODO: use index factory
                 for ( CreateIndex createIndex : indexes )
                 {
-                    Index<String, ServerEntry> index = new JdbmIndex<String, ServerEntry>(
createIndex.attribute() );
+                    Index<?, ServerEntry> index = createIndex.type().newInstance();
+                    index.setAttributeId( createIndex.attribute() );
                     index.setCacheSize( createIndex.cacheSize() );
-
                     btreePartition.addIndexedAttributes( index );
                 }
             }



Mime
View raw message