Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.utils / src / main / java / org / gvsig / utils / ExceptionDescription.java @ 40561

History | View | Annotate | Download (5.21 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/* CVS MESSAGES:
25
 *
26
 * $Id: ExceptionDescription.java 29631 2009-06-29 16:56:19Z jpiera $
27
 * $Log$
28
 * Revision 1.2  2006-09-22 08:08:04  ldiaz
29
 * layerName y driverName gestionados/almacenados desde esta clase
30
 *
31
 * Revision 1.1  2006/09/21 17:04:52  azabala
32
 * First version in cvs
33
 *
34
 *
35
 */
36
package org.gvsig.utils;
37

    
38
/**
39
 * <p>Most exceptions produced in a layer, has common information (layer name, driver name, error description, error code).</p>
40
 * 
41
 * <p>An <code>ExceptionDescription</code> can provide this extra information describing the cause of the
42
 *  error, and more useful information to give to the user that works with a layer.<p>
43
 * 
44
 * @author azabala
45
 */
46
public abstract class ExceptionDescription {
47
        /**
48
         * <p>Code which identifies the kind of error which is the cause of this exception.</p>
49
         */
50
        private int errorCode;
51

    
52
        /**
53
         * <p>A description about the error which produced this exception.</p>
54
         */
55
        private String errorDescription;
56

    
57
        /**
58
         * <p>If this exception was produced using a driver, this attribute describes that driver.</p>
59
         */
60
        private String driverName;
61

    
62
        /**
63
         * <p>If this exception was produced using a layer, this attribute describes that layer.</p> 
64
         */
65
        private String layerName;
66
        
67
        /**
68
         * <p>Gets the name of the driver (if a driver was using) which this exception was produced.</p>
69
         * 
70
         * @return the name of the driver (if a driver was using) which this exception was produced
71
         */        
72
        public String getDriverName() {
73
                return driverName;
74
        }
75

    
76
        /**
77
         * <p>Sets the name of the driver (if a driver was using) which this exception was produced.</p>
78
         * 
79
         * @param driverName the name of the driver (if a driver was using) which this exception was produced
80
         */
81
        public void setDriverName(String driverName){
82
                this.driverName = driverName;
83
        }        
84

    
85
        /**
86
         * <p>Gets the name of the layer (if a layer was using) with that this exception was produced.</p>
87
         * 
88
         * @return the name of the layer (if a layer was using) with that this exception was produced
89
         */
90
        public String getLayerName() {
91
                return driverName;
92
        }
93

    
94
        /**
95
         * <p>Sets the name of the layer (if a layer was using) with that this exception was produced.</p>
96
         * 
97
         * @param layerName the name of the layer (if a layer was using) with that this exception was produced
98
         */
99
        public void setLayerName(String layerName){
100
                this.layerName = layerName;
101
        }        
102

    
103
        /**
104
         * <p>Sets the name of the layer (if a layer was using) with that this exception was produced.</p>
105
         * 
106
         * @param layerName the name of the layer (if a layer was using) with that this exception was produced
107
         */
108
        public ExceptionDescription() {
109
        }
110

    
111
        /**
112
         * <p>Creates a new <code>ExceptionDescription</code> with the useful values initialized.</p>
113
         * 
114
         * @param errorCode code which identifies the kind of error which is the cause of this exception
115
         * @param errorDescription description about the error which produced this exception
116
         */
117
        public ExceptionDescription(int errorCode, String errorDescription) {
118
                this.errorCode = errorCode;
119
                this.errorDescription = errorDescription;
120
        }
121

    
122
        /**
123
         * <p>Sets the code which identifies the kind of error which is the cause of this exception.</p>
124
         * 
125
         * @param errorCode code which identifies the kind of error which is the cause of this exception
126
         */
127
        public void setCode(int errorCode) {
128
                this.errorCode = errorCode;
129
        }
130

    
131
        /**
132
         * <p>Sets the description about the error which produced this exception.</p>
133
         * 
134
         * @param description description about the error which produced this exception
135
         */
136
        public void setDescription(String description) {
137
                this.errorDescription = description;
138
        }
139

    
140
        /**
141
         * <p>Gets the code which identifies the kind of error which is the cause of this exception.</p>
142
         * 
143
         * @return code which identifies the kind of error which is the cause of this exception
144
         */
145
        public int getErrorCode() {
146
                return errorCode;
147
        }
148

    
149
        /**
150
         * <p>Gets the description about the error which produced this exception.</p>
151
         * 
152
         * @return description about the error which produced this exception
153
         */
154
        public String getErrorDescription() {
155
                return errorDescription;
156
        }
157

    
158
        /**
159
         * <p>Returns a message that describes the error which produced this exception, formatted in HTML code.</p>
160
         * 
161
         * @return message that describes the error which produced this exception, formatted in HTML code
162
         */
163
        public abstract String getHtmlErrorMessage();
164
}