Revision 33180

View differences:

tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPETest.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.crs.CRSFactory;
33
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.exception.DataException;
35
import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore;
36
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
37
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
38
import org.gvsig.gpe.lib.api.GPELocator;
39
import org.gvsig.gpe.lib.api.GPEManager;
40

  
41
/**
42
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
43
 */
44
public class GPETest extends BaseTestEditableFeatureStore {
45
	public static final File file_prueba = new File("testdata/GML-points.gml");
46

  
47
	private FilesystemServerExplorer myExplorer = null;
48
	private GPEManager gpeManager = null;
49

  
50
	protected void doSetUp() throws Exception {
51
		super.doSetUp();
52
		gpeManager = GPELocator.getGPEManager();
53
	}
54

  
55
	/*
56
	 * (non-Javadoc)
57
	 *
58
	 * @see
59
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
60
	 * ()
61
	 */
62
	public DataStoreParameters getDefaultDataStoreParameters()
63
	throws DataException {
64
		GPEStoreParameters parameters = null;
65

  
66
		parameters = (GPEStoreParameters) dataManager
67
		.createStoreParameters(GPEStoreProvider.NAME);
68

  
69
		parameters.setFileName(file_prueba.getAbsolutePath());
70
		parameters.setCRS(CRSFactory.getCRS("EPSG:23030"));
71
		return parameters;
72
	}
73

  
74
	/*
75
	 * (non-Javadoc)
76
	 *
77
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
78
	 */
79
	public boolean hasExplorer() {
80
		return false;
81
	}
82

  
83
	/* (non-Javadoc)
84
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters()
85
	 */
86
	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
87
	throws Exception {
88
		return null;
89
//		if (this.myExplorer == null) {
90
//			GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this
91
//			.getDefaultDataStoreParameters();
92
//			FeatureStore store = (FeatureStore) dataManager
93
//			.createStore(gpeStoreParameters);
94
//			myExplorer = (FilesystemServerExplorer) store.getExplorer();
95
//			store.dispose();
96
//		}
97
//
98
//		return (NewFeatureStoreParameters) myExplorer
99
//		.getAddParameters(dbf_prueba_destino);
100
	}
101

  
102
	/* (non-Javadoc)
103
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources()
104
	 */
105
	public boolean usesResources() {
106
		// TODO Auto-generated method stub
107
		return false;
108
	}
109

  
110
	public boolean resourcesNotifyChanges() {
111
		return true;
112
	}
113

  
114

  
115
}
116

  
0 117

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src-test/org/gvsig/fmap/dal/store/gpe/GPEMobileTest.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
* 2009 {Iver T.I.}   {Task}
26
*/
27
 
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31
import java.util.Iterator;
32

  
33
import junit.framework.TestCase;
34

  
35
import org.gvsig.compat.se.SECompatLibrary;
36
import org.gvsig.fmap.dal.DALFileLibrary;
37
import org.gvsig.fmap.dal.DALLibrary;
38
import org.gvsig.fmap.dal.DALLocator;
39
import org.gvsig.fmap.dal.DataManager;
40
import org.gvsig.fmap.dal.DataStoreParameters;
41
import org.gvsig.fmap.dal.exception.DataException;
42
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
43
import org.gvsig.fmap.dal.feature.Feature;
44
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
45
import org.gvsig.fmap.dal.feature.FeatureSet;
46
import org.gvsig.fmap.dal.feature.FeatureStore;
47
import org.gvsig.fmap.dal.feature.FeatureType;
48
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
49
import org.gvsig.fmap.dal.impl.DALDefaultImplLibrary;
50
import org.gvsig.fmap.dal.impl.DefaultDataManager;
51
import org.gvsig.fmap.dal.index.spatial.jts.JTSIndexLibrary;
52
import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager;
53
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
54
import org.gvsig.fmap.geom.Geometry;
55
import org.gvsig.fmap.geom.impl.DefaultGeometryLibrary;
56
import org.gvsig.fmap.geom.primitive.Envelope;
57
import org.gvsig.gpe.lib.api.GPELocator;
58
import org.gvsig.gpe.lib.api.GPEManager;
59
import org.gvsig.tools.ToolsLibrary;
60
import org.gvsig.tools.persistence.xml.XMLPersistenceLibrary;
61

  
62
/**
63
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
64
 */
