01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.config;
17:
18: import org.apache.openejb.util.Messages;
19:
20: public class ValidationException extends java.lang.Exception {
21: protected static final Messages messages = new Messages(
22: "org.apache.openejb.config.rules");
23: protected Object[] details;
24: protected String message;
25: protected String prefix;
26: protected String componentName;
27:
28: public ValidationException(String message) {
29: this .message = message;
30: }
31:
32: public void setDetails(Object... details) {
33: this .details = details;
34: if (details == null) {
35: details = new Object[] {};
36: }
37: }
38:
39: public Object[] getDetails() {
40: return details;
41: }
42:
43: public String getSummary() {
44: return getMessage(1);
45: }
46:
47: public String getMessage() {
48: return getMessage(2);
49: }
50:
51: public String getMessage(int level) {
52: return messages.format(level + "." + message, details);
53: }
54:
55: public String getComponentName() {
56: return componentName;
57: }
58:
59: public void setComponentName(String componentName) {
60: this .componentName = componentName;
61: }
62:
63: public String getPrefix() {
64: return "";
65: }
66:
67: public String getCategory() {
68: return "";
69: }
70: }
|