svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / resource / exception / ResourceException.java @ 40435
History | View | Annotate | Download (1.47 KB)
1 |
package org.gvsig.fmap.dal.resource.exception; |
---|---|
2 |
|
3 |
import java.util.HashMap; |
4 |
import java.util.Map; |
5 |
|
6 |
import org.gvsig.fmap.dal.exception.DataException; |
7 |
import org.gvsig.fmap.dal.resource.Resource; |
8 |
|
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 |
private Resource resource;
|
18 |
|
19 |
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 |
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 |
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 |
} |