65
public class GPEMobileTest extends TestCase{
66
	public static final File file_prueba = new File("testdata/GML-points.gml");
67

  
68
	private FilesystemServerExplorer myExplorer = null;
69
	private GPEManager gpeManager = null;
70

  
71
	private boolean baseTestInitialized=false;
72

  
73
	private DataManager dataManager;
74

  
75
	private FeatureStore store;
76

  
77
	public void setUp(){
78
		DALLocator.registerDataManager(DefaultDataManager.class);
79
		DALLocator.registerResourceManager(DefaultResourceManager.class);
80
		if (baseTestInitialized) {
81
			return;
82
		}
83
		
84
		ToolsLibrary tools = new ToolsLibrary();
85
		tools.initialize();
86
		tools.postInitialize();
87

  
88
		XMLPersistenceLibrary xmlPersistence = new XMLPersistenceLibrary();
89
		xmlPersistence.initialize();
90
		xmlPersistence.postInitialize();
91

  
92
		DALLocator.registerDataManager(DefaultDataManager.class);
93
		DALLocator.registerResourceManager(DefaultResourceManager.class);
94
		
95
		DALLibrary lib = new DALLibrary();
96
		lib.initialize();
97
		lib.postInitialize();
98

  
99
		DALDefaultImplLibrary libImpl = new DALDefaultImplLibrary();
100
		libImpl.initialize();
101
		libImpl.postInitialize();		
102

  
103
		DALFileLibrary libFile = new DALFileLibrary();
104
		libFile.initialize();
105
		libFile.postInitialize();
106

  
107
		DefaultGeometryLibrary defGeomLib = new DefaultGeometryLibrary();
108
		defGeomLib.initialize();
109
		defGeomLib.postInitialize();
110

  
111
		JTSIndexLibrary jtsIndex = new JTSIndexLibrary();
112
		jtsIndex.initialize();
113
		jtsIndex.postInitialize();
114
		
115
//		DefaultGPEDataTypesLibrary gpeDataTypesLibrary = new DefaultGPEDataTypesLibrary();
116
//		gpeDataTypesLibrary.initialize();
117
//		gpeDataTypesLibrary.postInitialize();
118
		 
119
		DALGPELibrary gpeLibrary = new DALGPELibrary();
120
		gpeLibrary.initialize();
121
		gpeLibrary.postInitialize();
122
		
123
//		DefaultGPELibrary defaultGPElibrary = new DefaultGPELibrary();
124
//		defaultGPElibrary.initialize();
125
//		defaultGPElibrary.postInitialize();		
126
//		
127
		
128
//		DefaultXmlLibrary defaultXmllibrary = new DefaultXmlLibrary();
129
//		defaultXmllibrary.initialize();
130
//		defaultXmllibrary.postInitialize();
131
		
132
//		DefaultKmlLibrary kmlLibrary = new DefaultKmlLibrary();
133
//		kmlLibrary.initialize();
134
//		kmlLibrary.postInitialize();
135
		
136
//		DefaultGmlLibrary gmlLibrary = new DefaultGmlLibrary();
137
//		gmlLibrary.initialize();
138
//		gmlLibrary.postInitialize();	
139
		
140
		SECompatLibrary compatLibrary = new SECompatLibrary();
141
		compatLibrary.initialize();
142
		compatLibrary.postInitialize();
143

  
144
		gpeManager = GPELocator.getGPEManager();
145
		
146
		dataManager = DALLocator.getDataManager();
147
		
148
		baseTestInitialized = true;
149
	}
150

  
151

  
152
	public void testGetDataStore(){
153
		try {
154
			DataStoreParameters params = this.getDefaultDataStoreParameters();
155
			store = (FeatureStore)dataManager.createStore(params);			
156
			//gpestore.setParserName("GML");
157
			
158
			FeatureSet set;
159
			// FeatureType type = store.getDefaultFeatureType();
160
			
161
			set = store.getFeatureSet();
162

  
163
			System.out.println("Feature count: " + set.getSize());
164
			Iterator it = set.iterator();
165
			// Iterator ftIt;
166
			// FeatureAttributeDescriptor desc;
167

  
168
			int i = 0;
169
			Feature feature;
170
			while (it.hasNext()) {
171
				// ftIt = type.iterator();
172

  
173
				System.out.println("=====================================");
174
				System.out.println("Feature " + i + ": ");
175
				System.out.println("-------------------------------------");
176
				feature = (Feature) it.next();
177
				Geometry geom = (Geometry) feature.getDefaultGeometry(); // .getGeometries().get(0);
178
				
179
				FeatureType ft = feature.getType();
180
				FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors();
181
				int len = atts.length;
182
				FeatureAttributeDescriptor att;
183
				for (int j=0; j<len; j++) {
184
					att = ft.getAttributeDescriptor(j);
185
					System.out.println("ATT: " + att.getName() + "; VAL = " + feature.get(j).toString());
186
				}
187
				System.out.println("-------------------------------------");
188
				Envelope env = geom.getEnvelope();
189
				System.out.println("GEOM BB: "
190
						+ env.getMinimum(0)
191
						+ ", " + env.getMinimum(1)
192
						+ ", " + env.getMaximum(0)
193
						+ ", " + env.getMaximum(1));
194
				System.out.println("=====================================");
195
				i++;
196
			}
197
			set.dispose();
198
			store.dispose();
199
		} catch (DataException e) {
200
			// TODO Auto-generated catch block
201
			e.printStackTrace();
202
		} catch (ValidateDataParametersException e) {
203
			// TODO Auto-generated catch block
204
			e.printStackTrace();
205
		}
206
	}
207

  
208
	/*
209
	 * (non-Javadoc)
210
	 *
211
	 * @see
212
	 * org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters
213
	 * ()
214
	 */
215
	public DataStoreParameters getDefaultDataStoreParameters()
216
	throws DataException {
217
		GPEStoreParameters parameters = null;
218

  
219
		parameters = (GPEStoreParameters) dataManager
220
		.createStoreParameters(GPEStoreProvider.NAME);
221

  
222
		parameters.setFileName(file_prueba.getAbsolutePath());
223
		//IProjection proj = null; 
224
		// parameters.setSRS(CRSFactory.getCRS("ESPG:23030"));
225
		//parameters.setSRS(proj);
226
		
227
		return parameters;
228
	}
229

  
230
	/*
231
	 * (non-Javadoc)
232
	 *
233
	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
234
	 */
235
	public boolean hasExplorer() {
236
		return false;
237
	}
238

  
239
	/* (non-Javadoc)
240
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#getDefaultNewDataStoreParameters()
241
	 */
242
	public NewFeatureStoreParameters getDefaultNewDataStoreParameters()
243
	throws Exception {
244
		return null;
245
//		if (this.myExplorer == null) {
246
//			GPEStoreParameters gpeStoreParameters = (GPEStoreParameters) this
247
//			.getDefaultDataStoreParameters();
248
//			FeatureStore store = (FeatureStore) dataManager
249
//			.createStore(gpeStoreParameters);
250
//			myExplorer = (FilesystemServerExplorer) store.getExplorer();
251
//			store.dispose();
252
//		}
253
//
254
//		return (NewFeatureStoreParameters) myExplorer
255
//		.getAddParameters(dbf_prueba_destino);
256
	}
257

  
258
	/* (non-Javadoc)
259
	 * @see org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore#usesResources()
260
	 */
261
	public boolean usesResources() {
262
		// TODO Auto-generated method stub
263
		return false;
264
	}
265

  
266
	public boolean resourcesNotifyChanges() {
267
		return true;
268
	}
269

  
270
}
271

  
0 272

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/config/text.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Otros
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordenadas
6
gpe_xmlVersion=Versi?n de XML
7
gpe_xmlEncoding=Codificaci?n
8
gpe_defaultBlancSpace=Espacio en blanco para la etiquetas
9
gpe_namespacePrefix=Prefijo del Namespace
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Nombre del esquema por defecto
12
gpe_coordinates=S?mbolo decimal
13
gpe_coordinatesSeparator=Separador entre coordenadas
14
gpe_tuplesSeparator=Separador entre pares de coordenadas
15
gpe_decimalDigits=N?mero de decimales
16
gpe_exporting=Exportando capa
17
gpe_select_version=Selecciona la versi?n 
18
gpe_select_format=Selecciona el formato
19
gpe_select_writer=Selecciona el writer
20
gpe_select_schema=Selecciona el XML schema
21
gpe_create_default_schema=Crear un esquema por defecto
22
gpe_select_file=Seleciona el fichero
23
gpe_select_writer_window=Exportar a fichero
24
gpe_gvsig_dont_support_multilayer=La actual versi?n de gvSIG no soporta multicapa.\ Todas las geometr\u00edas se cargar\u00e1n en la misma capa. 
0 25

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/config/about.htm
1
<html>
2
  <head>
