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     */
019    package org.apache.directory.server.core.factory;
020    
021    
022    import java.io.File;
023    
024    import org.apache.directory.server.core.partition.Partition;
025    import org.apache.directory.server.xdbm.Index;
026    
027    
028    /**
029     * A factory used to generate {@link Partition}s and their {@link Index}es.
030     *
031     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032     * @version $Rev$, $Date$
033     */
034    public interface PartitionFactory
035    {
036    
037        /**
038         * Creates a new Partition.
039         * 
040         * @param id the partition id
041         * @param suffix the suffix
042         * @param cacheSize the cache size
043         * @param workingDirectory the working directory
044         * @return the partition
045         * @throws Exception the exception
046         */
047        Partition createPartition( String id, String suffix, int cacheSize, File workingDirectory ) throws Exception;
048    
049    
050        /**
051         * Adds a partition-specific index to the partition.
052         * 
053         * @param partition the partition
054         * @param attrbuteId the attribute id
055         * @param cacheSize the cache size
056         * @throws Exception the exception
057         */
058        void addIndex( Partition partition, String attributeId, int cacheSize ) throws Exception;
059    
060    }