You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/10/08 12:01:49 UTC
svn commit: r1005755 - in
/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config:
ConfigPartitionReader.java beans/IndexBean.java beans/JdbmIndexBean.java
Author: elecharny
Date: Fri Oct 8 10:01:49 2010
New Revision: 1005755
URL: http://svn.apache.org/viewvc?rev=1005755&view=rev
Log:
Added the IndexBean class, and read the indexes
Added:
directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java
Modified:
directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
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
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1005755&r1=1005754&r2=1005755&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 10:01:49 2010
@@ -1277,9 +1277,9 @@ public class ConfigPartitionReader
return partition;
}
+
-
- private Set<Index<?, Entry, Long>> createIndexes( DN partitionDN ) throws Exception
+ private Set<JdbmIndexBean<String, Entry>> readIndexes( DN partitionDN ) throws Exception
{
AttributeType adsIndexAttributeIdAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_INDEX_ATTRIBUTE_ID );
PresenceNode filter = new PresenceNode( adsIndexAttributeIdAt );
@@ -1288,7 +1288,7 @@ public class ConfigPartitionReader
IndexCursor<Long, Entry, Long> cursor = se.cursor( partitionDN, AliasDerefMode.NEVER_DEREF_ALIASES, filter,
controls );
- Set<Index<?, Entry, Long>> indexes = new HashSet<Index<?, Entry, Long>>();
+ Set<JdbmIndexBean<String, Entry>> indexesBean = new HashSet<JdbmIndexBean<String, Entry>>();
while ( cursor.next() )
{
@@ -1305,13 +1305,28 @@ public class ConfigPartitionReader
if ( ocAttr.contains( ConfigSchemaConstants.ADS_JDBMINDEX ) )
{
- indexes.add( createJdbmIndex( indexEntry ) );
+ indexesBean.add( readJdbmIndex( indexEntry ) );
}
else
{
throw new NotImplementedException( I18n.err( I18n.ERR_506 ) );
}
}
+
+ return indexesBean;
+ }
+
+
+ private Set<Index<?, Entry, Long>> createIndexes( DN partitionDN ) throws Exception
+ {
+ Set<JdbmIndexBean<String, Entry>> indexesBean = readIndexes( partitionDN );
+
+ Set<Index<?, Entry, Long>> indexes = new HashSet<Index<?, Entry, Long>>();
+
+ for ( JdbmIndexBean<String, Entry> indexBean : indexesBean )
+ {
+ indexes.add( createJdbmIndex( indexBean ) );
+ }
return indexes;
}
@@ -1349,7 +1364,7 @@ public class ConfigPartitionReader
/**
* Create a new instance of a JdbmIndex from the configuration read from the DIT
*
- * @param indexEntry The entry contianing the JdbmIndex configuration
+ * @param indexEntry The entry containing the JdbmIndex configuration
* @return An JdbmIndex instance
* @throws Exception If the instance cannot be created
*/
@@ -1362,10 +1377,29 @@ public class ConfigPartitionReader
index.setCacheSize( indexBean.getCacheSize() );
index.setNumDupLimit( indexBean.getNumDupLimit() );
+ return index;
+ }
+
+ /**
+ * Create a new instance of a JdbmIndex from an instance of JdbmIndexBean
+ *
+ * @param JdbmIndexBean The JdbmIndexBean to convert
+ * @return An JdbmIndex instance
+ * @throws Exception If the instance cannot be created
+ */
+ private JdbmIndex<?, Entry> createJdbmIndex( JdbmIndexBean<String, Entry> indexBean ) throws Exception
+ {
+ JdbmIndex<String, Entry> index = new JdbmIndex<String, Entry>();
+
+ 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/IndexBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java?rev=1005755&view=auto
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java (added)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java Fri Oct 8 10:01:49 2010
@@ -0,0 +1,40 @@
+/*
+ * 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 <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @param <K> The index key
+ * @param <E> The index element
+ * @param <ID> The index ID
+ */
+public class IndexBean<K, E>
+{
+ /**
+ * Create a new IndexBean instance
+ */
+ public IndexBean()
+ {
+ }
+}
Modified: 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=1005755&r1=1005754&r2=1005755&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java Fri Oct 8 10:01:49 2010
@@ -25,7 +25,7 @@ package org.apache.directory.server.conf
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class JdbmIndexBean<K, E>
+public class JdbmIndexBean<K, E> extends IndexBean<K, E>
{
private int DEFAULT_INDEX_CACHE_SIZE = 100;