3
    <title>libGPE Extension.</title>
4
    <meta content="">
5
    <style></style>
6
  </head>
7
  <body>
8
<table width="60%" border="0">
9
  <tr>
10
     <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
11
    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
12
  </tr>
13
  <tr>
14
    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I. 2008.</font></td>
16
  </tr>
17
</table>
18
  <h3>libGPE Extension.</h3>
19
  <p><br><br><b> Build Number: #build.number#</b></p>
20
  </body>
21
</html>
0 22

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/config/text_en.properties
1
gpe_preferences_window=Gml Persistence Engine
2
gpe_preferences_window_other=Others
3
gpe_preferences_window_xmlschema=XML Schema
4
gpe_preferences_window_xml=XML
5
gpe_preferences_window_coordinates=Coordinates
6
gpe_xmlVersion=XML version
7
gpe_xmlEncoding=XML Encoding
8
gpe_defaultBlancSpace=Blank space for the label names
9
gpe_namespacePrefix=Namespace prefix
10
gpe_namespaceURI=Namespace
11
gpe_schemaName=Default namespace
12
gpe_coordinates=Decimal symbol
13
gpe_coordinatesSeparator=Separator between coordinates
14
gpe_tuplesSeparator=Separator between a pair of coordinates
15
gpe_decimalDigits=Decimal number
16
gpe_exporting=Exporting a layer
17
gpe_select_version=Select the version 
18
gpe_select_format=Select the format
19
gpe_select_writer=Select a writer
20
gpe_select_schema=Select a schema
21
gpe_create_default_schema=Create a default schema
22
gpe_select_file=Select the file
23
gpe_select_writer_window=Export to file
24
gpe_gvsig_dont_support_multilayer=Current gvSIG version doesnt support multilayer.\All the geometries have been loaded on the same layer.
0 25

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<libraries library-dir="lib"/>
5
	<resourceBundle name="text"/>
