001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.directory.server.core.factory; 020 021 022import java.io.File; 023 024import org.apache.directory.api.ldap.model.schema.SchemaManager; 025import org.apache.directory.server.core.api.DnFactory; 026import org.apache.directory.server.core.api.partition.Partition; 027import org.apache.directory.server.xdbm.Index; 028 029 030/** 031 * A factory used to generate {@link Partition}s and their {@link Index}es. 032 * 033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 034 */ 035public interface PartitionFactory 036{ 037 038 /** 039 * Creates a new Partition. 040 * 041 * @param schemaManager The SchemaManager instance 042 * @param dnFactory The DnFactory instance 043 * @param id the partition id 044 * @param suffix the suffix 045 * @param cacheSize the cache size 046 * @param workingDirectory the working directory 047 * @return the partition 048 * @throws Exception the exception 049 */ 050 Partition createPartition( SchemaManager schemaManager, DnFactory dnFactory, String id, String suffix, 051 int cacheSize, File workingDirectory ) throws Exception; 052 053 054 /** 055 * Adds a partition-specific index to the partition. 056 * 057 * @param partition the partition 058 * @param attributeId the attribute id 059 * @param cacheSize the cache size 060 * @throws Exception the exception 061 */ 062 void addIndex( Partition partition, String attributeId, int cacheSize ) throws Exception; 063 064}