Revision 29267

View differences:

tags/tmp_build/libraries/libGPE/build.number
1
#Build Number for ANT. Do not edit!
2
#Fri Jan 18 13:15:23 GMT+01:00 2008
3
build.number=3
4

  
0 5

  
tags/tmp_build/libraries/libGPE/src/META-INF/services/org.gvsig.gpe.IGPEProperties
1
org.gvsig.gpe.GPEProperties
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/GPEDefaults.java
1
package org.gvsig.gpe;
2

  
3
import java.util.Iterator;
4
import java.util.Properties;
5

  
6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
7
 *
8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
23
 *
24
 * For more information, contact:
25
 *
26
 *  Generalitat Valenciana
27
 *   Conselleria d'Infraestructures i Transport
28
 *   Av. Blasco Ib??ez, 50
29
 *   46010 VALENCIA
30
 *   SPAIN
31
 *
32
 *      +34 963862235
33
 *   gvsig@gva.es
34
 *      www.gvsig.gva.es
35
 *
36
 *    or
37
 *
38
 *   IVER T.I. S.A
39
 *   Salamanca 50
40
 *   46005 Valencia
41
 *   Spain
42
 *
43
 *   +34 963163400
44
 *   dac@iver.es
45
 */
46
/* CVS MESSAGES:
47
 *
48
 * $Id: GPEDefaults.java 373 2008-01-10 09:33:05Z jpiera $
49
 * $Log$
50
 * Revision 1.10  2007/06/20 09:35:37  jorpiell
51
 * Add the javadoc comments
52
 *
53
 * Revision 1.9  2007/06/07 14:52:28  jorpiell
54
 * Add the schema support
55
 *
56
 * Revision 1.8  2007/05/15 10:39:14  jorpiell
57
 * Add the number of decimals property
58
 *
59
 * Revision 1.7  2007/05/15 09:34:39  jorpiell
60
 * the tag names cant have blanc spaces
61
 *
62
 * Revision 1.6  2007/04/26 14:23:16  jorpiell
63
 * Add a getStringProperty method
64
 *
65
 * Revision 1.5  2007/04/19 11:50:20  csanchez
66
 * Actualizacion protoripo libGPE
67
 *
68
 * Revision 1.4  2007/04/18 11:03:36  jorpiell
69
 * Add the default schema property
70
 *
71
 * Revision 1.3  2007/04/14 16:06:13  jorpiell
72
 * The writer handler has been updated
73
 *
74
 * Revision 1.2  2007/04/12 17:06:42  jorpiell
75
 * First GML writing tests
76
 *
77
 * Revision 1.1  2007/04/12 11:39:20  jorpiell
78
 * Add the GPEDefaults class
79
 *
80
 *
81
 */
82
/**
83
 * This class is used to add properties that can be used
84
 * by the GPE parsers and writers.
85
 * <p>
86
 * It is not possible for the consumer application to have any
87
 * dependence with a concrete parser or writer. But sometimes it
88
 * is necessary to establish some configuration parameters
89
 * (principally to write). This class provides a mechanism to
90
 * set all these parameters using the SPI (Service Provider Interface) 
91
 * mechanism  
92
 * </p>
93
 * <h2>Implementation Lookup</h2>
94
 * <p>
95
 * The SPI provides a mechanism to register a set of properties that
96
 * both the parsers and the writers need to work. Every parser (or writer)
97
 * is the responsible to create a set of parameters and register them
98
 * in this class
99
 * </p>
100
 * <p> 
101
 * To register a set of properties a file named <code>org.gvsig.gpe.IGPEProperties</code>
102
 * shall exist in the class path in the implementation's <code>META-INF/services</code> folder.
103
 * </p>
104
 * <p>
105
 * The content of the files for a given implementation consists of full qualified 
106
 * class names, one per line. For example, an hypotetical <code>MyParserProperties</code> 
107
 * in the package <code>org.gvsi.gpe.format</code> and bundled in a jar file 
108
 * called <code>org.gvsig.gpe.format.jar</code> shall provide the following 
109
 * resources:
110
 *  
111
 * <pre>
112
 * <code>
113
 * $jar tvf org.gvsi.gpe.format.jar
114
 * META-INF/services/org.gvsig.gpe.IGPEProperties
115
 * org/gvsig/gpe/MyParserProperties.class
116
 * </code>
117
 * </pre>
118
 * 
119
 * And the content of the file <code>META-INF/services/org.gvsig.gpe.IGPEProperties</code> 
120
 * shall be a single line of text with the <code>org.gpe.gpe.format</code> class name.
121
 * 
122
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
123
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
124
 */
