01: // Copyright 2006 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.ioc.internal.services;
16:
17: import static java.util.Collections.unmodifiableList;
18:
19: import java.util.List;
20: import java.util.Map;
21:
22: import org.apache.tapestry.ioc.internal.util.InternalUtils;
23: import org.apache.tapestry.ioc.services.ExceptionInfo;
24:
25: public class ExceptionInfoImpl implements ExceptionInfo {
26: private final String _className;
27:
28: private final String _message;
29:
30: private final Map<String, Object> _properties;
31:
32: private final List<String> _stackTrace;
33:
34: public ExceptionInfoImpl(Throwable t,
35: Map<String, Object> properties, List<String> stackTrace) {
36: _className = t.getClass().getName();
37: _message = t.getMessage() != null ? t.getMessage() : "";
38:
39: _properties = properties;
40: _stackTrace = unmodifiableList(stackTrace);
41: }
42:
43: public String getClassName() {
44: return _className;
45: }
46:
47: public String getMessage() {
48: return _message;
49: }
50:
51: public Object getProperty(String name) {
52: return _properties.get(name);
53: }
54:
55: public List<String> getPropertyNames() {
56: return InternalUtils.sortedKeys(_properties);
57: }
58:
59: public List<String> getStackTrace() {
60: return _stackTrace;
61: }
62:
63: }
|