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.core.api.interceptor; 21 22 23 import org.apache.directory.api.ldap.model.exception.LdapException; 24 25 26 /** 27 * A {@link LdapException} that wraps uncaught runtime exceptions thrown 28 * from {@link Interceptor}s. 29 * 30 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 31 */ 32 public class InterceptorException extends LdapException 33 { 34 private static final long serialVersionUID = 3258690996517746233L; 35 36 /** 37 * The Interceptor causing the failure 38 */ 39 private final Interceptor interceptor; 40 41 42 /** 43 * Creates an InterceptorException without a message. 44 * 45 * @param interceptor the Interceptor causing the failure 46 */ 47 public InterceptorException( Interceptor interceptor ) 48 { 49 super(); 50 this.interceptor = interceptor; 51 } 52 53 54 /** 55 * Creates an InterceptorException with a custom message. 56 * 57 * @param interceptor the Interceptor causing the failure 58 * @param explanation String explanation of why the Interceptor failed 59 */ 60 public InterceptorException( Interceptor interceptor, String explanation ) 61 { 62 super( explanation ); 63 this.interceptor = interceptor; 64 } 65 66 67 /** 68 * Creates an InterceptorException without a message. 69 * 70 * @param interceptor the Interceptor causing the failure 71 * @param rootCause the root cause of this exception 72 */ 73 public InterceptorException( Interceptor interceptor, Throwable rootCause ) 74 { 75 super( rootCause ); 76 this.interceptor = interceptor; 77 } 78 79 80 /** 81 * Creates an InterceptorException without a message. 82 * 83 * @param interceptor the Interceptor causing the failure 84 * @param explanation String explanation of why the Interceptor failed 85 * @param rootCause the root cause of this exception 86 */ 87 public InterceptorException( Interceptor interceptor, String explanation, Throwable rootCause ) 88 { 89 super( explanation, rootCause ); 90 this.interceptor = interceptor; 91 } 92 93 94 /** 95 * Gets the interceptor this exception is associated with. 96 * 97 * @return the interceptor this exception is associated with 98 */ 99 public Interceptor getInterceptor() 100 { 101 return interceptor; 102 } 103 }