1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.partition.impl.btree;
18
19
20 import javax.naming.NamingException;
21
22
23 /***
24 * NamingException for missing indicies if full table scans are disallowed.
25 *
26 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
27 * @version $Rev: 264732 $
28 */
29 public class IndexNotFoundException
30 extends NamingException
31 {
32 private static final long serialVersionUID = 3906088970608981815L;
33
34 /*** the name of the index that was not found */
35 private final String indexName;
36
37
38 /***
39 * Constructs an Exception with a detailed message.
40 *
41 * @param indexName the name of the index that was not found
42 */
43 public IndexNotFoundException( String indexName )
44 {
45 super( "Cannot efficiently search the DIB w/o an index on attribute "
46 + indexName + "\n. To allow such searches please contact the "
47 + "directory\nadministrator to create the index or to enable "
48 + "referrals on searches using these\nattributes to a replica with "
49 + "the required set of indices." );
50 this.indexName = indexName;
51 }
52
53
54 /***
55 * Constructs an Exception with a detailed message.
56 *
57 * @param message the message associated with the exception.
58 * @param indexName the name of the index that was not found
59 */
60 public IndexNotFoundException( String message, String indexName )
61 {
62 super( message );
63 this.indexName = indexName;
64 }
65
66
67 /***
68 * Constructs an Exception with a detailed message and a root cause
69 * exception.
70 *
71 * @param message the message associated with the exception.
72 * @param indexName the name of the index that was not found
73 * @param rootCause the root cause of this exception
74 */
75 public IndexNotFoundException( String message, String indexName,
76 Throwable rootCause )
77 {
78 this( message, indexName );
79 setRootCause( rootCause );
80 }
81
82
83 /***
84 * Gets the name of the attribute the index was missing for.
85 *
86 * @return the name of the attribute the index was missing for.
87 */
88 public String getIndexName()
89 {
90 return indexName;
91 }
92 }