Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 30384 invoked from network); 8 Oct 2010 00:17:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Oct 2010 00:17:36 -0000 Received: (qmail 47110 invoked by uid 500); 8 Oct 2010 00:17:36 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 47046 invoked by uid 500); 8 Oct 2010 00:17:36 -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 47039 invoked by uid 99); 8 Oct 2010 00:17:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Oct 2010 00:17:36 +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; Fri, 08 Oct 2010 00:17:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CFA872388906; Fri, 8 Oct 2010 00:17:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1005677 - in /directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config: ConfigPartitionReader.java beans/JdbmIndexBean.java Date: Fri, 08 Oct 2010 00:17:11 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101008001711.CFA872388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Fri Oct 8 00:17:11 2010 New Revision: 1005677 URL: http://svn.apache.org/viewvc?rev=1005677&view=rev Log: Added the JdbmIndex bean Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1005677&r1=1005676&r2=1005677&view=diff ============================================================================== --- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (original) +++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Fri Oct 8 00:17:11 2010 @@ -58,6 +58,7 @@ import javax.naming.directory.SearchCont import org.apache.directory.server.changepw.ChangePasswordServer; import org.apache.directory.server.config.beans.ChangeLogBean; +import org.apache.directory.server.config.beans.JdbmIndexBean; import org.apache.directory.server.config.beans.JournalBean; import org.apache.directory.server.config.beans.KdcServerBean; import org.apache.directory.server.config.beans.NtpServerBean; @@ -1279,9 +1280,16 @@ public class ConfigPartitionReader } - public JdbmIndex createJdbmIndex( Entry indexEntry ) throws Exception + /** + * Read the JdbmIndex from the configuration in DIT + * + * @param indexEntry The Entry containing the configuration for this index + * @return An bean containing the JdbmEntry configuration + * @throws Exception If the configuration cannot be read + */ + public JdbmIndexBean readJdbmIndex( Entry indexEntry ) throws Exception { - JdbmIndex index = new JdbmIndex(); + JdbmIndexBean index = new JdbmIndexBean(); index.setAttributeId( getString( ConfigSchemaConstants.ADS_INDEX_ATTRIBUTE_ID, indexEntry ) ); EntryAttribute cacheAttr = indexEntry.get( ConfigSchemaConstants.ADS_INDEX_CACHESIZE ); @@ -1300,6 +1308,27 @@ public class ConfigPartitionReader return index; } + + /** + * Create a new instance of a JdbmIndex from the configuration read from the DIT + * + * @param indexEntry The entry contianing the JdbmIndex configuration + * @return An JdbmIndex instance + * @throws Exception If the instance cannot be created + */ + public JdbmIndex createJdbmIndex( Entry indexEntry ) throws Exception + { + JdbmIndex index = new JdbmIndex(); + JdbmIndexBean indexBean = readJdbmIndex( indexEntry ); + + index.setAttributeId( indexBean.getAttributeId() ); + index.setCacheSize( indexBean.getCacheSize() ); + index.setNumDupLimit( indexBean.getNumDupLimit() ); + + + return index; + } + private TransportBean[] readTransports( DN adsServerDN ) throws Exception { AttributeType adsTransportIdAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_TRANSPORT_ID ); Added: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java?rev=1005677&view=auto ============================================================================== --- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java (added) +++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java Fri Oct 8 00:17:11 2010 @@ -0,0 +1,125 @@ +/* + * 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.config.beans; + + +/** + * A class used to store the NtpServer configuration. + * + * @author Apache Directory Project + */ +public class JdbmIndexBean +{ + private int DEFAULT_INDEX_CACHE_SIZE = 100; + + /** default duplicate limit before duplicate keys switch to using a btree for values */ + public static final int DEFAULT_DUPLICATE_LIMIT = 512; + + /** + * the attribute identifier set at configuration time for this index which may not + * be the OID but an alias name for the attributeType associated with this Index + */ + private String attributeId; + + /** the size (number of index entries) for the cache */ + private int cacheSize = DEFAULT_INDEX_CACHE_SIZE; + + /** + * duplicate limit before duplicate keys switch to using a btree for values + */ + protected int numDupLimit = DEFAULT_DUPLICATE_LIMIT; + + /** + * Create a new NtpServerBean instance + */ + public JdbmIndexBean() + { + } + + + /** + * Gets the attribute identifier set at configuration time for this index which may not + * be the OID but an alias name for the attributeType associated with this Index + * + * @return configured attribute oid or alias name + */ + public String getAttributeId() + { + return attributeId; + } + + + /** + * Sets the attribute identifier set at configuration time for this index which may not + * be the OID but an alias name for the attributeType associated with this Index + * + * @param attributeId configured attribute oid or alias name + */ + public void setAttributeId( String attributeId ) + { + this.attributeId = attributeId; + } + + + /** + * Gets the size of the index cache in terms of the number of index entries to be cached. + * + * @return the size of the index cache + */ + public int getCacheSize() + { + return cacheSize; + } + + + /** + * Sets the size of the index cache in terms of the number of index entries to be cached. + * + * @param cacheSize the size of the index cache + */ + public void setCacheSize( int cacheSize ) + { + this.cacheSize = cacheSize; + } + + + /** + * Gets the threshold at which point duplicate keys use btree indirection to store + * their values. + * + * @return the threshold for storing a keys values in another btree + */ + public int getNumDupLimit() + { + return numDupLimit; + } + + + /** + * Sets the threshold at which point duplicate keys use btree indirection to store + * their values. + * + * @param numDupLimit the threshold for storing a keys values in another btree + */ + public void setNumDupLimit( int numDupLimit ) + { + this.numDupLimit = numDupLimit; + } +}