Statistics
| Revision:

root / trunk / libraries / libGPE / src / org / gvsig / gpe / warnings / NotSupportedLayerWarning.java @ 12418

History | View | Annotate | Download (3.35 KB)

1
package org.gvsig.gpe.warnings;
2

    
3
import java.util.Hashtable;
4
import java.util.Map;
5

    
6
import org.gvsig.exceptions.BaseException;
7

    
8
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
9
 *
10
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
11
 *
12
 * This program is free software; you can redistribute it and/or
13
 * modify it under the terms of the GNU General Public License
14
 * as published by the Free Software Foundation; either version 2
15
 * of the License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
25
 *
26
 * For more information, contact:
27
 *
28
 *  Generalitat Valenciana
29
 *   Conselleria d'Infraestructures i Transport
30
 *   Av. Blasco Ib??ez, 50
31
 *   46010 VALENCIA
32
 *   SPAIN
33
 *
34
 *      +34 963862235
35
 *   gvsig@gva.es
36
 *      www.gvsig.gva.es
37
 *
38
 *    or
39
 *
40
 *   IVER T.I. S.A
41
 *   Salamanca 50
42
 *   46005 Valencia
43
 *   Spain
44
 *
45
 *   +34 963163400
46
 *   dac@iver.es
47
 */
48
/* CVS MESSAGES:
49
 *
50
 * $Id: NotSupportedLayerWarning.java 12418 2007-06-29 12:19:48Z jorpiell $
51
 * $Log$
52
 * Revision 1.1  2007-06-29 12:19:14  jorpiell
53
 * The schema validation is made independently of the concrete writer
54
 *
55
 *
56
 */
57
/**
58
 * It is thrown when there is an layer that can not
59
 * be validated using the XML Schema
60
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
61
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
62
 */
63
public class NotSupportedLayerWarning extends BaseException{
64
        private static final long serialVersionUID = -6929364975278666066L;
65
        private String layerName = null;
66
        private String xsLayerType = null;
67
        private String parentLayerName = null;
68
        private String xsParentLayerType = null;        
69
        private boolean hasParent = false;
70

    
71
        public NotSupportedLayerWarning(String layerName, String xsLayerType, String parentLayerName, String xsParentLayerType) {
72
                super();
73
                this.layerName = layerName;
74
                this.xsLayerType = xsLayerType;
75
                this.parentLayerName = parentLayerName;
76
                this.xsParentLayerType = xsParentLayerType;
77
                hasParent = true;
78
                initialize();
79
        }
80
        
81
        public NotSupportedLayerWarning(String layerName, String xsLayerType) {
82
                super();
83
                this.layerName = layerName;
84
                this.xsLayerType = xsLayerType;
85
                hasParent = false;
86
                initialize();
87
        }
88

    
89
        /**
90
         * Initialize the properties
91
         */
92
        private void initialize() {
93
                messageKey = "gpe_not_supported_layer_warning";
94
                if (hasParent){
95
                        formatString = "The layer '%(layerName)' with a XML schema " + 
96
                        "type '%(xsLayerType)' is not contained in the parent layer " +
97
                        "'%(parentLayerName)' with a XML Schema type '%(xsParentLayerType)'";
98
                }else{
99
                        formatString = "The layer '%(layerName)' with a XML schema " + 
100
                        "type '%(xsLayerType)' is not valid in the XML Schema";
101
                }
102
                code = serialVersionUID;
103
        }
104
        
105
        /*
106
         * (non-Javadoc)
107
         * @see org.gvsig.exceptions.BaseException#values()
108
         */
109
        protected Map values() {
110
                Hashtable hash = new Hashtable();
111
                hash.put("layerName", layerName);
112
                hash.put("xsLayerType", xsLayerType);
113
                if (hasParent){
114
                        hash.put("parentLayerName", parentLayerName);
115
                        hash.put("xsParentLayerType", xsParentLayerType);
116
                }
117
                return hash;
118
        }
119
}