KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > archive > crawler > framework > exceptions > ConfigurationException


1 /* Copyright (C) 2003 Internet Archive.
2  *
3  * This file is part of the Heritrix web crawler (crawler.archive.org).
4  *
5  * Heritrix is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser Public License as published by
7  * the Free Software Foundation; either version 2.1 of the License, or
8  * any later version.
9  *
10  * Heritrix is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser Public License
16  * along with Heritrix; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Created on Jul 29, 2003
20  *
21  */

22 package org.archive.crawler.framework.exceptions;
23
24 import org.archive.crawler.framework.exceptions.InitializationException;
25
26 /** ConfigurationExceptions should be thrown when a configuration file
27  * is missing data, or contains uninterpretable data, at runtime. Fatal
28  * errors (that should cause the program to exit) should be thrown as
29  * FatalConfigurationExceptions.
30  *
31  * You may optionally note the
32  *
33  * @author Parker Thompson
34  *
35  */

36 public class ConfigurationException extends InitializationException {
37
38     private static final long serialVersionUID = -9078913414698851380L;
39
40     // optionally store the file name and element so the catcher
41
// can report the information and/or take other actions based on it
42
protected String JavaDoc file = null;
43     protected String JavaDoc element = null;
44
45     /**
46      * default constructor
47      */

48     public ConfigurationException() {
49         super();
50     }
51
52     /** Create a ConfigurationException
53      * @param message
54      */

55     public ConfigurationException(String JavaDoc message) {
56         super(message);
57     }
58
59     /**
60      * @param message
61      * @param cause
62      */

63     public ConfigurationException(String JavaDoc message, Throwable JavaDoc cause) {
64         super(message, cause);
65         // TODO Auto-generated constructor stub
66
}
67
68     /** Create a ConfigurationException
69      * @param cause
70      */

71     public ConfigurationException(Throwable JavaDoc cause) {
72         super(cause);
73     }
74
75     /** Create ConfigurationException
76      * @param message
77      * @param filename
78      * @param elementname
79      */

80     public ConfigurationException(String JavaDoc message, String JavaDoc filename, String JavaDoc elementname){
81         super(message);
82         file = filename;
83         element = elementname;
84     }
85
86     /** Create ConfigurationException
87      * @param message
88      * @param cause
89      * @param filename
90      * @param elementname
91      */

92     public ConfigurationException(String JavaDoc message, Throwable JavaDoc cause, String JavaDoc filename, String JavaDoc elementname){
93         super(message, cause);
94         file = filename;
95         element = elementname;
96     }
97
98     /** Create ConfigurationException
99      * @param cause
100      * @param filename
101      * @param elementname
102      */

103     public ConfigurationException(Throwable JavaDoc cause, String JavaDoc filename, String JavaDoc elementname){
104         super(cause);
105         file = filename;
106         element = elementname;
107     }
108
109     /** Store the name of the configuration file that was being parsed
110      * when this exception occured.
111      * @param name
112      */

113     public void setFile(String JavaDoc name){
114         file = name;
115     }
116
117     /**
118      * @return name of configuration file being parsed when this exception occurred
119      */

120     public String JavaDoc getFile(){
121         return file;
122     }
123
124     /** Set the name of the element that was being parsed
125      * when this exception occured.
126      * @param target
127      */

128     public void setElement(String JavaDoc target){
129         element = target;
130     }
131     /**
132      * @return name of the element being parsed when this exception occurred
133      */

134     public String JavaDoc getElement(){
135         return element;
136     }
137
138 }
139
Popular Tags