6
	<extensions>		
7
		<extension class-name="org.gvsig.gpe.GPELibraryExtension"
8
			description=""
9
			active="true"
10
			priority="1">			
11
		</extension>
12
		<!-- 	
13
		<extension class-name="org.gvsig.gpe.GPEWriterExtension"
14
			description="Support for writing"
15
			active="true">
16
			<menu text="Capa/export_to/GML" action-command="GML"/>
17
			<menu text="Capa/export_to/KML" action-command="KML"/>
18
		</extension>
19
		<extension class-name="org.gvsig.gpe.AboutGPEExtension"
20
                description="Extension to add about panel."
21
                active="true"
22
                priority="1">
23
		</extension>
24
		-->    			
25
	</extensions>
26
</plugin-config>
0 27

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/build.number
1
#Build Number for ANT. Do not edit!
2
#Tue Apr 28 16:00:47 CEST 2009
3
build.number=2005
0 4

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/DALGPELibrary.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.util.ArrayList;
31
import java.util.List;
32

  
33
import org.gvsig.fmap.dal.DALFileLibrary;
34
import org.gvsig.fmap.dal.DALFileLocator;
35
import org.gvsig.fmap.dal.DALLibrary;
36
import org.gvsig.fmap.dal.DALLocator;
37
import org.gvsig.fmap.dal.DataTypes;
38
import org.gvsig.fmap.dal.FileHelper;
39
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.metadata.exceptions.MetadataException;
42
import org.gvsig.tools.library.AbstractLibrary;
43
import org.gvsig.tools.library.Library;
44
import org.gvsig.tools.library.LibraryException;
45
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
46
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
47
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
48
import org.gvsig.xmlschema.lib.impl.DefaultXMLSchemaLibrary;
49

  
50
/**
51
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
52
 */
