KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > config > InvalidConfigurationException


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.config;
19
20
21 import org.sape.carbon.core.util.classify.SeverityEnum;
22
23 /**
24  * <P>This exception is utilized to relate that a supplied configuration
25  * is invalid or could not be found. This exception should be utilized
26  * for individual properties that are invalid or for properties
27  * that in relation to eachother are invalid.</P>
28  *
29  * Copyright 2001 Sapient
30  * @since carbon 1.0
31  * @author Greg Hinkle, December 2001
32  * @version $Revision: 1.15 $($Author: dvoet $ / $Date: 2003/05/05 21:21:16 $)
33  */

34 public class InvalidConfigurationException
35         extends ConfigurationRuntimeException {
36
37
38     /**
39      * Constructs this exception with the supplied source, document
40      * and property
41      * @param sourceClass the source class where the property
42      * retrieval failed
43      * @param documentName the name of the configuration document which was
44      * supposed to have a valid configuration property
45      * @param propertyName the name of the property that was invalid
46      */

47     public InvalidConfigurationException(Class JavaDoc sourceClass,
48                                          String JavaDoc documentName,
49                                          String JavaDoc propertyName) {
50         super(sourceClass,
51             "Configuration property ["
52                 + propertyName
53                 + "] not valid in document ["
54                 + documentName
55                 + "]");
56
57     }
58
59     /**
60      * Constructs an invalid configuration exception
61      * @param sourceClass the source class of the exception
62      * @param documentName the name of the document that contained the
63      * configuration
64      * @param propertyName the name of the property that contained invalid data
65      * @param message a message describing why this configuration is not valid
66      */

67     public InvalidConfigurationException(Class JavaDoc sourceClass,
68                                          String JavaDoc documentName,
69                                          String JavaDoc propertyName,
70                                          String JavaDoc message) {
71         super(sourceClass,
72             message
73                 + "; Configuration property ["
74                 + propertyName
75                 + "] in document ["
76                 + documentName + "]");
77
78     }
79     /**
80      * Constructs an invalid configuration exception
81      * @param sourceClass the source class of the exception
82      * @param documentName the name of the document that contained the
83      * configuration
84      * @param propertyName the name of the property that contained the value
85      * @param cause the exception that caused this configuration to be invalid
86      */

87     public InvalidConfigurationException(Class JavaDoc sourceClass,
88                                          String JavaDoc documentName,
89                                          String JavaDoc propertyName,
90                                          Throwable JavaDoc cause) {
91         super(sourceClass,
92             "Configuration property ["
93                 + propertyName
94                 + "] not valid in document ["
95                 + documentName
96                 + "]",
97               cause);
98
99     }
100
101     /**
102      * Constructs an invalid configuration exception
103      * @param sourceClass the source class of the exception
104      * @param documentName the name of the document that contained the
105      * configuration
106      * @param propertyName the name of the property that contained the value
107      * @param message a message describing why this configuration is not valid
108      * @param cause the exception that caused this configuration to be invalid
109      */

110     public InvalidConfigurationException(Class JavaDoc sourceClass,
111                                          String JavaDoc documentName,
112                                          String JavaDoc propertyName,
113                                          String JavaDoc message,
114                                          Throwable JavaDoc cause) {
115         super(sourceClass,
116             message
117                 + "; Configuration property ["
118                 + propertyName
119                 + "] in document ["
120                 + documentName
121                 + "]",
122               cause);
123
124     }
125
126
127     /**
128      * @deprecated Utilize one of the more specific constructors
129      *
130      * @param message string information relating to this exception
131      */

132     public InvalidConfigurationException(String JavaDoc message) {
133         super(InvalidConfigurationException.class, message);
134     }
135
136     /**
137      * @deprecated Utilize one of the more specific constructors
138      *
139      * @param message string information relating to this exception
140      * @param cause a throwable that can be considered the cause
141      * of the current exception (used in levelizing exceptions)
142      */

143     public InvalidConfigurationException(String JavaDoc message, Throwable JavaDoc cause) {
144         super(InvalidConfigurationException.class, message, cause);
145     }
146
147     /**
148      * Retrieves the severity of this exception. It should be noted that
149      * invalid configurations are a technical failure and not an exposed
150      * business service and therefore have a relatively low severity of
151      * info. If this exception causes a buisnes failure higher up the
152      * stack, that exception should have a more severe exception severity.
153      *
154      * @return this exception's severity
155      */

156     public SeverityEnum getSeverity() {
157         return SeverityEnum.INFO;
158     }
159 }
Popular Tags