View Javadoc

1   /*
2    * Copyright 2004-2005 Germinus XXI
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  package com.germinus.easyconf;
17  
18  import org.apache.commons.lang.exception.NestableRuntimeException;
19  
20  
21  /***
22   * Some unrecoverable but important error has ocurred while reading the configuration
23   *
24   * @author  Jorge Ferrer
25   * @version $Revision: 1.3 $
26   *
27   */
28  public class ConfigurationException extends NestableRuntimeException {
29      
30      private String componentName;
31  
32      public ConfigurationException() {
33          super();
34      }
35      
36      public ConfigurationException(String componentName, String msg, Throwable thr) {
37          super(msg, thr);
38          this.componentName = componentName;
39      }
40      
41      protected ConfigurationException(String componentName) {
42          super();
43          this.componentName = componentName;
44      }
45     
46      protected ConfigurationException(String componentName, Throwable e) {
47          super(e);
48          this.componentName = componentName;
49      }
50  
51      public ConfigurationException(String componentName, String msg) {
52          super(msg);
53          this.componentName = componentName;
54      }
55  
56      public String getComponentName() {
57          return componentName;
58      }
59      
60      
61      public String getMessage() {
62          return "Error reading configuration for " + componentName + ": " +
63          	super.getMessage();
64      }
65      
66      
67  }