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 */ 020package org.apache.directory.server.core.api.interceptor; 021 022 023import org.apache.directory.api.ldap.model.exception.LdapException; 024 025 026/** 027 * A {@link LdapException} that wraps uncaught runtime exceptions thrown 028 * from {@link Interceptor}s. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public class InterceptorException extends LdapException 033{ 034 private static final long serialVersionUID = 3258690996517746233L; 035 036 /** 037 * The Interceptor causing the failure 038 */ 039 private final Interceptor interceptor; 040 041 042 /** 043 * Creates an InterceptorException without a message. 044 * 045 * @param interceptor the Interceptor causing the failure 046 */ 047 public InterceptorException( Interceptor interceptor ) 048 { 049 super(); 050 this.interceptor = interceptor; 051 } 052 053 054 /** 055 * Creates an InterceptorException with a custom message. 056 * 057 * @param interceptor the Interceptor causing the failure 058 * @param explanation String explanation of why the Interceptor failed 059 */ 060 public InterceptorException( Interceptor interceptor, String explanation ) 061 { 062 super( explanation ); 063 this.interceptor = interceptor; 064 } 065 066 067 /** 068 * Creates an InterceptorException without a message. 069 * 070 * @param interceptor the Interceptor causing the failure 071 * @param rootCause the root cause of this exception 072 */ 073 public InterceptorException( Interceptor interceptor, Throwable rootCause ) 074 { 075 super( rootCause ); 076 this.interceptor = interceptor; 077 } 078 079 080 /** 081 * Creates an InterceptorException without a message. 082 * 083 * @param interceptor the Interceptor causing the failure 084 * @param explanation String explanation of why the Interceptor failed 085 * @param rootCause the root cause of this exception 086 */ 087 public InterceptorException( Interceptor interceptor, String explanation, Throwable rootCause ) 088 { 089 super( explanation, rootCause ); 090 this.interceptor = interceptor; 091 } 092 093 094 /** 095 * Gets the interceptor this exception is associated with. 096 * 097 * @return the interceptor this exception is associated with 098 */ 099 public Interceptor getInterceptor() 100 { 101 return interceptor; 102 } 103}