53
public class DALGPELibrary extends AbstractLibrary {
54
	
55
	public DALGPELibrary() {
56
		super(DALGPELibrary.class, Library.TYPE.IMPL);
57
		require(DALLibrary.class);
58
		require(DALFileLibrary.class);
59
		require(DefaultXMLSchemaLibrary.class);
60
	}
61
	
62
	protected void doInitialize() throws LibraryException {
63
		// Do nothing
64
	}
65

  
66
	protected void doPostInitialize() throws LibraryException {
67

  
68
		List exs = new ArrayList();
69

  
70
		FileHelper.registerParametersDefinition(
71
				GPEStoreParameters.PARAMETERS_DEFINITION_NAME,
72
				GPEStoreParameters.class, "GPEParameters.xml");
73
		try {
74
			FileHelper.registerMetadataDefinition(
75
					GPEStoreProvider.METADATA_DEFINITION_NAME,
76
					GPEStoreProvider.class, "GPEMetadata.xml");
77
		} catch (MetadataException e) {
78
			exs.add(e);
79
		}
80

  
81

  
82
		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
83
		.getDataManager();
84

  
85
		if (!dataman.getStoreProviders().contains(GPEStoreProvider.NAME)) {
86
			dataman.registerStoreProvider(GPEStoreProvider.NAME,
87
					GPEStoreProvider.class, GPEStoreParameters.class);
88
		}
89

  
90
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
91
				GPEStoreProvider.NAME, GPEStoreProvider.DESCRIPTION,
92
				GPEFileSystemServerProvider.class);
93
		
94
		// Validate there is any implementation registered.
95
		XMLSchemaManager xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();
96
		if (xmlSchemaManager == null) {
97
			exs.add(new ReferenceNotRegisteredException(
98
					XMLSchemaLocator.XMLSCHEMA_MANAGER_NAME, XMLSchemaLocator
99
							.getInstance()));
100
		}
101
		
102
		//Register the application types in gpe.
103
		xmlSchemaManager.registerAppDataType(DataTypes.UNKNOWN, DataTypes.UNKNOWN);
104
		xmlSchemaManager.registerAppDataType(DataTypes.BOOLEAN, DataTypes.BOOLEAN);
105
		xmlSchemaManager.registerAppDataType(DataTypes.BYTE, DataTypes.BYTE);
106
		xmlSchemaManager.registerAppDataType(DataTypes.CHAR, DataTypes.CHAR);
107
		xmlSchemaManager.registerAppDataType(DataTypes.INT, DataTypes.INT);
108
		xmlSchemaManager.registerAppDataType(DataTypes.LONG, DataTypes.LONG);
109
		xmlSchemaManager.registerAppDataType(DataTypes.FLOAT, DataTypes.FLOAT);
110
		xmlSchemaManager.registerAppDataType(DataTypes.DOUBLE, DataTypes.DOUBLE);
111
		xmlSchemaManager.registerAppDataType(DataTypes.STRING, DataTypes.STRING);
112
		xmlSchemaManager.registerAppDataType(DataTypes.DATE, DataTypes.DATE);
113
		xmlSchemaManager.registerAppDataType(DataTypes.TIME, DataTypes.TIME);
114
		xmlSchemaManager.registerAppDataType(DataTypes.TIMESTAMP, DataTypes.TIMESTAMP);
115
		xmlSchemaManager.registerAppDataType(DataTypes.GEOMETRY, DataTypes.GEOMETRY);
116
		xmlSchemaManager.registerAppDataType(DataTypes.OBJECT, DataTypes.OBJECT);
117
		xmlSchemaManager.registerAppDataType(DataTypes.DYNOBJECT, DataTypes.DYNOBJECT);
118
		xmlSchemaManager.registerAppDataType(DataTypes.CRS, DataTypes.CRS);		
119
		xmlSchemaManager.registerAppDataType(DataTypes.FILE, DataTypes.FILE);
120
		xmlSchemaManager.registerAppDataType(DataTypes.BYTEARRAY, DataTypes.BYTEARRAY);
121
		//geometries
122
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.GEOMETRY, XMLSchemaManager.GEOMETRY);
123
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.POINT, XMLSchemaManager.POINT);
124
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.CURVE, XMLSchemaManager.LINESTRING);
125
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SURFACE, XMLSchemaManager.POLYGON);
126
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.SOLID, XMLSchemaManager.SOLID);
127
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.AGGREGATE, XMLSchemaManager.MULTIGEOMETRY);
128
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTIPOINT, XMLSchemaManager.MULTIPOINT);
129
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTICURVE, XMLSchemaManager.MULTILINESTRING);
130
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISURFACE, XMLSchemaManager.MULTIPOLYGON);
131
		xmlSchemaManager.registerAppGeometryType(Geometry.TYPES.MULTISOLID, XMLSchemaManager.MULTISOLID);
132

  
133
		if (exs.size() > 0) {
134
			throw new LibraryException(this.getClass(), exs);
135
		}
136
	}
137

  
138
}
139

  
140

  
0 141

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/NotMultipleLayerWarning.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

  
3
import java.util.HashMap;
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$
51
 * $Log$
52
 *
53
 */
54
/**
55
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
56
 */
