Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / DriverException.java @ 20100

History | View | Annotate | Download (5.48 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap;
42

    
43
import com.iver.utiles.ExceptionDescription;
44
import com.iver.utiles.IDescriptableException;
45

    
46
/**
47
 * <p>A <code>DriverException</code> is thrown if a driver fails. This exception doesn't reports about
48
 *  the cause of the failure, that task is made by its inner {@link ExceptionDescription ExceptionDescription}.</p>
49
 */
50
public class DriverException extends Exception implements IDescriptableException{
51
        
52
        /*
53
         * azabala.
54
         * El problema que tenemos es que una DriverException puede ser debida
55
         * a multiples causas, y para poder mostrar al usuario informaci?n de cara
56
         * a que subsane estas causas (sobretodo considerando el estado UnAvalaible
57
         * de un FLayer) seria necesario hacer un analisis exhaustivo de estas causas.
58
         * 
59
         * Por este motivo a?ado un ExceptionDescription a DriverException
60
         * (si finalmente DriverIOException tb lo requiere, habr?a que meter herencias)
61
         * que S? que tiene esta inforamaci?n.
62
         * 
63
         */
64
        /**
65
         * <p>Detailed information about the cause of this exception. It's useful for example for {@link DriverException DriverException}.</p>
66
         */
67
        private ExceptionDescription exceptionType;
68
        
69
        /**
70
         * <p>Constructs a new <code>DriverException</code> with the specified detail message. The cause is not
71
         *  initialized, and may subsequently be initialized by a call to initCause.</p>
72
         */
73
        public DriverException(String message) {
74
                super(message);
75
        }
76
        
77
        /**
78
         * <p>Constructs a new <code>DriverException</code> with the specified detail message and the exception which
79
         *  produced this one.</p>
80
         * 
81
         * @param message the detail message (which is saved for later retrieval by the getMessage() method).
82
         * @param type the exception which caused this one and has detailed information about the causes
83
         */
84
        public DriverException(String message, ExceptionDescription type){
85
                super(message);
86
                this.exceptionType = type;
87
        }
88
        
89
        /**
90
         * <p>Constructs a new <code>DriverException</code> with the specified detail message, cause and the original
91
         *  exception that produced this one. This second exception will have the complete information about the causes.</p>
92
         * <p>Note that the detail message associated with the cause is not automatically incorporated
93
         *  in this exception's detail message.</p>
94
         *
95
         * @param message the detail message (which is saved for later retrieval calling <code>getMessage()</code>).
96
         * @param cause the cause (which is saved for later retrieval calling <code>getCause()</code>)). (A <code>null</code>
97
         *  value is permitted, and indicates that the cause is nonexistent or unknown.)
98
         * @param exceptionType detailed information about the cause of this exception
99
         */
100
        public DriverException(String message, 
101
                                                        Throwable cause, 
102
                                                ExceptionDescription exceptionType){
103
                super(message, cause);
104
                this.exceptionType = exceptionType;
105
        }
106
        
107
        /**
108
         * <p>Gets the exception which caused this one and has detailed information about the causes.</p>
109
         *
110
         * @return the exception which caused this one and has detailed information about the causes
111
         */
112
        public ExceptionDescription getExceptionType(){
113
                if(exceptionType != null)
114
                        return exceptionType;
115
                else return null;
116
//                else 
117
//                        return ExceptionDescription.getType("GENERIC");
118
        }
119

    
120
        /**
121
         * <p>Constructs a new <code>DriverException</code> with the specified detail message and cause.</p>
122
         * 
123
         * @param message the detail message (which is saved for later retrieval calling <code>getMessage()</code>).
124
         * @param cause the cause (which is saved for later retrieval calling <code>getCause()</code>). (A <code>null</code>
125
         *  value is permitted, and indicates that the cause is nonexistent or unknown.)
126
         */
127
        public DriverException(String message, Throwable cause) {
128
                super(message, cause);
129
        }
130

    
131
        /**
132
         * @see Exception#Exception(Throwable)
133
         */
134
        public DriverException(Throwable cause) {
135
                super(cause);
136
        }
137

    
138
        /**
139
         * <p>Constructs a new <code>DriverException</code> with the cause and a description.</p>
140
         * 
141
         * @param cause the cause (which is saved for later retrieval calling <code>getCause()</code>). (A <code>null</code>
142
         *  value is permitted, and indicates that the cause is nonexistent or unknown.)
143
         * @param type the exception which caused this one and has detailed information about the causes
144
         */
145
        public DriverException(Throwable cause, ExceptionDescription type){
146
                super(cause);
147
                this.exceptionType = type;
148
        }
149
}