1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.server.xdbm; 21 22 23 import javax.naming.NamingException; 24 25 import org.apache.directory.server.i18n.I18n; 26 27 28 /** 29 * NamingException for missing indicies if full table scans are disallowed. 30 * 31 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 32 */ 33 public class IndexNotFoundException extends NamingException 34 { 35 private static final long serialVersionUID = 3906088970608981815L; 36 37 /** the name of the index that was not found */ 38 private final String indexName; 39 40 41 /** 42 * Constructs an Exception with a detailed message. 43 * 44 * @param indexName the name of the index that was not found 45 */ 46 public IndexNotFoundException( String indexName ) 47 { 48 super( I18n.err( I18n.ERR_704, indexName ) ); 49 this.indexName = indexName; 50 } 51 52 53 /** 54 * Constructs an Exception with a detailed message. 55 * 56 * @param message the message associated with the exception. 57 * @param indexName the name of the index that was not found 58 */ 59 public IndexNotFoundException( String message, String indexName ) 60 { 61 super( message ); 62 this.indexName = indexName; 63 } 64 65 66 /** 67 * Constructs an Exception with a detailed message and a root cause 68 * exception. 69 * 70 * @param message the message associated with the exception. 71 * @param indexName the name of the index that was not found 72 * @param rootCause the root cause of this exception 73 */ 74 public IndexNotFoundException( String message, String indexName, Throwable rootCause ) 75 { 76 this( message, indexName ); 77 setRootCause( rootCause ); 78 } 79 80 81 /** 82 * Gets the name of the attribute the index was missing for. 83 * 84 * @return the name of the attribute the index was missing for. 85 */ 86 public String getIndexName() 87 { 88 return indexName; 89 } 90 }