root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / resource / exception / ResourceException.java @ 24496
History | View | Annotate | Download (1.48 KB)
1 | 24496 | jmvivo | package org.gvsig.fmap.dal.resource.exception; |
---|---|---|---|
2 | 23875 | jjdelcerro | |
3 | import java.util.HashMap; |
||
4 | import java.util.Map; |
||
5 | |||
6 | 24496 | jmvivo | import org.gvsig.fmap.dal.exceptions.DataException; |
7 | import org.gvsig.fmap.dal.resource.Resource; |
||
8 | 23875 | jjdelcerro | |
9 | public abstract class ResourceException extends DataException { |
||
10 | /**
|
||
11 | *
|
||
12 | */
|
||
13 | private static final long serialVersionUID = 1L; |
||
14 | |||
15 | protected Map values = new HashMap(); |
||
16 | |||
17 | 23898 | jjdelcerro | private Resource resource;
|
18 | |||
19 | 23875 | jjdelcerro | public ResourceException(String messageFormat, Throwable cause, |
20 | String messageKey, long code) { |
||
21 | super(messageFormat, cause, messageKey, code);
|
||
22 | } |
||
23 | |||
24 | public ResourceException(String messageFormat, String messageKey, long code) { |
||
25 | super(messageFormat, messageKey, code);
|
||
26 | } |
||
27 | |||
28 | 23898 | jjdelcerro | public ResourceException(Resource resource, String messageFormat, |
29 | Throwable cause, String messageKey, long code) { |
||
30 | super(messageFormat, cause, messageKey, code);
|
||
31 | this.resource = resource;
|
||
32 | try {
|
||
33 | setValue("resource", resource.getName());
|
||
34 | } catch (AccessResourceException e) {
|
||
35 | setValue("resource", "unknow"); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | public ResourceException(Resource resource, String messageFormat, |
||
40 | String messageKey, long code) { |
||
41 | super(messageFormat, messageKey, code);
|
||
42 | this.resource = resource;
|
||
43 | try {
|
||
44 | setValue("resource", resource.getName());
|
||
45 | } catch (AccessResourceException e) {
|
||
46 | setValue("resource", "unknow"); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | public Resource getResource() {
|
||
51 | return resource;
|
||
52 | } |
||
53 | |||
54 | 23875 | jjdelcerro | protected void setValue(String name, String value) { |
55 | this.values.put(name, value);
|
||
56 | } |
||
57 | |||
58 | protected Map values() { |
||
59 | return this.values; |
||
60 | } |
||
61 | } |