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.xdbm.Index; 028 029 030/** 031 * An annotation for the Index creation. It's used when we need to inject an 032 * indexed attribute into a given partition. Here is an exemple : 033 * <pre> 034 * @CreatePartition( 035 * name = "example", 036 * @Indexes( { 037 * @CreateIndex( attribute = "cn" ), 038 * @CreateIndex( attribute = "sn' ) 039 * }) 040 * ) 041 * </pre> 042 * There is one more parameter, the 'factory', which can be used to declare 043 * a specific kind of Index. It defaults to JdbmIndex. 044 * 045 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 046 */ 047@Retention(RetentionPolicy.RUNTIME) 048@Target( 049 { ElementType.METHOD, ElementType.TYPE }) 050public @interface CreateIndex 051{ 052 /** @return The index implementation class */ 053 Class<? extends Index> type() default Index.class; 054 055 056 /** @return The cache size */ 057 int cacheSize() default 1000; 058 059 060 /** @return The indexed attribute */ 061 String attribute(); 062}