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.annotations;
020
021
022import java.lang.annotation.ElementType;
023import java.lang.annotation.Retention;
024import java.lang.annotation.RetentionPolicy;
025import java.lang.annotation.Target;
026
027import org.apache.directory.server.core.api.partition.Partition;
028
029
030/**
031 * An annotation for the Partition creation. A partition is defined by
032 * a name and a suffix, plus some other characteristics. Here is an example :
033 * <pre>
034 * &#64;CreatePartition(
035 *     name = "example",
036 *     suffix = "dc=example, dc=com",
037 *     &#64;ContextEntry( 
038 *         {
039 *             "dn: dc=example, dc=com",
040 *             "objectclass: top",
041 *             "objectclass: domain",
042 *             "dc: example", 
043 *         }),
044 *     &#64;Indexes( {
045 *         &#64;CreateIndex( attribute = "cn" ),
046 *         &#64;CreateIndex( attribute = "sn' )
047 *     })
048 * )
049 * </pre>
050 *
051 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
052 */
053@Retention(RetentionPolicy.RUNTIME)
054@Target(
055    { ElementType.METHOD, ElementType.TYPE })
056public @interface CreatePartition
057{
058    /** @return The partition implementation class */
059    Class<? extends Partition> type() default Partition.class;
060
061
062    /** @return The partition name */
063    String name();
064
065
066    /** @return The partition suffix */
067    String suffix();
068
069
070    /** @return The context entry */
071    ContextEntry contextEntry() default @ContextEntry(entryLdif = "");
072
073
074    /** @return The associated indexes */
075    CreateIndex[] indexes() default
076        {};
077
078
079    /** @return The cache size */
080    int cacheSize() default 1000;
081}