View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.interceptor;
18  
19  
20  import javax.naming.NamingException;
21  
22  
23  /***
24   * A {@link NamingException} that wraps uncaught runtime exceptions thrown
25   * from {@link Interceptor}s.
26   *
27   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
28   * @version $Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
29   */
30  public class InterceptorException extends NamingException
31  {
32      private static final long serialVersionUID = 3258690996517746233L;
33  
34      /***
35       * The Interceptor causing the failure
36       */
37      private final Interceptor interceptor;
38  
39  
40      /***
41       * Creates an InterceptorException without a message.
42       *
43       * @param interceptor the Interceptor causing the failure
44       */
45      public InterceptorException( Interceptor interceptor )
46      {
47          this.interceptor = interceptor;
48      }
49  
50  
51      /***
52       * Creates an InterceptorException with a custom message.
53       *
54       * @param interceptor the Interceptor causing the failure
55       * @param explanation String explanation of why the Interceptor failed
56       */
57      public InterceptorException( Interceptor interceptor, String explanation )
58      {
59          super( explanation );
60          this.interceptor = interceptor;
61      }
62  
63  
64      /***
65       * Creates an InterceptorException without a message.
66       *
67       * @param interceptor the Interceptor causing the failure
68       * @param rootCause   the root cause of this exception
69       */
70      public InterceptorException( Interceptor interceptor, Throwable rootCause )
71      {
72          this( interceptor );
73          super.setRootCause( rootCause );
74      }
75  
76  
77      /***
78       * Creates an InterceptorException without a message.
79       *
80       * @param interceptor the Interceptor causing the failure
81       * @param explanation String explanation of why the Interceptor failed
82       * @param rootCause   the root cause of this exception
83       */
84      public InterceptorException( Interceptor interceptor, String explanation,
85                                   Throwable rootCause )
86      {
87          this( interceptor, explanation );
88          super.setRootCause( rootCause );
89      }
90  
91  
92      /***
93       * Gets the interceptor this exception is associated with.
94       *
95       * @return the interceptor this exception is associated with
96       */
97      public Interceptor getInterceptor()
98      {
99          return interceptor;
100     }
101 }