Statistics
| Revision:

gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.algorithm / org.gvsig.geoprocess.algorithm.base / src / main / java / org / gvsig / geoprocess / algorithm / base / visitor / exception / VisitorException.java @ 237

History | View | Annotate | Download (2.14 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007,2012 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 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
package org.gvsig.geoprocess.algorithm.base.visitor.exception;
22

    
23
import java.util.Hashtable;
24
import java.util.Map;
25

    
26
import org.gvsig.tools.exception.BaseException;
27

    
28
/**
29
 * <p>The information of a layer or group of layers is accessed using the *strategy* and *visitor* software patterns. If
30
 *  any problem is produced accessing that information in that way, a <code>VisitException</code> will be produced.</p>
31
 *
32
 * @author Vicente Caballero Navarro
33
 */
34
public class VisitorException extends BaseException {
35
        private static final long serialVersionUID = 1L;
36
        private String layer = null;
37
        /**
38
          * <p>Constructs an visitor exception with the specified cause, and the layer where this exception was produced.</p>
39
          * 
40
          * @param layer the layer affected
41
         * @param exception an exception with the cause
42
         */
43
        @SuppressWarnings("deprecation")
44
        public VisitorException(String layer,Throwable exception) {
45
                this.layer = layer;
46
                init();
47
                initCause(exception);
48
        }
49

    
50
        /**
51
         * <p>Prepares the messages to display.</p>
52
         */
53
        private void init() {
54
                messageKey = "error_visitor";
55
                formatString = "Can�t visit the layer: %(layer) ";
56
        }
57

    
58
        /*
59
         * (non-Javadoc)
60
         * @see org.gvsig.exceptions.BaseException#values()
61
         */
62
        @SuppressWarnings("unchecked")
63
        protected Map values() {
64
                Hashtable params = new Hashtable();
65
                params.put("layer",layer);
66
                return params;
67
        }
68
}