Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / locator / LocatorReferenceException.java @ 31544

History | View | Annotate | Download (3.1 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {DiSiD Technologies}   {Create a base Locator implementation}
26
*/
27
package org.gvsig.tools.locator;
28

    
29
import java.util.HashMap;
30
import java.util.Map;
31

    
32
import org.gvsig.tools.exception.BaseRuntimeException;
33

    
34
/**
35
 * Exception for errors related to the retrieval of references through a
36
 * Locator.
37
 * 
38
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
39
 */
40
public class LocatorReferenceException extends LocatorException {
41

    
42
    private static final long serialVersionUID = -6623935035803501270L;
43

    
44
    private static final String KEY = "locator_exception";
45

    
46
    private static final String MESSAGE = "Error getting a reference to %(referenceName), "
47
            + "through the Locator %(locatorName)";
48
    
49
    private String referenceName;
50

    
51
    private String locatorName;
52
    
53
    public LocatorReferenceException(String referenceName, Locator locator) {
54
        this(MESSAGE, KEY, serialVersionUID, referenceName, locator);
55
    }
56
    
57
    public LocatorReferenceException(Throwable cause, String referenceName,
58
            Locator locator) {
59
        this(MESSAGE, cause, KEY, serialVersionUID, referenceName, locator);
60
    }
61
    
62
    public LocatorReferenceException(String message, String key, long code,
63
            String referenceName, Locator locator) {
64
        super(message, key, code);
65
        setReferenceName(referenceName);
66
        setLocatorName(locator.getLocatorName());
67
    }
68

    
69
    public LocatorReferenceException(String message, Throwable cause, String key,
70
            long code, String referenceName, Locator locator) {
71
        super(message, cause, key, code);
72
        setReferenceName(referenceName);
73
        setLocatorName(locator.getLocatorName());
74
    }
75
    
76
    protected Map values() {
77
        Map values = new HashMap(2);
78
        values.put("referenceName", getReferenceName());
79
        values.put("locatorName", getLocatorName());
80
        return values;
81
    }
82
    
83
    private String getReferenceName() {
84
        return referenceName;
85
    }
86
    
87
    private void setReferenceName(String name) {
88
        this.referenceName = name;
89
    }
90
    
91
    private String getLocatorName() {
92
        return locatorName;
93
    }
94

    
95
    private void setLocatorName(String name) {
96
        this.locatorName = name;
97
    }
98
}