Revision 943
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.xmlschema.lib.impl.DefaultXMLSchemaLibrary |
|
2 |
|
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/DefaultXMLSchemaManager.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 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlschema.lib.impl; |
|
29 |
|
|
30 |
import java.io.InputStream; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.HashMap; |
|
33 |
import java.util.Iterator; |
|
34 |
import java.util.Map; |
|
35 |
import java.util.Set; |
|
36 |
|
|
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.dataTypes.DataType; |
|
39 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
40 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
|
41 |
import org.gvsig.tools.service.ServiceException; |
|
42 |
import org.gvsig.xmlschema.lib.api.XMLSchemaManager; |
|
43 |
import org.gvsig.xmlschema.lib.api.exceptions.SchemaCreationException; |
|
44 |
import org.gvsig.xmlschema.lib.api.som.IXSSchema; |
|
45 |
import org.gvsig.xmlschema.lib.api.som.IXSTypeDefinition; |
|
46 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProvider; |
|
47 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProviderLocator; |
|
48 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProviderManager; |
|
49 |
|
|
50 |
/** |
|
51 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
52 |
*/ |
|
53 |
public class DefaultXMLSchemaManager implements XMLSchemaManager{ |
|
54 |
private Map mimeTypes = new HashMap(); |
|
55 |
private Map formats = new HashMap(); |
|
56 |
|
|
57 |
private Map appToGpeGeometryTypes = new HashMap(); |
|
58 |
private Map gpeToAppGeometryTypes = new HashMap(); |
|
59 |
|
|
60 |
private Map appToGpeDataTypes = new HashMap(); |
|
61 |
private Map gpeToAppDataTypes = new HashMap(); |
|
62 |
|
|
63 |
private static DataTypesManager dataTypesManager = null; |
|
64 |
|
|
65 |
public DefaultXMLSchemaManager() { |
|
66 |
super(); |
|
67 |
dataTypesManager = ToolsLocator.getDataTypesManager(); |
|
68 |
registerFormat("default", "default"); |
|
69 |
} |
|
70 |
|
|
71 |
public Object getApplicationDataTypeByFormat(String format, Object parserDataType) { |
|
72 |
return getApplicationDataType(getTypesByformat(format), parserDataType); |
|
73 |
} |
|
74 |
|
|
75 |
public Object getApplicationDataTypeByMimeType(String mimeType, Object parserDataType) { |
|
76 |
return getApplicationDataType(getTypesByMimeType(mimeType), parserDataType); |
|
77 |
} |
|
78 |
|
|
79 |
private Object getApplicationDataType(TypesByformat typesByformat, Object parserDataType){ |
|
80 |
if (typesByformat == null){ |
|
81 |
return null; |
|
82 |
} |
|
83 |
IXSTypeDefinition gpeformat = typesByformat.getGpeDataType(parserDataType); |
|
84 |
if (gpeformat != null){ |
|
85 |
return gpeToAppDataTypes.get(gpeformat); |
|
86 |
} |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
public String getFormat(String mimeType) { |
|
91 |
if (mimeTypes.containsKey(mimeType)){ |
|
92 |
return ((TypesByformat)mimeTypes.get(mimeType)).getName(); |
|
93 |
} |
|
94 |
return null; |
|
95 |
} |
|
96 |
|
|
97 |
|
|
98 |
public void registerFormat(String mimeType, String format) { |
|
99 |
TypesByformat typesByformat = new TypesByformat(format); |
|
100 |
mimeTypes.put(mimeType, typesByformat); |
|
101 |
formats.put(format,typesByformat); |
|
102 |
} |
|
103 |
|
|
104 |
public void addParserGeometryType(String format, Object type, |
|
105 |
int gpeGeometryType) { |
|
106 |
TypesByformat typesByformat = getTypesByformat(format); |
|
107 |
typesByformat.addParserGeometryType(type, gpeGeometryType); |
|
108 |
} |
|
109 |
|
|
110 |
public void addParserDataType(String format, Object type, int gpeDataType) { |
|
111 |
TypesByformat typesByformat = getTypesByformat(format); |
|
112 |
typesByformat.addParserDataType(type, gpeDataType); |
|
113 |
} |
|
114 |
|
|
115 |
public void addParserDataType(Object type, int gpeDataType) { |
|
116 |
Iterator it = formats.keySet().iterator(); |
|
117 |
while (it.hasNext()){ |
|
118 |
String format = (String)it.next(); |
|
119 |
TypesByformat typesByformat = (TypesByformat)formats.get(format); |
|
120 |
typesByformat.addParserDataType(type, gpeDataType); |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
public void registerAppGeometryType(Object appGeometryType, int gpeGeometryType) { |
|
125 |
Integer gpeGeoemtryTypeInt = new Integer(gpeGeometryType); |
|
126 |
gpeToAppGeometryTypes.put(gpeGeoemtryTypeInt, appGeometryType); |
|
127 |
appToGpeGeometryTypes.put(appGeometryType, gpeGeoemtryTypeInt); |
|
128 |
} |
|
129 |
|
|
130 |
public void registerAppDataType(Object appDataType, int gpeDataType) { |
|
131 |
Integer gpeDataTypeInt = new Integer(gpeDataType); |
|
132 |
gpeToAppDataTypes.put(gpeDataTypeInt, appDataType); |
|
133 |
appToGpeDataTypes.put(appDataType, gpeDataTypeInt); |
|
134 |
} |
|
135 |
|
|
136 |
public void registerAppDataType(int appDataType, int gpeDataType) { |
|
137 |
registerAppDataType(new Integer(appDataType), gpeDataType); |
|
138 |
} |
|
139 |
|
|
140 |
public void registerAppGeometryType(int appGeometrytype, int gpeGeometryType) { |
|
141 |
registerAppGeometryType(new Integer(appGeometrytype), gpeGeometryType); |
|
142 |
} |
|
143 |
|
|
144 |
private TypesByformat getTypesByformat(String format){ |
|
145 |
if (formats.containsKey(format)){ |
|
146 |
return (TypesByformat)formats.get(format); |
|
147 |
} |
|
148 |
TypesByformat typesByformat = new TypesByformat(format); |
|
149 |
formats.put(format, typesByformat); |
|
150 |
return typesByformat; |
|
151 |
} |
|
152 |
|
|
153 |
private TypesByformat getTypesByMimeType(String mimeType){ |
|
154 |
if (!mimeTypes.containsKey(mimeType)){ |
|
155 |
return null; |
|
156 |
} |
|
157 |
return (TypesByformat)mimeTypes.get(mimeType); |
|
158 |
} |
|
159 |
|
|
160 |
public Object getParserDataTypeByFormat(String format, |
|
161 |
Object applicationDataType) { |
|
162 |
return getParserDataType(getTypesByformat(format), applicationDataType); |
|
163 |
} |
|
164 |
|
|
165 |
public Object getParserDataTypeByMimeType(String mimeType,Object applicationDataType) { |
|
166 |
return getParserDataType(getTypesByMimeType(mimeType), applicationDataType); |
|
167 |
} |
|
168 |
|
|
169 |
private Object getParserDataType(TypesByformat typesByformat,Object applicationDataType) { |
|
170 |
if (!appToGpeDataTypes.containsKey(applicationDataType)){ |
|
171 |
return null; |
|
172 |
} |
|
173 |
Integer gpeDatatype = (Integer)appToGpeDataTypes.get(applicationDataType); |
|
174 |
return typesByformat.getParserDataType(gpeDatatype); |
|
175 |
} |
|
176 |
|
|
177 |
public Object getApplicationGeometryTypeByMimeType(String mimeType, |
|
178 |
Object parserGeometryType) { |
|
179 |
return getApplicationGeometry(getTypesByMimeType(mimeType), parserGeometryType); |
|
180 |
} |
|
181 |
|
|
182 |
public Object getApplicationGeometryTypeByFormat(String format, |
|
183 |
Object parserGeometryType) { |
|
184 |
return getApplicationGeometry(getTypesByformat(format), parserGeometryType); |
|
185 |
} |
|
186 |
|
|
187 |
private Object getApplicationGeometry(TypesByformat typesByformat, Object parserGeometryType){ |
|
188 |
int gpeGeometryCode = typesByformat.getGpeGeometryCode(parserGeometryType); |
|
189 |
if (gpeGeometryCode == -1){ |
|
190 |
return null; |
|
191 |
} |
|
192 |
return gpeToAppGeometryTypes.get(Integer.valueOf(gpeGeometryCode)); |
|
193 |
} |
|
194 |
|
|
195 |
public Object getParserGeometryTypeByFormat(String format, |
|
196 |
Object applicationGeometryType) { |
|
197 |
return getParserGeometryType(getTypesByformat(format), applicationGeometryType); |
|
198 |
} |
|
199 |
|
|
200 |
public Object getParserGeometryTypeByMimeType(String mimeType, |
|
201 |
Object applicationGeometryType) { |
|
202 |
return getParserGeometryType(getTypesByMimeType(mimeType), applicationGeometryType); |
|
203 |
} |
|
204 |
|
|
205 |
public Object getParserGeometryType(TypesByformat typesByformat, |
|
206 |
Object applicationGeometryType) { |
|
207 |
if (!appToGpeGeometryTypes.containsKey(applicationGeometryType)){ |
|
208 |
return null; |
|
209 |
} |
|
210 |
IXSTypeDefinition gpeGeometryType = (IXSTypeDefinition)appToGpeGeometryTypes.get(applicationGeometryType); |
|
211 |
return typesByformat.getParserGeometryType(gpeGeometryType); |
|
212 |
} |
|
213 |
|
|
214 |
private class TypesByformat{ |
|
215 |
private Map parserToGpeGeometryType = new HashMap(); |
|
216 |
private Map gpeToParserGeometryType = new HashMap(); |
|
217 |
private Map parserToGpeDataType = new HashMap(); |
|
218 |
private Map gpeToParserDataType = new HashMap(); |
|
219 |
private Map gpeNameToGeometryType = new HashMap(); |
|
220 |
private DataType geometryDataType = null; |
|
221 |
|
|
222 |
private String name = null; |
|
223 |
|
|
224 |
public TypesByformat(String name) { |
|
225 |
super(); |
|
226 |
this.name = name; |
|
227 |
int type = dataTypesManager.getType("Geometry"); |
|
228 |
if (type != 0){ |
|
229 |
geometryDataType = dataTypesManager.get(type); |
|
230 |
}else{ |
|
231 |
geometryDataType = dataTypesManager.get(DataTypes.OBJECT); |
|
232 |
} |
|
233 |
} |
|
234 |
|
|
235 |
void addParserGeometryType(Object type, |
|
236 |
int gpeGeometryType) { |
|
237 |
IXSTypeDefinition typeDefinition = new DefaultGeometryTypeDefinition(type.toString(), geometryDataType, name); |
|
238 |
|
|
239 |
gpeNameToGeometryType.put(typeDefinition, new Integer(gpeGeometryType)); |
|
240 |
parserToGpeGeometryType.put(type, typeDefinition); |
|
241 |
ArrayList geometryTypes = null; |
|
242 |
if (gpeToParserGeometryType.containsKey(typeDefinition)){ |
|
243 |
geometryTypes = (ArrayList)gpeToParserGeometryType.get(typeDefinition); |
|
244 |
}else{ |
|
245 |
geometryTypes = new ArrayList(); |
|
246 |
gpeToParserGeometryType.put(typeDefinition, geometryTypes); |
|
247 |
} |
|
248 |
geometryTypes.add(typeDefinition); |
|
249 |
} |
|
250 |
|
|
251 |
void addParserDataType(Object type, int gpeDataType) { |
|
252 |
IXSTypeDefinition typeDefinition = new DefaultSimpleTypeDefinition(type.toString(), dataTypesManager.get(gpeDataType)); |
|
253 |
|
|
254 |
parserToGpeDataType.put(type, typeDefinition); |
|
255 |
ArrayList dataTypes = null; |
|
256 |
if (gpeToParserDataType.containsKey(typeDefinition)){ |
|
257 |
dataTypes = (ArrayList)gpeToParserDataType.get(typeDefinition); |
|
258 |
}else{ |
|
259 |
dataTypes = new ArrayList(); |
|
260 |
gpeToParserDataType.put(typeDefinition, dataTypes); |
|
261 |
} |
|
262 |
dataTypes.add(typeDefinition); |
|
263 |
} |
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
IXSTypeDefinition getGpeDataType(Object parserDataType) { |
|
268 |
if (parserToGpeDataType.containsKey(parserDataType)){ |
|
269 |
return (IXSTypeDefinition)parserToGpeDataType.get(parserDataType); |
|
270 |
}else{ |
|
271 |
return getGpeTypeWithOutNameSpace(parserToGpeDataType, parserDataType); |
|
272 |
} |
|
273 |
} |
|
274 |
|
|
275 |
IXSTypeDefinition getGpeTypeWithOutNameSpace(Map mapTypes, Object parserDataType){ |
|
276 |
Set keys = mapTypes.keySet(); |
|
277 |
Iterator it = keys.iterator(); |
|
278 |
String[] typeParts = parserDataType.toString().split(":"); |
|
279 |
String typeAux = parserDataType.toString(); |
|
280 |
if (typeParts.length > 1){ |
|
281 |
typeAux = typeParts[1]; |
|
282 |
} |
|
283 |
while(it.hasNext()){ |
|
284 |
String key = (String)it.next(); |
|
285 |
String[] parts = key.split(":"); |
|
286 |
if (parts.length == 1){ |
|
287 |
if (parts[0].compareTo(typeAux.toUpperCase())==0){ |
|
288 |
return (IXSTypeDefinition)mapTypes.get(key); |
|
289 |
} |
|
290 |
}else if (parts.length > 1){ |
|
291 |
if (parts[parts.length-1].toUpperCase().compareTo(typeAux.toUpperCase())==0){ |
|
292 |
return (IXSTypeDefinition)mapTypes.get(key); |
|
293 |
} |
|
294 |
} |
|
295 |
} |
|
296 |
return null; |
|
297 |
} |
|
298 |
|
|
299 |
int getGpeGeometryCode(Object parserGeometryType){ |
|
300 |
IXSTypeDefinition typeDefinition = getGpeGeometryType(parserGeometryType); |
|
301 |
if (typeDefinition == null){ |
|
302 |
return -1; |
|
303 |
} |
|
304 |
Integer gpeGeometry = (Integer)gpeNameToGeometryType.get(typeDefinition); |
|
305 |
if (gpeGeometry != null){ |
|
306 |
return gpeGeometry.intValue(); |
|
307 |
} |
|
308 |
return -1; |
|
309 |
} |
|
310 |
|
|
311 |
IXSTypeDefinition getGpeGeometryType(Object parserGeometryType){ |
|
312 |
if (parserToGpeGeometryType.containsKey(parserGeometryType)){ |
|
313 |
return (IXSTypeDefinition)parserToGpeGeometryType.get(parserGeometryType); |
|
314 |
} else{ |
|
315 |
return getGpeTypeWithOutNameSpace(parserToGpeGeometryType, parserGeometryType); |
|
316 |
} |
|
317 |
} |
|
318 |
|
|
319 |
Object getParserDataType(Integer gpeDataType) { |
|
320 |
return gpeToParserDataType.get(gpeDataType); |
|
321 |
} |
|
322 |
|
|
323 |
Object getParserGeometryType(IXSTypeDefinition gpeGeometryType) { |
|
324 |
return gpeToParserGeometryType.get(gpeGeometryType); |
|
325 |
} |
|
326 |
|
|
327 |
public String getName() { |
|
328 |
return name; |
|
329 |
} |
|
330 |
} |
|
331 |
|
|
332 |
public IXSSchema createXSSchema(String providerName, String namespaceURI, String namespacePrefix) |
|
333 |
throws SchemaCreationException { |
|
334 |
XmlSchemaProviderManager xmlSchemaProviderManager = XmlSchemaProviderLocator.getXMLSchemaProviderManager(); |
|
335 |
XmlSchemaProvider xmlSchemaProvider; |
|
336 |
try { |
|
337 |
xmlSchemaProvider = xmlSchemaProviderManager.createXmlSchemaProvider(providerName); |
|
338 |
} catch (ServiceException e) { |
|
339 |
throw new SchemaCreationException(e); |
|
340 |
} |
|
341 |
return xmlSchemaProvider.createXSSchema(namespaceURI, namespacePrefix); |
|
342 |
} |
|
343 |
|
|
344 |
public IXSSchema parse(String providerName, InputStream is) throws SchemaCreationException { |
|
345 |
XmlSchemaProviderManager xmlSchemaProviderManager = XmlSchemaProviderLocator.getXMLSchemaProviderManager(); |
|
346 |
XmlSchemaProvider xmlSchemaProvider; |
|
347 |
try { |
|
348 |
xmlSchemaProvider = xmlSchemaProviderManager.createXmlSchemaProvider(providerName); |
|
349 |
} catch (ServiceException e) { |
|
350 |
throw new SchemaCreationException(e); |
|
351 |
} |
|
352 |
return xmlSchemaProvider.parse(is); |
|
353 |
} |
|
354 |
|
|
355 |
public IXSTypeDefinition getTypeDefinition(String typeName) { |
|
356 |
Iterator it = formats.keySet().iterator(); |
|
357 |
while (it.hasNext()){ |
|
358 |
String format = (String)it.next(); |
|
359 |
IXSTypeDefinition typeDefinition = getTypeDefinition(format, typeName); |
|
360 |
if (typeDefinition != null){ |
|
361 |
return typeDefinition; |
|
362 |
} |
|
363 |
} |
|
364 |
return null; |
|
365 |
} |
|
366 |
|
|
367 |
public IXSTypeDefinition getTypeDefinition(String format, String typeName) { |
|
368 |
TypesByformat typesByformat = (TypesByformat)formats.get(format); |
|
369 |
IXSTypeDefinition typeDefinition = typesByformat.getGpeDataType(typeName); |
|
370 |
if (typeDefinition == null){ |
|
371 |
typeDefinition = typesByformat.getGpeGeometryType(typeName); |
|
372 |
} |
|
373 |
return typeDefinition; |
|
374 |
} |
|
375 |
} |
|
376 |
|
|
0 | 377 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/DefaultSimpleTypeDefinition.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 |
package org.gvsig.xmlschema.lib.impl; |
|
23 |
|
|
24 |
import java.util.Collection; |
|
25 |
|
|
26 |
import org.gvsig.tools.ToolsLocator; |
|
27 |
import org.gvsig.tools.dataTypes.DataType; |
|
28 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
|
29 |
import org.gvsig.xmlpull.lib.api.stream.IQName; |
|
30 |
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator; |
|
31 |
import org.gvsig.xmlschema.lib.api.XMLSchemaManager; |
|
32 |
import org.gvsig.xmlschema.lib.api.som.IXSElement; |
|
33 |
import org.gvsig.xmlschema.lib.api.som.IXSSchema; |
|
34 |
import org.gvsig.xmlschema.lib.api.som.IXSSimpleTypeDefinition; |
|
35 |
import org.gvsig.xmlschema.lib.api.som.XSQName; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* @author gvSIG Team |
|
40 |
* @version $Id$ |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class DefaultSimpleTypeDefinition implements IXSSimpleTypeDefinition{ |
|
44 |
protected IQName qName = null; |
|
45 |
protected DataType dataType; |
|
46 |
protected static final XMLSchemaManager schemaManager = XMLSchemaLocator.getXMLSchemaManager(); |
|
47 |
protected static final DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager(); |
|
48 |
|
|
49 |
public DefaultSimpleTypeDefinition(String name, DataType dataType) { |
|
50 |
super(); |
|
51 |
this.qName = new XSQName(name); |
|
52 |
this.dataType = dataType; |
|
53 |
} |
|
54 |
|
|
55 |
public String getTypeName() { |
|
56 |
return getNodeName(); |
|
57 |
} |
|
58 |
|
|
59 |
public Collection getItems() { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
return null; |
|
62 |
} |
|
63 |
|
|
64 |
public IQName getQName() { |
|
65 |
return qName; |
|
66 |
} |
|
67 |
|
|
68 |
public IXSSchema getSchema() { |
|
69 |
// TODO Auto-generated method stub |
|
70 |
return null; |
|
71 |
} |
|
72 |
|
|
73 |
public void addChildElement(IXSElement element) { |
|
74 |
// TODO Auto-generated method stub |
|
75 |
|
|
76 |
} |
|
77 |
|
|
78 |
public IXSElement getElement() { |
|
79 |
// TODO Auto-generated method stub |
|
80 |
return null; |
|
81 |
} |
|
82 |
|
|
83 |
public String getNodeName() { |
|
84 |
if (qName != null){ |
|
85 |
return qName.getLocalPart(); |
|
86 |
} |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
public short getNodeType() { |
|
91 |
// TODO Auto-generated method stub |
|
92 |
return 0; |
|
93 |
} |
|
94 |
|
|
95 |
public String getNodeValue() { |
|
96 |
// TODO Auto-generated method stub |
|
97 |
return null; |
|
98 |
} |
|
99 |
|
|
100 |
public void setElement(IXSElement element) { |
|
101 |
// TODO Auto-generated method stub |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
public DataType getDataType() { |
|
106 |
return dataType; |
|
107 |
} |
|
108 |
|
|
109 |
public Object getValue() { |
|
110 |
// TODO Auto-generated method stub |
|
111 |
return null; |
|
112 |
} |
|
113 |
|
|
114 |
public void setValue(Object value) { |
|
115 |
// TODO Auto-generated method stub |
|
116 |
|
|
117 |
} |
|
118 |
|
|
119 |
public boolean isGeometry() { |
|
120 |
return false; |
|
121 |
} |
|
122 |
|
|
123 |
public boolean isComplex(){ |
|
124 |
return false; |
|
125 |
} |
|
126 |
} |
|
0 | 127 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/DefaultGeometryTypeDefinition.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 |
package org.gvsig.xmlschema.lib.impl; |
|
23 |
|
|
24 |
import org.gvsig.tools.dataTypes.DataType; |
|
25 |
import org.gvsig.xmlschema.lib.api.som.IXSGeometryTypeDefinition; |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* @author gvSIG Team |
|
30 |
* @version $Id$ |
|
31 |
* |
|
32 |
*/ |
|
33 |
public class DefaultGeometryTypeDefinition extends DefaultSimpleTypeDefinition implements IXSGeometryTypeDefinition{ |
|
34 |
private int geometryType = -1; |
|
35 |
private String format = null; |
|
36 |
|
|
37 |
public DefaultGeometryTypeDefinition(String name, DataType dataType, String format) { |
|
38 |
super(name, dataType); |
|
39 |
this.format = format; |
|
40 |
} |
|
41 |
|
|
42 |
public int getGeometryType() { |
|
43 |
if (geometryType == -1){ |
|
44 |
Object obj = schemaManager.getApplicationGeometryTypeByFormat(format, getNodeName()); |
|
45 |
if (obj != null){ |
|
46 |
geometryType = ((Integer)obj).intValue(); |
|
47 |
} |
|
48 |
} |
|
49 |
return geometryType; |
|
50 |
} |
|
51 |
|
|
52 |
public boolean isGeometry() { |
|
53 |
return true; |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
0 | 57 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/DefaultXMLSchemaLibrary.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 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlschema.lib.impl; |
|
29 |
|
|
30 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
31 |
import org.gvsig.tools.library.AbstractLibrary; |
|
32 |
import org.gvsig.tools.library.LibraryException; |
|
33 |
import org.gvsig.xmlschema.lib.api.XMLSchemaLibrary; |
|
34 |
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator; |
|
35 |
import org.gvsig.xmlschema.lib.api.XMLSchemaManager; |
|
36 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProviderLocator; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
40 |
*/ |
|
41 |
public class DefaultXMLSchemaLibrary extends AbstractLibrary { |
|
42 |
|
|
43 |
public void doRegistration() { |
|
44 |
registerAsImplementationOf(XMLSchemaLibrary.class); |
|
45 |
} |
|
46 |
|
|
47 |
protected void doInitialize() throws LibraryException { |
|
48 |
XMLSchemaLocator |
|
49 |
.registerXMLSchemaManager(DefaultXMLSchemaManager.class); |
|
50 |
XmlSchemaProviderLocator |
|
51 |
.registerXMLSchemaProviderManager(DefaultXMLSchemaProviderManager.class); |
|
52 |
} |
|
53 |
|
|
54 |
protected void doPostInitialize() throws LibraryException { |
|
55 |
XMLSchemaManager schemaManager = XMLSchemaLocator.getXMLSchemaManager(); |
|
56 |
|
|
57 |
schemaManager.addParserDataType(XMLSimpleType.STRING, DataTypes.STRING); |
|
58 |
schemaManager.addParserDataType(XMLSimpleType.INTEGER, DataTypes.INT); |
|
59 |
schemaManager.addParserDataType(XMLSimpleType.INT, DataTypes.INT); |
|
60 |
schemaManager.addParserDataType(XMLSimpleType.DOUBLE, DataTypes.DOUBLE); |
|
61 |
schemaManager.addParserDataType(XMLSimpleType.FLOAT, DataTypes.FLOAT); |
|
62 |
schemaManager.addParserDataType(XMLSimpleType.BOOLEAN, |
|
63 |
DataTypes.BOOLEAN); |
|
64 |
schemaManager.addParserDataType(XMLSimpleType.LONG, DataTypes.LONG); |
|
65 |
schemaManager |
|
66 |
.addParserDataType(XMLSimpleType.DECIMAL, DataTypes.DOUBLE); |
|
67 |
schemaManager.addParserDataType(XMLSimpleType.DATE, DataTypes.DATE); |
|
68 |
schemaManager.addParserDataType(XMLSimpleType.SHORT, DataTypes.INT); |
|
69 |
schemaManager.addParserDataType(XMLSimpleType.DATETIME, DataTypes.DATE); |
|
70 |
|
|
71 |
schemaManager.addParserDataType(XMLSimpleType.REAL, DataTypes.FLOAT); |
|
72 |
schemaManager.addParserDataType(XMLSimpleType.CHARACTER, DataTypes.STRING); |
|
73 |
} |
|
74 |
} |
|
0 | 75 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/DefaultXMLSchemaProviderManager.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 |
package org.gvsig.xmlschema.lib.impl; |
|
23 |
|
|
24 |
import org.gvsig.tools.ToolsLocator; |
|
25 |
import org.gvsig.tools.dynobject.DynClass; |
|
26 |
import org.gvsig.tools.dynobject.DynObject; |
|
27 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
28 |
import org.gvsig.tools.service.Service; |
|
29 |
import org.gvsig.tools.service.ServiceException; |
|
30 |
import org.gvsig.tools.service.spi.AbstractProviderManager; |
|
31 |
import org.gvsig.tools.service.spi.NotRegisteredException; |
|
32 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
33 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProvider; |
|
34 |
import org.gvsig.xmlschema.lib.spi.XmlSchemaProviderManager; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @author gvSIG Team |
|
39 |
* @version $Id$ |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class DefaultXMLSchemaProviderManager extends AbstractProviderManager implements XmlSchemaProviderManager { |
|
43 |
public static final String PROVIDERS_NAME = "XMLSchema.providers"; |
|
44 |
public static final String PROVIDERS_DESCRIPTION = "XMLchema providers description"; |
|
45 |
private DynObjectManager dynObjectManager = null; |
|
46 |
|
|
47 |
public DefaultXMLSchemaProviderManager() { |
|
48 |
super(); |
|
49 |
this.dynObjectManager = ToolsLocator.getDynObjectManager(); |
|
50 |
} |
|
51 |
|
|
52 |
protected String getRegistryDescription() { |
|
53 |
return PROVIDERS_DESCRIPTION; |
|
54 |
} |
|
55 |
|
|
56 |
protected String getRegistryKey() { |
|
57 |
return PROVIDERS_NAME; |
|
58 |
} |
|
59 |
|
|
60 |
public ProviderServices createProviderServices(Service service) { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
return null; |
|
63 |
} |
|
64 |
|
|
65 |
public XmlSchemaProvider createXmlSchemaProvider(String providerName) throws ServiceException { |
|
66 |
DynClass dynClass = dynObjectManager.get(providerName); |
|
67 |
if (dynClass == null){ |
|
68 |
throw new NotRegisteredException(providerName); |
|
69 |
} |
|
70 |
DynObject serviceParameters = dynObjectManager.createDynObject(dynClass); |
|
71 |
return (XmlSchemaProvider)createProvider(serviceParameters, null); |
|
72 |
} |
|
73 |
} |
|
0 | 74 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/XMLSimpleType.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.lib.impl; |
|
2 |
|
|
3 |
|
|
4 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: XMLSimpleType.java 18271 2008-01-24 09:06:43Z jpiera $ |
|
47 |
* $Log$ |
|
48 |
* Revision 1.4 2007-01-15 13:11:00 csanchez |
|
49 |
* Sistema de Warnings y Excepciones adaptado a BasicException |
|
50 |
* |
|
51 |
* Revision 1.3 2006/12/29 18:05:20 jorpiell |
|
52 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
53 |
* |
|
54 |
* Revision 1.1 2006/12/22 11:25:04 csanchez |
|
55 |
* Nuevo parser GML 2.x para gml's sin esquema |
|
56 |
* |
|
57 |
* Revision 1.5 2006/10/11 11:21:00 jorpiell |
|
58 |
* Se escriben los tipos correctamente (no en mayusculas) para que las traducciones funcionen |
|
59 |
* |
|
60 |
* Revision 1.4 2006/10/10 12:52:28 jorpiell |
|
61 |
* Soporte para features complejas. |
|
62 |
* |
|
63 |
* Revision 1.3 2006/10/02 08:33:49 jorpiell |
|
64 |
* Cambios del 10 copiados al head |
|
65 |
* |
|
66 |
* Revision 1.1.2.1 2006/09/19 12:23:15 jorpiell |
|
67 |
* Ya no se depende de geotools |
|
68 |
* |
|
69 |
* Revision 1.2 2006/09/18 12:08:55 jorpiell |
|
70 |
* Se han hecho algunas modificaciones que necesitaba el WFS |
|
71 |
* |
|
72 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell |
|
73 |
* Primer commit del driver de Gml |
|
74 |
* |
|
75 |
* |
|
76 |
*/ |
|
77 |
/** |
|
78 |
* A XS simple data type. |
|
79 |
* |
|
80 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
81 |
* @author Carlos S?nchez Peri??n (sanchez_carper@gva.es) |
|
82 |
* |
|
83 |
*/ |
|
84 |
public class XMLSimpleType{ |
|
85 |
public static final String STRING = "xs:string"; |
|
86 |
public static final String INTEGER = "xs:integer"; |
|
87 |
public static final String DOUBLE = "xs:double"; |
|
88 |
public static final String FLOAT = "xs:float"; |
|
89 |
public static final String BOOLEAN = "xs:boolean"; |
|
90 |
public static final String LONG = "xs:long"; |
|
91 |
public static final String INT = "xs:int"; |
|
92 |
public static final String DECIMAL = "xs:decimal"; |
|
93 |
public static final String DATE = "xs:date"; |
|
94 |
public static final String SHORT = "xs:short"; |
|
95 |
public static final String DATETIME = "xs:dateTime"; |
|
96 |
|
|
97 |
public static final String REAL = "xs:real"; |
|
98 |
public static final String CHARACTER = "xs:character"; |
|
99 |
} |
|
0 | 100 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/src/main/java/org/gvsig/xmlschema/lib/impl/GMLGeometryType.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.lib.impl; |
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
6 |
* |
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation; either version 2 |
|
12 |
* of the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
22 |
* |
|
23 |
* For more information, contact: |
|
24 |
* |
|
25 |
* Generalitat Valenciana |
|
26 |
* Conselleria d'Infraestructures i Transport |
|
27 |
* Av. Blasco Ib??ez, 50 |
|
28 |
* 46010 VALENCIA |
|
29 |
* SPAIN |
|
30 |
* |
|
31 |
* +34 963862235 |
|
32 |
* gvsig@gva.es |
|
33 |
* www.gvsig.gva.es |
|
34 |
* |
|
35 |
* or |
|
36 |
* |
|
37 |
* IVER T.I. S.A |
|
38 |
* Salamanca 50 |
|
39 |
* 46005 Valencia |
|
40 |
* Spain |
|
41 |
* |
|
42 |
* +34 963163400 |
|
43 |
* dac@iver.es |
|
44 |
*/ |
|
45 |
/* CVS MESSAGES: |
|
46 |
* |
|
47 |
* $Id: GMLGeometryType.java 18290 2008-01-24 17:11:37Z jpiera $ |
|
48 |
* $Log$ |
|
49 |
* Revision 1.2 2007-02-05 13:20:13 jorpiell |
|
50 |
* A?adidos nuevos m?todos en la factoria. |
|
51 |
* |
|
52 |
* Revision 1.1 2006/12/22 11:25:04 csanchez |
|
53 |
* Nuevo parser GML 2.x para gml's sin esquema |
|
54 |
* |
|
55 |
* Revision 1.2 2006/10/11 11:21:00 jorpiell |
|
56 |
* Se escriben los tipos correctamente (no en mayusculas) para que las traducciones funcionen |
|
57 |
* |
|
58 |
* Revision 1.1 2006/08/10 12:00:49 jorpiell |
|
59 |
* Primer commit del driver de Gml |
|
60 |
* |
|
61 |
* |
|
62 |
*/ |
|
63 |
/** |
|
64 |
* All the GML geometries must be here |
|
65 |
* |
|
66 |
* @author Jorge Piera Llodr? (piera_jor@gva.es) |
|
67 |
* @author Carlos S?nchez Peri??n (sanchez_carper@gva.es) |
|
68 |
* |
|
69 |
*/ |
|
70 |
public class GMLGeometryType { |
|
71 |
public static final String POINT = "gml:PointPropertyType"; |
|
72 |
public static final String MULTIPOINT = "gml:MultiPointPropertyType"; |
|
73 |
public static final String LINE = "gml:LineStringPropertyType"; |
|
74 |
public static final String MULTILINE = "gml:MultiLineStringPropertyType"; |
|
75 |
public static final String POLYGON = "gml:PolygonPropertyType"; |
|
76 |
public static final String MULTIPOLYGON = "gml:MultiPolygonPropertyType"; |
|
77 |
public static final String GEOMETRY = "gml:GeometryPropertyType"; |
|
78 |
public static final String MULTIGEOMETRY = "gml:MultiGeometryPropertyType"; |
|
79 |
public static final String SURFACE = "gml:SurfacePropertyType"; |
|
80 |
public static final String MULTISURFACE = "gml:MultiSurfacePropertyType"; |
|
81 |
} |
|
0 | 82 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.xmlschema.lib.impl</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.xmlschema.lib.impl</name> |
|
8 |
<description>Default XML Schema library Implementation</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.xmlschema.lib</artifactId> |
|
12 |
<version>2.0.19</version> |
|
13 |
</parent> |
|
14 |
<dependencies> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.xmlschema.lib.api</artifactId> |
|
18 |
<version>2.0.19</version> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.xmlschema.lib.spi</artifactId> |
|
23 |
<version>2.0.19</version> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
28 |
</dependency> |
|
29 |
</dependencies> |
|
30 |
<build> |
|
31 |
<plugins> |
|
32 |
<plugin> |
|
33 |
<groupId>org.apache.maven.plugins</groupId> |
|
34 |
<artifactId>maven-compiler-plugin</artifactId> |
|
35 |
<configuration> |
|
36 |
<source>1.4</source> |
|
37 |
<target>1.5</target> |
|
38 |
</configuration> |
|
39 |
</plugin> |
|
40 |
</plugins> |
|
41 |
</build> |
|
42 |
<profiles> |
|
43 |
<profile> |
|
44 |
<id>cdc</id> |
|
45 |
<build> |
|
46 |
<plugins> |
|
47 |
<plugin> |
|
48 |
<groupId>org.apache.maven.plugins</groupId> |
|
49 |
<artifactId>maven-compiler-plugin</artifactId> |
|
50 |
<configuration> |
|
51 |
<source>1.4</source> |
|
52 |
<target>1.4</target> |
|
53 |
</configuration> |
|
54 |
</plugin> |
|
55 |
</plugins> |
|
56 |
</build> |
|
57 |
</profile> |
|
58 |
</profiles> |
|
59 |
</project> |
|
0 | 60 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
|
|
4 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.xmlschema.lib</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>org.gvsig.xmlschema.lib</name> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.xmlschema</artifactId> |
|
12 |
<version>2.0.19</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<modules> |
|
16 |
<module>org.gvsig.xmlschema.lib.api</module> |
|
17 |
<module>org.gvsig.xmlschema.lib.impl</module> |
|
18 |
<module>org.gvsig.xmlschema.lib.spi</module> |
|
19 |
</modules> |
|
20 |
</project> |
|
0 | 21 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.xmlschema.lib.api.XMLSchemaLibrary |
|
2 |
|
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/java/org/gvsig/xmlschema/lib/api/XMLSchemaLocator.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 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlschema.lib.api; |
|
29 |
|
|
30 |
import org.gvsig.tools.locator.AbstractLocator; |
|
31 |
import org.gvsig.tools.locator.Locator; |
|
32 |
import org.gvsig.tools.locator.LocatorException; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
36 |
*/ |
|
37 |
public class XMLSchemaLocator extends AbstractLocator { |
|
38 |
private static final String LOCATOR_NAME = "XMLSchemaLocator"; |
|
39 |
/** |
|
40 |
* XMLSchemaManager name used by the locator to access the instance |
|
41 |
*/ |
|
42 |
public static final String XMLSCHEMA_MANAGER_NAME = "XMLSchemaManager"; |
|
43 |
private static final String XMLSCHEMA_MANAGER_DESCRIPTION = "XMLSchemaManager of gvSIG"; |
|
44 |
|
|
45 |
|
|
46 |
/** |
|
47 |
* Unique instance. |
|
48 |
*/ |
|
49 |
private static final XMLSchemaLocator instance = new XMLSchemaLocator(); |
|
50 |
|
|
51 |
/* (non-Javadoc) |
|
52 |
* @see org.gvsig.tools.locator.Locator#getLocatorName() |
|
53 |
*/ |
|
54 |
public String getLocatorName() { |
|
55 |
return LOCATOR_NAME; |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Return the singleton instance. |
|
60 |
* |
|
61 |
* @return the singleton instance |
|
62 |
*/ |
|
63 |
public static XMLSchemaLocator getInstance() { |
|
64 |
return instance; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Return a reference to {@link XMLSchemaManager}. |
|
69 |
* |
|
70 |
* @return a reference to XMLSchemaManager |
|
71 |
* @throws LocatorException |
|
72 |
* if there is no access to the class or the class cannot be |
|
73 |
* instantiated |
|
74 |
* @see Locator#get(String) |
|
75 |
*/ |
|
76 |
public static XMLSchemaManager getXMLSchemaManager() throws LocatorException { |
|
77 |
return (XMLSchemaManager) getInstance().get(XMLSCHEMA_MANAGER_NAME); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Registers the Class implementing the {@link XMLSchemaManager} interface. |
|
82 |
* |
|
83 |
* @param clazz |
|
84 |
* implementing the XMLSchemaManager interface |
|
85 |
*/ |
|
86 |
public static void registerXMLSchemaManager(Class clazz) { |
|
87 |
getInstance().register(XMLSCHEMA_MANAGER_NAME, |
|
88 |
XMLSCHEMA_MANAGER_DESCRIPTION, |
|
89 |
clazz); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
0 | 93 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/java/org/gvsig/xmlschema/lib/api/XMLSchemaLibrary.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 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlschema.lib.api; |
|
29 |
|
|
30 |
import org.gvsig.tools.library.AbstractLibrary; |
|
31 |
import org.gvsig.tools.library.LibraryException; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
35 |
*/ |
|
36 |
public class XMLSchemaLibrary extends AbstractLibrary { |
|
37 |
|
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(XMLSchemaLibrary.class); |
|
40 |
} |
|
41 |
|
|
42 |
protected void doInitialize() throws LibraryException { |
|
43 |
// Nothing to do |
|
44 |
} |
|
45 |
|
|
46 |
protected void doPostInitialize() throws LibraryException { |
|
47 |
// Nothing to do |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
0 | 51 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/java/org/gvsig/xmlschema/lib/api/warnings/SchemaLocationWarning.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.lib.api.warnings; |
|
2 |
|
|
3 |
import java.util.Hashtable; |
|
4 |
import java.util.Map; |
|
5 |
|
|
6 |
import org.gvsig.tools.exception.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: SchemaLocationWarning.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
53 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
54 |
* |
|
55 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
56 |
* The schema jar name has been changed |
|
57 |
* |
|
58 |
* |
|
59 |
*/ |
|
60 |
/** |
|
61 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
62 |
*/ |
|
63 |
public class SchemaLocationWarning extends BaseException{ |
|
64 |
private static final long serialVersionUID = -7232629060306401806L; |
|
65 |
private String schemaLocation = null; |
|
66 |
|
|
67 |
public SchemaLocationWarning(String schemaLocation, Throwable exception){ |
|
68 |
this.schemaLocation = schemaLocation; |
|
69 |
init(); |
|
70 |
initCause(exception); |
|
71 |
} |
|
72 |
|
|
73 |
private void init() { |
|
74 |
messageKey = "warning_gpe_schema_location"; |
|
75 |
formatString = "Schema Location %(schemaLocation) is not found"; |
|
76 |
code = serialVersionUID; |
|
77 |
} |
|
78 |
|
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* @see org.gvsig.tools.exception.BaseException#values() |
|
82 |
*/ |
|
83 |
protected Map values() { |
|
84 |
Hashtable hash = new Hashtable(); |
|
85 |
hash.put("schemaLocation", schemaLocation); |
|
86 |
return hash; |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
0 | 90 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/java/org/gvsig/xmlschema/lib/api/XMLSchemaManager.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 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlschema.lib.api; |
|
29 |
|
|
30 |
import java.io.InputStream; |
|
31 |
|
|
32 |
import org.gvsig.xmlschema.lib.api.exceptions.SchemaCreationException; |
|
33 |
import org.gvsig.xmlschema.lib.api.som.IXSSchema; |
|
34 |
import org.gvsig.xmlschema.lib.api.som.IXSTypeDefinition; |
|
35 |
|
|
36 |
/** |
|
37 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
38 |
*/ |
|
39 |
public interface XMLSchemaManager{ |
|
40 |
public final static int GEOMETRY = 0; |
|
41 |
public final static int POINT = 1; |
|
42 |
public final static int LINESTRING = 2; |
|
43 |
public final static int POLYGON = 3; |
|
44 |
public final static int SOLID = 4; |
|
45 |
public final static int MULTIGEOMETRY = 6; |
|
46 |
public final static int MULTIPOINT = 7; |
|
47 |
public final static int MULTILINESTRING = 8; |
|
48 |
public final static int MULTIPOLYGON = 9; |
|
49 |
public final static int MULTISOLID = 10; |
|
50 |
|
|
51 |
public IXSSchema createXSSchema(String providerName, String namespaceURI, String namespacePrefix) throws SchemaCreationException; |
|
52 |
|
|
53 |
public IXSSchema parse(String providerName, InputStream is) throws SchemaCreationException; |
|
54 |
|
|
55 |
public void registerFormat(String mimeType, String format); |
|
56 |
|
|
57 |
public String getFormat(String mimeType); |
|
58 |
|
|
59 |
public Object getApplicationDataTypeByFormat(String format, Object parserDataType); |
|
60 |
|
|
61 |
public Object getParserDataTypeByFormat(String format, Object applicationDataType); |
|
62 |
|
|
63 |
public Object getApplicationDataTypeByMimeType(String mimeType, Object parserDataType); |
|
64 |
|
|
65 |
public Object getParserDataTypeByMimeType(String mimeType, Object applicationDataType); |
|
66 |
|
|
67 |
public Object getApplicationGeometryTypeByFormat(String format, Object parserGeometryType); |
|
68 |
|
|
69 |
public Object getParserGeometryTypeByFormat(String format, Object applicationGeometry); |
|
70 |
|
|
71 |
public Object getApplicationGeometryTypeByMimeType(String mimeType, Object parserGeometryType); |
|
72 |
|
|
73 |
public Object getParserGeometryTypeByMimeType(String mimeType, Object applicationGeometry); |
|
74 |
|
|
75 |
public void addParserGeometryType(String format, Object parserGeometryType, int gpeGeometryType); |
|
76 |
|
|
77 |
public void addParserDataType(String format, Object parserDataType, int gpeDataType); |
|
78 |
|
|
79 |
public void addParserDataType(Object parserDataType, int gpeDataType); |
|
80 |
|
|
81 |
public void registerAppGeometryType(Object appGeometrytype, int gpeGeometryType); |
|
82 |
|
|
83 |
public void registerAppDataType(Object appDataType, int gpeDataType); |
|
84 |
|
|
85 |
public void registerAppGeometryType(int appGeometrytype, int gpeGeometryType); |
|
86 |
|
|
87 |
public void registerAppDataType(int appDataType, int gpeDataType); |
|
88 |
|
|
89 |
public IXSTypeDefinition getTypeDefinition(String typeName); |
|
90 |
|
|
91 |
public IXSTypeDefinition getTypeDefinition(String format, String typeName); |
|
92 |
} |
|
93 |
|
|
94 |
|
|
0 | 95 |
org.gvsig.xmlschema/library/tags/org.gvsig.xmlschema-2.0.19/org.gvsig.xmlschema.lib/org.gvsig.xmlschema.lib.api/src/main/java/org/gvsig/xmlschema/lib/api/som/IXSExtension.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.lib.api.som; |
|
2 |
|
|
3 |
|
|
4 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
Also available in: Unified diff