125
public class GPEDefaults {
126
	private static Properties properties = new Properties();
127
				
128
	static{				
129
		Iterator providers = availableProperties();
130
		while (providers.hasNext()) {
131
			IGPEProperties next = (IGPEProperties) providers.next();
132
			Properties parserProperties = next.getProperties();
133
			Iterator it = parserProperties.keySet().iterator();
134
			while (it.hasNext()){
135
				String key = (String)it.next();				
136
				properties.put(key, parserProperties.get(key));
137
			}			
138
		}
139
	}
140
	
141
	/**
142
	 * Returns an iterator over instances of the registered GPE properties.
143
	 * @return all the registered GPE properties
144
	 */
145
	private static Iterator availableProperties() {
146
		Iterator providers = sun.misc.Service.providers(IGPEProperties.class);
147
		return providers;
148
	}
149
	
150
	/**
151
	 * Returns an iterator with the name of all the properties that 
152
	 * has been established.
153
	 */
154
	public static Iterator getKeys(){
155
		return properties.keySet().iterator();
156
	}
157
	
158
	/**
159
	 * Gets a String property
160
	 * @param key
161
	 * Property name
162
	 * @return
163
	 */
164
	public static String getStringProperty(String key){
165
		Object obj = getProperty(key);
166
		if (obj == null){
167
			return null;
168
		}
169
		return (String)obj;
170
	}
171
	
172
	/**
173
	 * Gets a int property
174
	 * @param key
175
	 * Property name
176
	 * @return
177
	 * The int property or -1
178
	 */
179
	public static int getIntPropertyProperty(String key){
180
		Object obj = getProperty(key);
181
		if (obj == null){
182
			return -1;
183
		}
184
		if (obj instanceof Integer){
185
			return ((Integer)obj).intValue();
186
		}return -1;
187
	}
188
	
189
	/**
190
	 * Gets a boolean property. If the property doesn't exist
191
	 * it returns false.
192
	 * @param key
193
	 * Property name
194
	 * @return
195
	 * The boolean property or false
196
	 */
197
	public static boolean getBooleanProperty(String key){
198
		Object obj = getProperty(key);
199
		if (obj == null){
200
			return false;
201
		}
202
		if (obj instanceof Boolean){
203
			return ((Boolean)obj).booleanValue();
204
		}return false;
205
	}
206
	
207
	/**
208
	 * Gets a property
209
	 * @param key
210
	 * Property name
211
	 * @return
212
	 */
213
	public static Object getProperty(String key){
214
		return properties.get(key);
215
	}
216
	
217
	/**
218
	 * Sets a property
219
	 * @param key
220
	 * @param value
221
	 */
222
	public static void setProperty(String key, Object value){
223
		properties.put(key, value);
224
	}
225
	
226
	
227
}
0 228

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/GPEFactory.java
1
package org.gvsig.gpe;
2

  
3
import java.net.URI;
4
import java.util.Iterator;
5

  
6
import org.gvsig.gpe.exceptions.ParserCreationException;
7
import org.gvsig.gpe.exceptions.ParserFileNotSupportedException;
8
import org.gvsig.gpe.exceptions.ParserMimetypeNotSupportedException;
9
import org.gvsig.gpe.exceptions.ParserNameNotFoundException;
10
import org.gvsig.gpe.exceptions.ParserNotRegisteredException;
11
import org.gvsig.gpe.exceptions.WriterHandlerCreationException;
12
import org.gvsig.gpe.exceptions.WriterHandlerMimeTypeNotSupportedException;
13
import org.gvsig.gpe.exceptions.WriterHandlerNotRegisteredException;
14
import org.gvsig.gpe.parser.GPEParser;
15
import org.gvsig.gpe.writer.GPEWriterHandler;
16
import org.gvsig.gpe.writer.IGPEWriterHandlerImplementor;
17

  
18
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
19
 *
20
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
21
 *
22
 * This program is free software; you can redistribute it and/or
23
 * modify it under the terms of the GNU General Public License
24
 * as published by the Free Software Foundation; either version 2
25
 * of the License, or (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
35
 *
36
 * For more information, contact:
37
 *
38
 *  Generalitat Valenciana
39
 *   Conselleria d'Infraestructures i Transport
40
 *   Av. Blasco Ib??ez, 50
41
 *   46010 VALENCIA
42
 *   SPAIN
43
 *
44
 *      +34 963862235
45
 *   gvsig@gva.es
46
 *      www.gvsig.gva.es
47
 *
48
 *    or
49
 *
50
 *   IVER T.I. S.A
51
 *   Salamanca 50
52
 *   46005 Valencia
53
 *   Spain
54
 *
55
 *   +34 963163400
56
 *   dac@iver.es
57
 */
58
/* CVS MESSAGES:
59
 *
60
 * $Id: GPERegister.java 282 2007-12-20 11:55:56Z jpiera $
61
 * $Log$
62
 * Revision 1.16  2007/06/28 13:04:33  jorpiell
63
 * The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
64
 *
65
 * Revision 1.15  2007/06/20 09:35:37  jorpiell
66
 * Add the javadoc comments
67
 *
68
 * Revision 1.14  2007/05/16 12:34:55  csanchez
69
 * GPEParser Prototipo final de lectura
70
 *
71
 * Revision 1.13  2007/05/09 06:54:07  jorpiell
72
 * Change the File by URI
73
 *
74
 * Revision 1.12  2007/05/08 12:57:14  jorpiell
75
 * Add the register exceptions
76
 *
77
 * Revision 1.11  2007/05/07 07:06:26  jorpiell
78
 * Add a constructor with the name and the description fields
79
 *
80
 * Revision 1.10  2007/04/19 11:50:20  csanchez
81
 * Actualizacion protoripo libGPE
82
 *
83
 * Revision 1.9  2007/04/19 07:23:20  jorpiell
84
 * Add the add methods to teh contenhandler and change the register mode
85
 *
86
 * Revision 1.8  2007/04/18 12:54:45  csanchez
87
 * Actualizacion protoripo libGPE
88
 *
89
 * Revision 1.7  2007/04/17 07:53:55  jorpiell
90
 * Before to start a new parsing process, the initialize method of the content handlers is throwed
91
 *
92
 * Revision 1.6  2007/04/17 06:26:54  jorpiell
93
 * Fixed one problem with a index
94
 *
95
 * Revision 1.5  2007/04/14 16:06:13  jorpiell
96
 * The writer handler has been updated
97
 *
98
 * Revision 1.4  2007/04/12 17:06:42  jorpiell
99
 * First GML writing tests
100
 *
101
 * Revision 1.3  2007/04/11 11:10:27  jorpiell
102
 * Cambiado el nombre de getDriver a GetParser
103
 *
104
 * Revision 1.2  2007/04/11 08:54:24  jorpiell
105
 * A?adidos algunos comentarios
106
 *
107
 * Revision 1.1  2007/04/11 08:52:55  jorpiell
108
 * Se puede registrar una clase por nombre
109
 *
110
 * Revision 1.1  2007/04/11 08:22:41  jorpiell
111
 * GPE clase para registrar los drivers
112
 *
113
 *
114
 */
115
/**
116
 * API entry point to create parsers and writers based on MIME-Type identification.
117
 * <p>
118
 * This factory uses a SPI (Service Provider Interface) mechanism to look up for {@link GPEParser}
119
 * and {@link IGPEWriterHandlerImplementor} implementations that can deal with a requested
120
 * MIME-Type.
121
 * </p>
122
 * <h2>Implementation Lookup</h2>
123
 * <p>
124
 * The SPI mechanism keeps parser implementations decoupled from client applications allowing the
125
 * transparent interchange of implementation, thus defining a format plugin system.
126
 * </p>
127
 * <p>
128
 * Parser and Writer implementations registers themselves lazily by providing a small configuration
129
 * file bundled together with the rest of the implementation resources. This configuration file
130
 * consist of a text file at a specific location and with an specific file name, this factory look
131
 * up mechanism will search for in order to find out the implementation class names.
132
 * </p>
133
 * <p>
134
 * To register a GPEParser implememntation, a file named <code>org.gvsig.gpe.parser.GPEParser</code>
135
 * shall exist in the class path (hence the ability to have multiple files equally namded budled in
136
 * different jar files), in the implementation's <code>META-INF/services</code> folder.
137
 * </p>
138
 * <p>
139
 * To register a Writer handler implementation, the same approach shall be followed with a file
140
 * named <code>META-INF/services/org.gvsig.gpe.writer.IGPEWriterHandlerImplementor</code>
141
 * </p>
142
 * <p>
143
 * The content of both files for a given implementation consists of full qualified class names, one
144
 * per line. For example, an hypotetical <code>MyFormatParser</code> in the package
145
 * <code>org.mycompany.gpe</code> and bundled in a jar file called <code>myformat.jar</code>
146
 * shall provide the following resources:
147
 * 
148
 * <pre>
149
 * <code>
150
 * $jar tvf myformat.jar
151
 * META-INF/services/org.gvsig.gpe.parser.GPEParser
152
 * org/mycompany/gpe/MyFormatParser.class
153
 * </code>
154
 * </pre>
155
 * 
156
 * And the content of the file <code>META-INF/services/org.gvsig.gpe.parser.GPEParser</code> shall
157
 * be a single line of text with the <code>org.mycompany.gpe.MyFormatParser</code> class name.
158
 * 
159
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
160
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
161
 */
162
public class GPEFactory {
163

  
164
	/**
165
	 * Returns an iterator over instances of the registered parsers.
166
	 * <p>
167
	 * NOTE: since GPEParser is an abstract and statefull class rather than an interface, this
168
	 * method shall stay private in order to ensure we return a new instance for the required format
169
	 * every time.
170
	 * </p>
171
	 * 
172
	 * @return all the registered parsers
173
	 */
174
	private static Iterator availableParsers() {
175
		Iterator providers = sun.misc.Service.providers(GPEParser.class);
176
		return providers;
177
	}
178

  
179
	/**
180
	 * Returns an iterator over instances of the registered writers.
181
	 * <p>
182
	 * NOTE: since GPEWriter is an abstract and statefull class rather than an interface, this
183
	 * method shall stay private in order to ensure we return a new instance for the required format
184
	 * every time.
185
	 * </p>
186
	 * 
187
	 * @return all the registered writers
188
	 */
189
	private static Iterator availableWriters() {
190
		Iterator providers = sun.misc.Service.providers(IGPEWriterHandlerImplementor.class);
191
		return providers;
192
	}
193

  
194
	/**
195
	 * Create a new parser from a class name. This method can be used 
196
	 * if the class name is known but, the common method to get a parser
197
	 * is using the mime type.     * 
198
	 * @param prefferredImplClassName
199
	 * The name of the class that implements {@link GPEParser}
200
	 * @return
201
	 * A parser for a concrete format
202
	 * @throws ParserCreationException
203
	 * If it is not possible to create a parser
204
	 */
205
	public static GPEParser createParserByClass(String prefferredImplClassName) throws ParserCreationException {
206
		Class prefferredImplClass = null;
207
		try {
208
			prefferredImplClass = Class.forName(prefferredImplClassName);
209
		} catch (ClassNotFoundException e) {
210
			throw new ParserCreationException(e);
211
		}
212

  
213
		Iterator providers = availableParsers();
214
		while (providers.hasNext()) {
215
			GPEParser next = (GPEParser) providers.next();
216
			if (prefferredImplClass.isInstance(next)) {
217
				return next;
218
			}
219
		}
220
		throw new ParserNotRegisteredException(prefferredImplClassName) ;
221
	}
222

  
223
	/**
224
	 * Create a new parser from a parser name. This method can be used 
225
	 * if the parser name is known but, the common method to get a parser
226
	 * is using the mime type.
227
	 * @param name 
228
	 * The name of the parser, that is returned by the {@link GPEParser#getName}
229
	 * method    
230
	 * @return
231
	 * A parser for a concrete format
232
	 * @throws ParserCreationException
233
	 * If it is not possible to create a parser 
234
	 */  
235
	public static GPEParser createParser(String name) throws ParserCreationException {
236
		Iterator providers = availableParsers();
237
		while (providers.hasNext()) {
238
			GPEParser parser = (GPEParser) providers.next();
239
			if (parser.getName().compareTo(name) == 0) {
240
				return parser;
241
			}
242
		}
243
		throw new ParserNameNotFoundException(name);
244
	}
245

  
246
	/**
247
	 * Create a new parser from a {@link URI}. Each parser has a method
248
	 * named {@link GPEParser#accept(URI)} that return true if the
249
	 * parser can be open the file.
250
	 * <p>
251
	 *	This method retrieve all the registered parsers and invoke the
252
	 * <code>accept</code> method. The first parser that retuns true 
253
	 * is returned. It means that if there are more that one parser
254
	 * to open a concrete file the first parser found will be returned. 
255
	 * </p>
256
	 * @param uri
257
	 * The place where the file is located
258
	 * @return
259
	 * A parser for a concrete format
260
	 * @throws ParserCreationException
261
	 * If it is not possible to create a parser
262
	 */
263
	public static GPEParser createParser(URI uri) throws ParserCreationException {
264
		Iterator providers = availableParsers();
265
		while (providers.hasNext()) {
266
			GPEParser parser = (GPEParser) providers.next();
267
			if (parser.accept(uri)) {
268
				return parser;
269
			}
270
		}
271
		throw new ParserFileNotSupportedException(uri);
272
	}
273

  
274
	/**
275
	 * Create a new parser from a mime type. Each parser has a method
276
	 * named {@link GPEParser#getFormat()} that returns the mimetype
277
	 * that the parser can read. One parser only supports one mimetype.
278
	 * <p>
279
	 * This method retrieve all the parsers and returns the first
280
	 * parser that is able to read the mimetype. If there are more
281
	 * parsers that can open the file will not be used.
282
	 * </p>
283
	 * @param mimeType
284
	 * The mimetype of the file to open
285
	 * @return
286
	 * A parser that can parse the mimetype.
287
	 * @throws ParserCreationException
288
	 * If it is not possible to create a parser
289
	 * @see 
290
	 * <a href="http://www.iana.org/assignments/media-types/">http://www.iana.org/assignments/media-types/</a>
291
	 */
292
	public static GPEParser createParserByMimeType(String mimeType) throws ParserCreationException {
293
		Iterator providers = availableParsers();
294
		while (providers.hasNext()) {
295
			GPEParser parser = (GPEParser) providers.next();
296
			if (parser.getFormat().equals(mimeType)) {
297
				return parser;
298
			}
299
		}
300
		throw new ParserMimetypeNotSupportedException(mimeType);
301
	}
302

  
303
	/**
304
	 * Create a new writer from a writer name. This method can be used 
305
	 * if the writer name is known but, the common method to get a writer
306
	 * is using the mime type.
307
	 * @param name 
308
	 * The name of the writer, that is returned by the {@link GPEWriterHandler#getName}
309
	 * method    
310
	 * @return
311
	 * A writer for a concrete format 
312
	 * @throws WriterHandlerCreationException
313
	 * If it is not possible to create a writer
314
	 */     
315
	public static GPEWriterHandler createWriter(String name)
316
		throws WriterHandlerCreationException {
317
		Iterator providers = availableWriters();
318
		while (providers.hasNext()) {
319
			IGPEWriterHandlerImplementor implementor = (IGPEWriterHandlerImplementor) providers
320
			.next();
321
			if (implementor.getName().compareTo(name) == 0) {
322
				return new GPEWriterHandler(implementor);
323
			}
324
		}
325
		return null;
326
	}
327

  
328
	/**
329
	 * Create a new writer from a class name. This method can be used 
330
	 * if the class name is known but, the common method to get a writer
331
	 * is using the mime type.     * 
332
	 * @param prefferredImplClassName
333
	 * The name of the class that implements {@link GPEWriterHandler}
334
	 * @return
335
	 * A writer for a concrete format.
336
	 * @throws WriterHandlerCreationException
337
	 * If it is not possible to create a writer
338
	 */
339
	public static GPEWriterHandler createWriterByClass(String prefferredImplClassName) 
340
		throws WriterHandlerCreationException {
341
		Class prefferredImplClass = null;
342
		try {
343
			prefferredImplClass = Class.forName(prefferredImplClassName);
344
		} catch (ClassNotFoundException e) {
345
			throw new WriterHandlerCreationException(e);
346
		}
347

  
348
		Iterator providers = availableWriters();
349
		while (providers.hasNext()) {
350
			IGPEWriterHandlerImplementor next = (IGPEWriterHandlerImplementor) providers.next();
351
			if (prefferredImplClass.isInstance(next)) {
352
				return new GPEWriterHandler(next);
353
			}
354
		}
355
		throw new WriterHandlerNotRegisteredException(prefferredImplClassName);
356
	}
357

  
358
	/**
359
	 * Create a new writer from a mime type. Each writer has a method
360
	 * named {@link GPEWriterHandler#getFormat()} that returns the mimetype
361
	 * that the writer can write. One writer only supports one mimetype.
362
	 * <p>
363
	 * This method retrieve all the writers and returns the first
364
	 * one that is able to write the mimetype. If there are more
365
	 * writer that can write the format will not be used.
366
	 * </p>
367
	 * @param mimeType
368
	 * The mimetype of the file to write
369
	 * @return
370
	 * A writer that can write the mimetype.
371
	 * @throws WriterHandlerCreationException
372
	 * If it is not possible to create a writer
373
	 * @see 
374
	 * <a href="http://www.iana.org/assignments/media-types/">http://www.iana.org/assignments/media-types/</a>
375
	 */
376
	public static GPEWriterHandler createWriterByMimeType(String mimeType)
377
		throws WriterHandlerCreationException {
378
		Iterator providers = availableWriters();
379
		while (providers.hasNext()) {
380
			IGPEWriterHandlerImplementor implementor = (IGPEWriterHandlerImplementor) providers
381
			.next();
382
			if (implementor.getFormat().equals(mimeType)) {
383
				return new GPEWriterHandler(implementor);
384
			}
385
		}
386
		throw new WriterHandlerMimeTypeNotSupportedException(mimeType);
387
	}
388

  
389
	/**
390
	 * Return <code>true</code> if there is a parser that is able to 
391
	 * open the file or <code>false</code> instead.
392
	 * @param uri
393
	 * The file to open
394
	 * @return
395
	 * <code>true</code> if there is a parser that is able to open the file
396
	 */
397
	public static boolean accept(URI uri) {
398
		Iterator providers = availableParsers();
399
		while (providers.hasNext()) {
400
			GPEParser parser = (GPEParser) providers.next();
401
			if (parser.accept(uri)) {
402
				return true;
403
			}
404
		}
405
		return false;
406
	}
407
}
0 408

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/GPEProperties.java
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 Iver T.I.  {{Task}}
26
*/
27
 
28
package org.gvsig.gpe;
29

  
30
import java.util.Properties;
31

  
32
/**
33
 * This class contains the generic properties for all the 
34
 * GPE parsers and writers. This class has been registered using
35
 * the SPI (Service Provider Interface) and the values of their
36
 * properties can be configured using {@link GPEDefaults}.
37
 */
38
public class GPEProperties implements IGPEProperties{
39
	public static Properties properties = null;
40
	/**
41
	 * Number of decimal digits that both the parser and the writer
42
	 * have to manage.
43
	 */
44
	public static final String DECIMAL_DIGITS = "decimalDigits";
45
	private static final Integer DECIMAL_DIGITS_VALUE = new Integer(20);	
46
	
47
	static{
48
		properties = new Properties();
49
		properties.put(DECIMAL_DIGITS, DECIMAL_DIGITS_VALUE);		
50
	}
51
	
52
	/*
53
	 * (non-Javadoc)
54
	 * @see org.gvsig.gpe.IGPEProperties#getProperties()
55
	 */
56
	public Properties getProperties() {
57
		return properties;
58
	}
59

  
60
}
61

  
62

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/SrsUnknownWarning.java
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: SrsUnknownWarning.java 124 2007-05-16 09:27:40Z jorpiell $
51
 * $Log$
52
 * Revision 1.2  2007/05/16 09:27:40  jorpiell
53
 * Add some warnings
54
 *
55
 * Revision 1.1  2007/05/14 11:21:14  jorpiell
56
 * ProjectionFactory updated
57
 *
58
 *
59
 */
60
/**
61
 * This warning is throwed when the parser doesn't
62
 * know the SRS
63
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
64
 */
65
public class SrsUnknownWarning extends BaseException{
66
	private static final long serialVersionUID = 5269899884175171849L;
67
	private String srs = null;
68
	
69
	/**
70
	 * Cosntructor
71
	 * @param srs
72
	 * Unknown SRS
73
	 */
74
	public SrsUnknownWarning(String srs){
75
		this.srs = srs;
76
		initialize();
77
	}
78

  
79
	/**
80
	 * Initialize the properties
81
	 */
82
	private void initialize() {
83
		messageKey = "gpe_srs_unknown_warning";
84
		formatString = "The SRS %(srs) is unknokn.";				
85
		code = serialVersionUID;
86
	}
87
	
88
	/*
89
	 * (non-Javadoc)
90
	 * @see org.gvsig.exceptions.BaseException#values()
91
	 */
92
	protected Map values() {
93
		Hashtable hash = new Hashtable();
94
		hash.put("srs", srs);
95
		return hash;
96
	}
97

  
98
}
0 99

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/PolygonAutomaticallyClosedWarning.java
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: PolygonAutomaticallyClosedWarning.java 124 2007-05-16 09:27:40Z jorpiell $
51
 * $Log$
52
 * Revision 1.1  2007/05/16 09:27:40  jorpiell
53
 * Add some warnings
54
 *
55
 *
56
 */
57
/**
58
 * This warning is throwed when in a writting process,
59
 * there is a polygon that is not closed. If the format
60
 * doesn't support this, the parser must be close the
61
 * polygon automatically.
62
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
63
 */
64
public class PolygonAutomaticallyClosedWarning extends BaseException {
65
	private static final long serialVersionUID = -4652019336977819445L;
66
	private double[] x  = null;
67
	private double[] y  = null;
68
	private double[] z  = null;
69
	
70
	/**
71
	 * Constructor
72
	 * @param coordinates
73
	 * Polygon coordinates
74
	 */
75
	public PolygonAutomaticallyClosedWarning(double[][] coordinates){
76
		this.x = coordinates[0];
77
		this.y = coordinates[1];
78
		this.z = coordinates[2];
79
		initialize();
80
	}
81
	
82
	/**
83
	 * Costructor
84
	 * @param x
85
	 * Coordinate X
86
	 * @param y
87
	 * Coordinate Y
88
	 * @param z
89
	 * Coordinate Z
90
	 */
91
	public PolygonAutomaticallyClosedWarning(double[] x, double[] y, double[] z){
92
		this.x = x;
93
		this.y = y ;
94
		this.z = z;
95
		initialize();
96
	}
97

  
98
	/**
99
	 * Initialize the properties
100
	 */
101
	private void initialize() {
102
		messageKey = "gpe_polygon_automatically_closed_warning";
103
		formatString = "The polygon is not closed. The first coordinate is" +
104
				" %(X0),%(Y0),%(Z0) and the last one is %(X1),%(Y1),%(Z1). The" +
105
				" writting process will close it automatically";				
106
		code = serialVersionUID;
107
	}
108
	
109
	/*
110
	 * (non-Javadoc)
111
	 * @see org.gvsig.exceptions.BaseException#values()
112
	 */
113
	protected Map values() {
114
		Hashtable hash = new Hashtable();
115
		hash.put("X0", String.valueOf(x[0]));
116
		hash.put("Y0", String.valueOf(y[0]));
117
		hash.put("Z0", String.valueOf(z[0]));
118
		hash.put("X1", String.valueOf(x[x.length - 1]));
119
		hash.put("Y1", String.valueOf(y[y.length - 1]));
120
		hash.put("Z1", String.valueOf(z[z.length - 1]));
121
		return hash;
122
	}
123
}
0 124

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/NotSupportedElementWarning.java
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: NotSupportedElementWarning.java 162 2007-06-29 12:19:48Z jorpiell $
51
 * $Log$
52
 * Revision 1.2  2007/06/29 12:19:14  jorpiell
53
 * The schema validation is made independently of the concrete writer
54
 *
55
 * Revision 1.1  2007/06/28 13:04:33  jorpiell
56
 * The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
57
 *
58
 * Revision 1.1  2007/06/22 12:19:07  jorpiell
59
 * Add the exception
60
 *
61
 *
62
 */
63
/**
64
 * It is thrown when there is an element that can not
65
 * be validated using the XML Schema
66
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
67
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
68
 */
69
public class NotSupportedElementWarning extends BaseException{
70
	private static final long serialVersionUID = -8478703373223856720L;
71
	private String elementName = null;
72
	private String xsElementName = null;
73
	private String parentName = null;
74
	private String xsParentElementName = null;
75

  
76
	public NotSupportedElementWarning(String elementName, String xsElementName, String parentName, String xsParentElementName) {
77
		this.elementName = elementName;
78
		this.xsElementName = xsElementName;
79
		this.parentName = parentName;
80
		this.xsParentElementName = xsParentElementName;
81
		initialize();
82
	}
83

  
84
	/**
85
	 * Initialize the properties
86
	 */
87
	private void initialize() {
88
		messageKey = "gpe_not_supported_element_warning";
89
		formatString = "The element '%(elementName)' with a XML schema " + 
90
			"type '%(xsElementName)' is not contained in the parent element " +
91
			"'%(parentName)' with a XML Schema type '%(xsParentElementName)'";
92
		code = serialVersionUID;
93
	}
94
	
95
	/*
96
	 * (non-Javadoc)
97
	 * @see org.gvsig.exceptions.BaseException#values()
98
	 */
99
	protected Map values() {
100
		Hashtable hash = new Hashtable();
101
		hash.put("elementName", elementName);
102
		hash.put("xsElementName", xsElementName);
103
		hash.put("parentName", parentName);
104
		hash.put("xsParentElementName", xsParentElementName);
105
		return hash;
106
	}
107
	
108
}
0 109

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/FeatureNotSupportedWarning.java
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: FeatureNotSupportedWarning.java 190 2007-11-21 12:53:42Z csanchez $
51
 * $Log$
52
 * Revision 1.2  2007/06/19 10:34:51  jorpiell
53
 * Add some comments and creates a warning when an operation is not supported
54
 *
55
 * Revision 1.1  2007/05/16 12:07:07  jorpiell
56
 * New exceptions added
57
 *
58
 *
59
 */
60
/**
61
 * This warning is throwed when an application try to write
62
 * a feature that the current format doesn't supports it.
63
 * A feature in this case is not a "geographic feature":
64
 * is a detail: A layer with bbox, a leyer name... * 
65
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
66
 */
67
public class FeatureNotSupportedWarning extends BaseException{
68
	private static final long serialVersionUID = 8532995170438868404L;
69
	private String feature = null;
70
	private String parserName = null;
71
	public static final String LAYERWITHNAME = "Layer with name";
72
	public static final String LAYERWITHDESCRIPTION = "Layer with description";
73
	public static final String LAYERWITHBBOX = "Layer with bbox";
74
	public static final String LAYERWITHSRS = "Layer with srs";
75
	public static final String FEATUEWITHBBOX = "Feature with bbox";
76
	public static final String FEATUREWITHELEMENTS = "Feature with elements";
77
	public static final String FEATUREWITHNAME = "Feature with name";
78
	public static final String FEATURECREATION = "Feature creation";
79
	public static final String FEATUREWITHGEOMETRY = "Feature with geometry";
80
	public static final String LAYERCREATION = "Layer creation";
81
	public static final String LAYERWITHCHILDREN = "Layer with children";
82
	public static final String LAYERWITHFEATURES = "Layer with features";
83
	public static final String ELEMENTCREATION = "Create an element";
84
	public static final String ELEMENTWITHCHILDREN = "Element with child elements";
85
	public static final String BBOXCREATION = "Create a bbox";
86
	public static final String POINTCREATION = "Create a point";
87
	public static final String LINESTRINGCREATION = "Create a lineString";
88
	public static final String LINEARRINGCREATION = "Create a linearRing";
89
	public static final String POLYGONCREATION = "Create a polygon";
90
	public static final String POLYGONWITHINNERPOLYGON = "Polygon with inner polygon";
91
	public static final String INNERBOUNDARYCREATION = "Create a polygon innerboundary";
92
	public static final String MULTIPOINTCREATION = "Create a multiPoint";
93
	public static final String MULTILINESTRINGCREATION = "Create a multiLineString";
94
	public static final String MULTIPOLYGONCREATION = "Create a multiPolygon";
95
	public static final String MULTIGEOMETRYCREATION = "Create a multiGeometry";
96
	/************** CURVE CREATIONS FOR GML 3 ***************/
97
	public static final String MULTICURVECREATION = "Create a multiCurve";
98
	public static final String CURVECREATION = "Create a Curve";	
99
	/**METADATA**/
100
	public static final String METADATACREATION = "Create metadata";
101
	public static final String FEATUREWITHMETADATA = "Feature with metadata";
102
	public static final String METADATAWITHCHILDREN = "Metadata with children";
103
	/**TIME**/
104
	public static final String TIMECREATION = "Create time";	
105
	public static final String FEATUREWITHTIME = "Feature with time";
106
	
107
	public FeatureNotSupportedWarning(String feature, String parserName){
108
		this.feature = feature;
109
		this.parserName = parserName;
110
		initialize();
111
	}
112

  
113
	public FeatureNotSupportedWarning(String feature){
114
		this.feature = feature;	
115
		initialize();
116
	}
117

  
118
	/**
119
	 * Initialize the properties
120
	 */
121
	private void initialize() {
122
		messageKey = "gpe_feature_not_supported_warning";
123
		if (parserName != null){
124
			formatString = "The feature '%(feature)' is not supported" +
125
			" by the %(parserName) parser. It could be by two" +
126
			" reasons: 1) The parser doesn't support this feature. " + 
127
			" 2) The format doesn't support the feature.";
128
		}else{
129
			formatString = "The feature '%(feature)' is not supported" +
130
			" by the consumer application."; 
131
		}
132
		code = serialVersionUID;
133
	}
134

  
135
	/*
136
	 * (non-Javadoc)
137
	 * @see org.gvsig.exceptions.BaseException#values()
138
	 */
139
	protected Map values() {
140
		Hashtable hash = new Hashtable();
141
		hash.put("feature", feature);
142
		if (parserName != null){
143
			hash.put("parserName", parserName);
144
		}
145
		return hash;
146
	}
147

  
148

  
149
}
0 150

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/NotSupportedFeatureWarning.java
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: NotSupportedFeatureWarning.java 162 2007-06-29 12:19:48Z jorpiell $
51
 * $Log$
52
 * Revision 1.2  2007/06/29 12:19:14  jorpiell
53
 * The schema validation is made independently of the concrete writer
54
 *
55
 * Revision 1.1  2007/06/28 13:04:33  jorpiell
56
 * The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class
57
 *
58
 *
59
 */
60
/**
61
 * It is thrown when there is an feture that can not
62
 * be validated using the XML Schema
63
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
64
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)
65
 */
66
public class NotSupportedFeatureWarning extends BaseException{
67
	private static final long serialVersionUID = -907568605199930636L;
68
	private String featureName = null;
69
	private String xsFeatureType = null;
70
	private String layerName = null;
71
	private String xsLayerType = null;
72
	private boolean hasParentSchema = false;
73

  
74
	public NotSupportedFeatureWarning(String featureName, String xsFeatureType, String layerName, String xsLayerType) {
75
		super();
76
		this.featureName = featureName;
77
		this.xsFeatureType = xsFeatureType;
78
		this.layerName = layerName;
79
		this.xsLayerType = xsLayerType;
80
		hasParentSchema = true;
81
		initialize();
82
	}
83
	
84
	public NotSupportedFeatureWarning(String featureName, String xsFeatureType) {
85
		super();
86
		this.featureName = featureName;
87
		this.xsFeatureType = xsFeatureType;
88
		hasParentSchema = false;
89
		initialize();
90
	}
91

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

  
tags/tmp_build/libraries/libGPE/src/org/gvsig/gpe/warnings/PolygonNotClosedWarning.java
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: PolygonNotClosedWarning.java 124 2007-05-16 09:27:40Z jorpiell $
51
 * $Log$
52
 * Revision 1.1  2007/05/16 09:27:40  jorpiell
53
 * Add some warnings
54
 *
55
 *
56
 */
57
/**
58
 * This warning is throwed when the first and 
59
 * the last coordinates of a Polygon have not the
60
 * same value. It is a warning, because the application
61
 * could close the polygon
62
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
63
 */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff