01: /*
02: * The contents of this file are subject to the Sapient Public License
03: * Version 1.0 (the "License"); you may not use this file except in compliance
04: * with the License. You may obtain a copy of the License at
05: * http://carbon.sf.net/License.html.
06: *
07: * Software distributed under the License is distributed on an "AS IS" basis,
08: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
09: * 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.node;
19:
20: import org.sape.carbon.core.config.ConfigurationException;
21:
22: /**
23: * Base exception for all exceptions in the node package.
24: *
25: * Copyright 2002 Sapient
26: * @since carbon 1.0
27: * @author Douglas Voet, February 2002
28: * @version $Revision: 1.11 $($Author: dvoet $ / $Date: 2003/05/05 21:21:18 $)
29: */
30: public abstract class NodeException extends ConfigurationException {
31:
32: /**
33: * The name of the node on which the exception occured.
34: */
35: protected String nodeName;
36:
37: /**
38: * Constructs the base NodeException.
39: *
40: * @param sourceClass the class in which this exception was caused.
41: * @param nodeName the name of the configuration node to which this
42: * failure is related.
43: * @param message the message describing the failure and how to fix it.
44: * @param previousException the exception that may have caused this
45: * failure.
46: */
47: public NodeException(Class sourceClass, String nodeName,
48: String message, Throwable previousException) {
49: super (sourceClass, "Node: [" + nodeName + "] " + message,
50: previousException);
51: this .nodeName = nodeName;
52: }
53:
54: /**
55: * Constructs the base NodeException.
56: *
57: * @param sourceClass the class in which this exception was caused.
58: * @param nodeName the name of the configuration node to which this
59: * failure is related.
60: * @param message the message describing the failure and how to fix it.
61: */
62: public NodeException(Class sourceClass, String nodeName,
63: String message) {
64: super (sourceClass, "[" + nodeName + "] " + message);
65: this .nodeName = nodeName;
66: }
67:
68: /**
69: * Retrieves the name of the node on which the exception occurred.
70: * @return the name of the node on which the exception occured.
71: * @since carbon 2.0
72: */
73: public String getNodeName() {
74: return this.nodeName;
75: }
76:
77: }
|