KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > forms > factory > FormRepositoryException


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2006
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Felix Gnass [fgnass at neteye dot de]
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.forms.factory;
25
26 import org.springframework.core.io.Resource;
27
28 /**
29  * Exception thrown when a FormRepository encounters an internal error, and
30  * its definitions are invalid: for example, if an XML document containing
31  * form definitions isn't well-formed.
32  */

33 public class FormRepositoryException extends FormDefinitionException {
34
35     private String JavaDoc resourceDescription;
36
37     private String JavaDoc formId;
38     
39     
40     public FormRepositoryException(String JavaDoc msg) {
41         super(msg);
42     }
43
44     public FormRepositoryException(String JavaDoc msg, Throwable JavaDoc ex) {
45         super(msg, ex);
46     }
47     
48     /**
49      * Create a new FormRepositoryException.
50      * @param documentLocation descriptor of the resource
51      * location that the form definition came from
52      * @param formId the id of the form requested
53      * @param msg the detail message
54      */

55     public FormRepositoryException(Resource documentLocation,
56             String JavaDoc formId, String JavaDoc msg) {
57         
58         this(documentLocation.getDescription(), formId, msg, null);
59     }
60
61     /**
62      * Create a new FormRepositoryException.
63      * @param documentLocation descriptor of the resource
64      * location that the form definition came from
65      * @param formId the id of the form requested
66      * @param msg the detail message
67      * @param ex the root cause
68      */

69     public FormRepositoryException(Resource documentLocation,
70             String JavaDoc formId, String JavaDoc msg, Throwable JavaDoc ex) {
71         
72         this(documentLocation.getDescription(), formId, msg, ex);
73     }
74
75     /**
76      * Create a new FormRepositoryException.
77      * @param resourceDescription description of the resource
78      * that the form definition came from
79      * @param formId the id of the form requested
80      * @param msg the detail message
81      */

82     public FormRepositoryException(String JavaDoc resourceDescription,
83             String JavaDoc formId, String JavaDoc msg) {
84         
85         this(resourceDescription, formId, msg, null);
86     }
87
88     /**
89      * Create a new FormRepositoryException.
90      * @param resourceDescription description of the resource
91      * that the form definition came from
92      * @param formId the id of the form requested
93      * @param msg the detail message
94      * @param ex the root cause
95      */

96     public FormRepositoryException(String JavaDoc resourceDescription,
97             String JavaDoc formId, String JavaDoc msg, Throwable JavaDoc ex) {
98         
99         super("Error registering form with id '" + formId + "' defined in "
100                 + resourceDescription + ": " + msg, ex);
101         
102         this.resourceDescription = resourceDescription;
103         this.formId = formId;
104     }
105
106     /**
107      * Return the description of the resource that the form
108      * definition came from, if any.
109      */

110     public String JavaDoc getResourceDescription() {
111         return resourceDescription;
112     }
113
114     /**
115      * Return the id of the form requested, if any.
116      */

117     public String JavaDoc getFormId() {
118         return formId;
119     }
120
121 }
122
Popular Tags