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.interceptor;
21
22
23 import javax.naming.NamingException;
24
25
26 /**
27 * A {@link NamingException} 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 * @version $Rev: 437012 $, $Date: 2006-08-26 01:25:30 +0200 (Sa, 26 Aug 2006) $
32 */
33 public class InterceptorException extends NamingException
34 {
35 private static final long serialVersionUID = 3258690996517746233L;
36
37 /**
38 * The Interceptor causing the failure
39 */
40 private final Interceptor interceptor;
41
42
43 /**
44 * Creates an InterceptorException without a message.
45 *
46 * @param interceptor the Interceptor causing the failure
47 */
48 public InterceptorException(Interceptor interceptor)
49 {
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 this( interceptor );
76 super.setRootCause( rootCause );
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 this( interceptor, explanation );
90 super.setRootCause( rootCause );
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 }