57
public class NotMultipleLayerWarning extends BaseException {
58
	private static final long serialVersionUID = -3822382578296490537L;
59

  
60
	public NotMultipleLayerWarning() {		
61
		initialize();		
62
	}
63
	
64
	/**
65
	 * Initialize the properties
66
	 */
67
	private void initialize() {
68
		messageKey = "gpe_not_multiple_layer_warning";
69
		formatString = "This gvSIG version doesn't support " +
70
			"muliple layers.";
71
	}
72
	
73
	/*
74
	 *  (non-Javadoc)
75
	 * @see org.gvsig.exceptions.BaseException#values()
76
	 */
77
	protected Map values() {
78
		HashMap params = new HashMap();
79
		return params;	
80
	}
81
}
82
	
0 83

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/GPELayerException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

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

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * Thrown when there is an unknown problem loading 
57
 * a GPE layer
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class GPELayerException extends BaseException {
61
	private static final long serialVersionUID = -5810461892751191682L;
62
	private FLayer layer = null;
63
	
64
	public GPELayerException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_gvsig_load_layer_error";
75
		formatString = "Error loading the layer " +
76
				"%(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
0 90

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/exceptions/NotExtentException.java
1
package org.gvsig.fmap.dal.store.gpe.exceptions;
2

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

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.exception.BaseException;
8

  
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * This exception is thrown when it is not possible
57
 * to calculate an extent for a layer  
58
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
59
 */
60
public class NotExtentException extends BaseException {
61
	private static final long serialVersionUID = 620553176638259949L;
62
	private FLayer layer = null;
63
	
64
	public NotExtentException(FLayer layer, Throwable exception) {
65
		this.layer = layer;
66
		initialize();
67
		initCause(exception);
68
	}
69
	
70
	/**
71
	 * Initialize the properties
72
	 */
73
	private void initialize() {
74
		messageKey = "gpe_calculate_extent_error";
75
		formatString = "Error calculating the extent " +
76
				"for the layer %(layerName).";
77
	}
78
	
79
	/*
80
	 *  (non-Javadoc)
81
	 * @see org.gvsig.exceptions.BaseException#values()
82
	 */
83
	protected Map values() {
84
		HashMap params = new HashMap();
85
		params.put("layerName", layer.getName());
86
		return params;	
87
	}
88
	
89
}
0 90

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEFileSystemServerProvider.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.dal.DALLocator;
33
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.NewDataStoreParameters;
35
import org.gvsig.fmap.dal.exception.CreateException;
36
import org.gvsig.fmap.dal.exception.DataException;
37
import org.gvsig.fmap.dal.exception.RemoveException;
38
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
39
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
40
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
41
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
42
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
43

  
44
/**
45
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
46
 */
47
public class GPEFileSystemServerProvider implements FilesystemServerExplorerProvider,
48
ResourceConsumer {
49
	protected FilesystemServerExplorerProviderServices serverExplorer;
50

  
51
	/* (non-Javadoc)
52
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#canCreate()
53
	 */
54
	public boolean canCreate() {
55
		// TODO Auto-generated method stub
56
		return false;
57
	}
58

  
59
	/* (non-Javadoc)
60
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#canCreate(org.gvsig.fmap.dal.NewDataStoreParameters)
61
	 */
62
	public boolean canCreate(NewDataStoreParameters parameters) {
63
		// TODO Auto-generated method stub
64
		return false;
65
	}
66

  
67
	/* (non-Javadoc)
68
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#create(org.gvsig.fmap.dal.NewDataStoreParameters, boolean)
69
	 */
70
	public void create(NewDataStoreParameters parameters, boolean overwrite)
71
	throws CreateException {
72
		// TODO Auto-generated method stub
73

  
74
	}
75

  
76
	/* (non-Javadoc)
77
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#getCreateParameters()
78
	 */
79
	public NewDataStoreParameters getCreateParameters() throws DataException {
80
		return (NewFeatureStoreParameters) DALLocator.getDataManager()
81
		.createStoreParameters(this.getDataStoreProviderName());
82
	}
83

  
84
	/* (non-Javadoc)
85
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#initialize(org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices)
86
	 */
87
	public void initialize(
88
			FilesystemServerExplorerProviderServices serverExplorer) {
89
		this.serverExplorer = serverExplorer;		
90
	}
91

  
92
	/* (non-Javadoc)
93
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#remove(org.gvsig.fmap.dal.DataStoreParameters)
94
	 */
95
	public void remove(DataStoreParameters parameters) throws RemoveException {
96
		// TODO Auto-generated method stub
97

  
98
	}
99

  
100
	/* (non-Javadoc)
101
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter#getDataStoreProviderName()
102
	 */
103
	public String getDataStoreProviderName() {
104
		return GPEStoreProvider.NAME;
105
	}
106

  
107
	/* (non-Javadoc)
108
	 * @see org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter#getDescription()
109
	 */
110
	public String getDescription() {
111
		return GPEStoreProvider.DESCRIPTION;
112
	}
113

  
114
	/* (non-Javadoc)
115
	 * @see java.io.FileFilter#accept(java.io.File)
116
	 */
117
	public boolean accept(File pathName) {
118
		return pathName.getName().toLowerCase().endsWith(".gml");
119
	}
120

  
121
	/* (non-Javadoc)
122
	 * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#closeResourceRequested(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
123
	 */
124
	public boolean closeResourceRequested(ResourceProvider resource) {
125
		// TODO Auto-generated method stub
126
		return false;
127
	}
128

  
129
	/* (non-Javadoc)
130
	 * @see org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.gvsig.fmap.dal.resource.spi.ResourceProvider)
131
	 */
132
	public void resourceChanged(ResourceProvider resource) {
133
		// TODO Auto-generated method stub
134

  
135
	}
136

  
137
}
138

  
0 139

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPESetProvider.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.util.HashMap;
31
import java.util.Iterator;
32

  
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.FeatureQuery;
35
import org.gvsig.fmap.dal.feature.FeatureType;
36
import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
37
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureProviderIterator;
38
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureSetProvider;
39
import org.gvsig.tools.exception.BaseException;
40

  
41
/**
42
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
43
 */
44
public class GPESetProvider extends AbstractFeatureSetProvider {
45

  
46
	public GPESetProvider(GPEStoreProvider store,
47
			FeatureQuery query) {
48
		super(store, query, null);
49
	}
50

  
51
	public GPESetProvider(GPEStoreProvider store,
52
			FeatureQuery query, FeatureType featureType) {
53
		super(store, query, featureType);
54
	}
55

  
56
	/* (non-Javadoc)
57
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canFilter()
58
	 */
59
	public boolean canFilter() {
60
		// TODO Auto-generated method stub
61
		return false;
62
	}
63

  
64
	/* (non-Javadoc)
65
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canIterateFromIndex()
66
	 */
67
	public boolean canIterateFromIndex() {
68
		// TODO Auto-generated method stub
69
		return false;
70
	}
71

  
72
	/* (non-Javadoc)
73
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canOrder()
74
	 */
75
	public boolean canOrder() {
76
		// TODO Auto-generated method stub
77
		return false;
78
	}
79

  
80
	/* (non-Javadoc)
81
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#getSize()
82
	 */
83
	public long getSize() throws DataException {
84
		return getStore().getFeatureCount();
85
	}
86

  
87
	/* (non-Javadoc)
88
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#isEmpty()
89
	 */
90
	public boolean isEmpty() throws DataException {
91
		// TODO Auto-generated method stub
92
		return false;
93
	}
94

  
95
	protected AbstractFeatureProviderIterator createFastIterator(long index)
96
			throws DataException {
97
		return new GPEFastIterator((GPEStoreProvider) getStore(),
98
				getFeatureType());
99
	}
100

  
101
	protected AbstractFeatureProviderIterator createIterator(long index)
102
			throws DataException {
103
		return new GPEIterator((GPEStoreProvider) getStore(), getFeatureType());
104
	}
105

  
106
	protected class GPEIterator extends AbstractFeatureProviderIterator {
107
		protected FeatureType type;
108
		Iterator keys = null;
109
		HashMap features = null;
110

  
111
		public GPEIterator(GPEStoreProvider store, FeatureType type)
112
				throws DataException {
113
			super(store);
114
			this.type = type;
115
			features = store.getContentHandler().getFeatureSet();
116
			keys = features.keySet().iterator();
117
		}
118

  
119
		protected boolean internalHasNext() {
120
			return keys.hasNext();
121
		}
122

  
123
		protected Object internalNext() {
124
			return ((DefaultFeature)features.get(keys.next())).getData();			
125
		}
126

  
127
		/*
128
		 * (non-Javadoc)
129
		 * @see java.util.Iterator#remove()
130
		 */
131
		public void remove() {
132
			throw new UnsupportedOperationException();
133
		}
134

  
135
		protected void doDispose() throws BaseException {
136
			features.clear();
137
		}
138
	}
139
	
140
	protected class GPEFastIterator extends GPEIterator {
141

  
142
		public GPEFastIterator(GPEStoreProvider store, FeatureType type) throws DataException {
143
			super(store, type);
144
		}
145
	}
146

  
147
	protected void doDispose() throws BaseException {
148
		// Nothing to do
149
	}
150
}
151

  
0 152

  
tags/v2_0_0_Build_2010/extensions/extGPE-gvSIG/src/org/gvsig/fmap/dal/store/gpe/GPEStoreProvider.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
 * 2009 {Iver T.I.}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.store.gpe;
29

  
30
import java.io.File;
31

  
32
import org.cresques.cts.IProjection;
33
import org.gvsig.fmap.dal.DALLocator;
34
import org.gvsig.fmap.dal.DataManager;
35
import org.gvsig.fmap.dal.DataServerExplorer;
36
import org.gvsig.fmap.dal.DataStoreParameters;
37
import org.gvsig.fmap.dal.DataTypes;
38
import org.gvsig.fmap.dal.FileHelper;
39
import org.gvsig.fmap.dal.exception.DataException;
40
import org.gvsig.fmap.dal.exception.InitializeException;
41
import org.gvsig.fmap.dal.exception.OpenException;
42
import org.gvsig.fmap.dal.exception.ReadException;
43
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
44
import org.gvsig.fmap.dal.feature.FeatureQuery;
45
import org.gvsig.fmap.dal.feature.FeatureType;
46
import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
47
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
48
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
49
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
50
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
51
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
52
import org.gvsig.fmap.dal.resource.file.FileResource;
53
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
54
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
55
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
56
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
57
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
58
import org.gvsig.fmap.dal.store.gpe.handlers.FmapContentHandler;
59
import org.gvsig.fmap.dal.store.gpe.handlers.FmapErrorHandler;
60
import org.gvsig.fmap.geom.Geometry.TYPES;
61
import org.gvsig.fmap.geom.primitive.Envelope;
62
import org.gvsig.gpe.lib.api.GPELocator;
63
import org.gvsig.gpe.lib.api.GPEManager;
64
import org.gvsig.tools.dynobject.DynObject;
65
import org.gvsig.xmlschema.lib.api.XMLSchemaLocator;
66
import org.gvsig.xmlschema.lib.api.XMLSchemaManager;
67

  
68
/**
69
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
70
 */
71
public class GPEStoreProvider extends AbstractFeatureStoreProvider implements
72
ResourceConsumer {
73
	public static final String NAME = "GPE";
74
	public static final String DESCRIPTION = "GPE file";
75
	public static final String METADATA_DEFINITION_NAME = NAME;
76

  
77
	protected File m_Fich;
78
	protected boolean isOpen = false;
79
	private GPEStoreParameters gpeParams;
80
	private ResourceProvider gpeResource;
81
	
82
	//Managers to manage the parsing process
83
	protected GPEManager gpeManager = null;
84
	protected XMLSchemaManager xmlSchemaManager = null;
85
	
86
	//The content handler and the error handler
87
	protected FmapContentHandler contentHandler;
88
	protected FmapErrorHandler errorHandler;
89

  
90
	public GPEStoreProvider(DataStoreParameters params,
91
			DataStoreProviderServices storeServices)
92
	throws InitializeException {
93
		this(params, storeServices, FileHelper
94
				.newMetadataContainer(METADATA_DEFINITION_NAME));
95
	}
96

  
97
	protected GPEStoreProvider(DataStoreParameters params,
98
			DataStoreProviderServices storeServices, DynObject metadata)
99
			throws InitializeException {
100

  
101
		super(params, storeServices, metadata);
102
		
103
		this.setDynValue("Envelope", null);
104
		
105
		gpeManager = GPELocator.getGPEManager();
106
		xmlSchemaManager = XMLSchemaLocator.getXMLSchemaManager();		
107
		
108
		retrieveFile();
109
		gpeResource = this.createResource(FileResource.NAME,
110
				new Object[] { m_Fich.getAbsolutePath() });
111
		gpeResource.addConsumer(this);
112
		this.initFeatureType();
113
	}
114
	
115
	protected void retrieveFile() throws InitializeException{
116
		m_Fich = getGPEParameters().getFile();
117
	}
118

  
119
	protected void initFeatureType() throws InitializeException {
120
		try {
121
			
122
			this.open();
123
		} catch (DataException e) {
124
			throw new InitializeException(this.getName(), e);
125
		}
126
	}
127

  
128
	private GPEStoreParameters getGPEParameters() {
129
		return (GPEStoreParameters) this.getParameters();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff