Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 74152 invoked from network); 20 Mar 2010 10:48:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Mar 2010 10:48:53 -0000 Received: (qmail 25108 invoked by uid 500); 20 Mar 2010 10:48:53 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 25052 invoked by uid 500); 20 Mar 2010 10:48:53 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 25045 invoked by uid 99); 20 Mar 2010 10:48:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 10:48:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 10:48:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 491462388993; Sat, 20 Mar 2010 10:48:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r925576 - in /directory/apacheds/trunk: avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/ jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-base/src/main/java/org/apache/dire... Date: Sat, 20 Mar 2010 10:48:27 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100320104827.491462388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Sat Mar 20 10:48:26 2010 New Revision: 925576 URL: http://svn.apache.org/viewvc?rev=925576&view=rev Log: added generic index implementation, use it in tests Added: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Modified: directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java?rev=925576&r1=925575&r2=925576&view=diff ============================================================================== --- directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java (original) +++ directory/apacheds/trunk/avl-partition/src/test/java/org/apache/directory/server/core/partition/avl/AvlStoreTest.java Sat Mar 20 10:48:26 2010 @@ -44,8 +44,8 @@ import org.apache.directory.server.core. 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.xdbm.GenericIndex; import org.apache.directory.server.xdbm.Index; -import org.apache.directory.server.xdbm.IndexCursor; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.IndexNotFoundException; import org.apache.directory.server.xdbm.tools.StoreUtils; @@ -58,7 +58,6 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; 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.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor; import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor; @@ -562,229 +561,7 @@ public class AvlStoreTest @Test public void testConvertIndex() throws Exception { - Index nonAvlIndex = new Index() - { - - public void add( Object attrVal, Long id ) throws Exception - { - } - - - public void close() throws Exception - { - } - - - public int count() throws Exception - { - return 0; - } - - - public int count( Object attrVal ) throws Exception - { - return 0; - } - - - public void drop( Long id ) throws Exception - { - } - - - public void drop( Object attrVal, Long id ) throws Exception - { - } - - - public IndexCursor forwardCursor() throws Exception - { - return null; - } - - - public IndexCursor forwardCursor( Object key ) throws Exception - { - return null; - } - - - public Long forwardLookup( Object attrVal ) throws Exception - { - return null; - } - - - public Cursor forwardValueCursor( Object key ) throws Exception - { - return null; - } - - - public boolean forward( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forward( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverse( Long id ) throws Exception - { - return false; - } - - - public boolean reverse( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardGreaterOrEq( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardGreaterOrEq( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverseGreaterOrEq( Long id ) throws Exception - { - return false; - } - - - public boolean reverseGreaterOrEq( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardLessOrEq( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardLessOrEq( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverseLessOrEq( Long id ) throws Exception - { - return false; - } - - - public boolean reverseLessOrEq( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public AttributeType getAttribute() - { - return null; - } - - - public String getAttributeId() - { - return "ou"; - } - - - public int getCacheSize() - { - return 10; - } - - - public Object getNormalized( Object attrVal ) throws Exception - { - return null; - } - - - public File getWkDirPath() - { - return new File( "." ); - } - - - public int greaterThanCount( Object attrVal ) throws Exception - { - return 0; - } - - - public boolean isCountExact() - { - return false; - } - - - public int lessThanCount( Object attrVal ) throws Exception - { - return 0; - } - - - public IndexCursor reverseCursor() throws Exception - { - return null; - } - - - public IndexCursor reverseCursor( Long id ) throws Exception - { - return null; - } - - - public Object reverseLookup( Long id ) throws Exception - { - return null; - } - - - public Cursor reverseValueCursor( Long id ) throws Exception - { - return null; - } - - - public void setAttributeId( String attributeId ) - { - } - - - public void setCacheSize( int cacheSize ) - { - } - - - public void setWkDirPath( File wkDirPath ) - { - } - - - public void sync() throws Exception - { - } - - }; + Index nonAvlIndex = new GenericIndex( "ou", 10, new File( "." ) ); Method convertIndex = store.getClass().getDeclaredMethod( "convert", Index.class ); convertIndex.setAccessible( true ); Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=925576&r1=925575&r2=925576&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original) +++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Sat Mar 20 10:48:26 2010 @@ -45,8 +45,8 @@ import org.apache.directory.server.core. 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.xdbm.GenericIndex; import org.apache.directory.server.xdbm.Index; -import org.apache.directory.server.xdbm.IndexCursor; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.IndexNotFoundException; import org.apache.directory.server.xdbm.tools.StoreUtils; @@ -59,7 +59,6 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException; 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.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor; import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor; @@ -595,229 +594,7 @@ public class JdbmStoreTest @Test public void testConvertIndex() throws Exception { - Index nonJdbmIndex = new Index() - { - - public void add( Object attrVal, Long id ) throws Exception - { - } - - - public void close() throws Exception - { - } - - - public int count() throws Exception - { - return 0; - } - - - public int count( Object attrVal ) throws Exception - { - return 0; - } - - - public void drop( Long id ) throws Exception - { - } - - - public void drop( Object attrVal, Long id ) throws Exception - { - } - - - public IndexCursor forwardCursor() throws Exception - { - return null; - } - - - public IndexCursor forwardCursor( Object key ) throws Exception - { - return null; - } - - - public Long forwardLookup( Object attrVal ) throws Exception - { - return null; - } - - - public Cursor forwardValueCursor( Object key ) throws Exception - { - return null; - } - - - public boolean forward( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forward( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverse( Long id ) throws Exception - { - return false; - } - - - public boolean reverse( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardGreaterOrEq( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardGreaterOrEq( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverseGreaterOrEq( Long id ) throws Exception - { - return false; - } - - - public boolean reverseGreaterOrEq( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardLessOrEq( Object attrVal ) throws Exception - { - return false; - } - - - public boolean forwardLessOrEq( Object attrVal, Long id ) throws Exception - { - return false; - } - - - public boolean reverseLessOrEq( Long id ) throws Exception - { - return false; - } - - - public boolean reverseLessOrEq( Long id, Object attrVal ) throws Exception - { - return false; - } - - - public AttributeType getAttribute() - { - return null; - } - - - public String getAttributeId() - { - return "ou"; - } - - - public int getCacheSize() - { - return 10; - } - - - public Object getNormalized( Object attrVal ) throws Exception - { - return null; - } - - - public File getWkDirPath() - { - return new File( "." ); - } - - - public int greaterThanCount( Object attrVal ) throws Exception - { - return 0; - } - - - public boolean isCountExact() - { - return false; - } - - - public int lessThanCount( Object attrVal ) throws Exception - { - return 0; - } - - - public IndexCursor reverseCursor() throws Exception - { - return null; - } - - - public IndexCursor reverseCursor( Long id ) throws Exception - { - return null; - } - - - public Object reverseLookup( Long id ) throws Exception - { - return null; - } - - - public Cursor reverseValueCursor( Long id ) throws Exception - { - return null; - } - - - public void setAttributeId( String attributeId ) - { - } - - - public void setCacheSize( int cacheSize ) - { - } - - - public void setWkDirPath( File wkDirPath ) - { - } - - - public void sync() throws Exception - { - } - - }; + Index nonJdbmIndex = new GenericIndex( "ou", 10, new File( "." ) ); Method convertIndex = store.getClass().getDeclaredMethod( "convertIndex", Index.class ); convertIndex.setAccessible( true ); Added: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java?rev=925576&view=auto ============================================================================== --- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java (added) +++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/GenericIndex.java Sat Mar 20 10:48:26 2010 @@ -0,0 +1,298 @@ +/* + * 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.xdbm; + + +import java.io.File; + +import org.apache.directory.shared.ldap.cursor.Cursor; +import org.apache.directory.shared.ldap.schema.AttributeType; + + +/** + * A generic index implementation that is just used to hold the index configuration + * parameters (attributeId, cacheSize, wkDirPath). All other methods are not working. + * + * @author Apache Directory Project + * @version $Rev: 917312 $ + */ +public class GenericIndex implements Index +{ + + protected String attributeId; + protected int cacheSize; + protected File wkDirPath; + + + /** + * Creates a new instance of GenericIndex. + * + * @param attributeId the attribute ID + * @param cacheSize the cache size + */ + public GenericIndex( String attributeId, int cacheSize ) + { + this( attributeId, cacheSize, null ); + } + + + /** + * Creates a new instance of GenericIndex. + * + * @param attributeId the attribute ID + * @param cacheSize the cache size + * @param wkDirPath the working directory + */ + public GenericIndex( String attributeId, int cacheSize, File wkDirPath ) + { + this.attributeId = attributeId; + this.cacheSize = cacheSize; + this.wkDirPath = wkDirPath; + } + + + public void add( K attrVal, ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public void close() throws Exception + { + throw new UnsupportedOperationException(); + } + + + public int count() throws Exception + { + throw new UnsupportedOperationException(); + } + + + public int count( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public void drop( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public void drop( K attrVal, ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public IndexCursor forwardCursor() throws Exception + { + throw new UnsupportedOperationException(); + } + + + public IndexCursor forwardCursor( K key ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public ID forwardLookup( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public Cursor forwardValueCursor( K key ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forward( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forward( K attrVal, ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverse( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverse( ID id, K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forwardGreaterOrEq( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forwardGreaterOrEq( K attrVal, ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverseGreaterOrEq( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverseGreaterOrEq( ID id, K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forwardLessOrEq( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean forwardLessOrEq( K attrVal, ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverseLessOrEq( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean reverseLessOrEq( ID id, K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public AttributeType getAttribute() + { + throw new UnsupportedOperationException(); + } + + + public String getAttributeId() + { + return attributeId; + } + + + public int getCacheSize() + { + return cacheSize; + } + + + public K getNormalized( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public File getWkDirPath() + { + return wkDirPath; + } + + + public int greaterThanCount( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public boolean isCountExact() + { + throw new UnsupportedOperationException(); + } + + + public int lessThanCount( K attrVal ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public IndexCursor reverseCursor() throws Exception + { + throw new UnsupportedOperationException(); + } + + + public IndexCursor reverseCursor( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public K reverseLookup( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public Cursor reverseValueCursor( ID id ) throws Exception + { + throw new UnsupportedOperationException(); + } + + + public void setAttributeId( String attributeId ) + { + this.attributeId = attributeId; + } + + + public void setCacheSize( int cacheSize ) + { + this.cacheSize = cacheSize; + } + + + public void setWkDirPath( File wkDirPath ) + { + this.wkDirPath = wkDirPath; + } + + + public void sync() throws Exception + { + throw new UnsupportedOperationException(); + } + +}