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 */
020 package org.apache.directory.server.xdbm;
021
022
023 import javax.naming.NamingException;
024
025 import org.apache.directory.server.i18n.I18n;
026
027
028 /**
029 * NamingException for missing indicies if full table scans are disallowed.
030 *
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 * @version $Rev: 917231 $
033 */
034 public class IndexNotFoundException extends NamingException
035 {
036 private static final long serialVersionUID = 3906088970608981815L;
037
038 /** the name of the index that was not found */
039 private final String indexName;
040
041
042 /**
043 * Constructs an Exception with a detailed message.
044 *
045 * @param indexName the name of the index that was not found
046 */
047 public IndexNotFoundException( String indexName )
048 {
049 super( I18n.err( I18n.ERR_704, indexName ) );
050 this.indexName = indexName;
051 }
052
053
054 /**
055 * Constructs an Exception with a detailed message.
056 *
057 * @param message the message associated with the exception.
058 * @param indexName the name of the index that was not found
059 */
060 public IndexNotFoundException( String message, String indexName )
061 {
062 super( message );
063 this.indexName = indexName;
064 }
065
066
067 /**
068 * Constructs an Exception with a detailed message and a root cause
069 * exception.
070 *
071 * @param message the message associated with the exception.
072 * @param indexName the name of the index that was not found
073 * @param rootCause the root cause of this exception
074 */
075 public IndexNotFoundException( String message, String indexName, Throwable rootCause )
076 {
077 this( message, indexName );
078 setRootCause( rootCause );
079 }
080
081
082 /**
083 * Gets the name of the attribute the index was missing for.
084 *
085 * @return the name of the attribute the index was missing for.
086 */
087 public String getIndexName()
088 {
089 return indexName;
090 }
091 }