Revision 25789

View differences:

branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java
3 3
import org.gvsig.fmap.dal.DataTypes;
4 4
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
5 5
import org.gvsig.tools.ToolsLocator;
6
import org.gvsig.tools.dynobject.DelegatedDynObject;
6 7
import org.gvsig.tools.dynobject.DynClass;
7 8
import org.gvsig.tools.dynobject.DynField;
8 9
import org.gvsig.tools.dynobject.DynObjectManager;
9 10

  
10 11
public class FileResourceParameters extends AbstractResourceParameters {
11
    
12

  
12 13
    public static final String DYNCLASS_NAME = "FileResourceParameters";
13 14

  
14 15
    private static final String FIELD_FILE_NAME = "fileName";
15 16

  
16 17
    public FileResourceParameters() {
17
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
18
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
19
				.getDynObjectManager()
18 20
				.createDynObject(registerDynClass());
19 21
	}
20 22

  
......
41 43
	public String getTypeName() {
42 44
		return FileResource.NAME;
43 45
	}
44
	
46

  
45 47
    private DynClass registerDynClass() {
46 48
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
47 49
        DynClass dynClass = dynman.get(DYNCLASS_NAME);
......
50 52
            dynClass = dynman.add(DYNCLASS_NAME);
51 53

  
52 54
            field = dynClass.addDynField(FIELD_FILE_NAME);
53
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
55
            field.setTheTypeOfAvailableValues(DynField.SINGLE);
54 56
            field.setDescription("The name of the file");
55
            field.setType(DynField.SINGLE);
57
            field.setType(DataTypes.STRING);
56 58
        }
57 59
        return dynClass;
58 60
    }
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java
4 4
import org.gvsig.fmap.dal.DataTypes;
5 5
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
6 6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DelegatedDynObject;
7 8
import org.gvsig.tools.dynobject.DynClass;
8 9
import org.gvsig.tools.dynobject.DynField;
9 10
import org.gvsig.tools.dynobject.DynObjectManager;
......
16 17
    private static final String FIELD_ROOT = "root";
17 18

  
18 19
	public FilesystemServerExplorerParameters() {
19
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
20
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
21
				.getDynObjectManager()
20 22
				.createDynObject(this.registerDynClass());
21 23
	}
22 24

  
......
28 30
    		dynClass = dynman.add(DYNCLASS_NAME);
29 31

  
30 32
    		field = dynClass.addDynField(FIELD_ROOT);
31
    		field.setTheTypeOfAvailableValues(DataTypes.STRING);
33
    		field.setType(DataTypes.STRING);
32 34
    		field.setDescription("Root directory path of the explorer");
33
    		field.setType(DynField.SINGLE);
35
    		field.setTheTypeOfAvailableValues(DynField.SINGLE);
34 36

  
35 37

  
36 38
    		field = dynClass.addDynField("initialpath");
37
			field.setTheTypeOfAvailableValues(DataTypes.STRING);
39
			field.setType(DataTypes.STRING);
38 40
			field.setDescription("Initial path of the explorer");
39
			field.setType(DynField.SINGLE);
41
			field.setTheTypeOfAvailableValues(DynField.SINGLE);
40 42

  
41 43
    	}
42 44
    	return dynClass;
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFFilesystemServerProvider.java
180 180
		return false;
181 181
	}
182 182

  
183
	/*
184
	 * (non-Javadoc)
185
	 * 
186
	 * @see
187
	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
188
	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
189
	 */
190
	public void resourceChanged(ResourceProvider resource) {
191
		//Do nothing
192

  
193
	}
194

  
195

  
183 196
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java
7 7
import java.util.ArrayList;
8 8
import java.util.Iterator;
9 9
import java.util.List;
10
import java.util.Set;
10 11
import java.util.Vector;
11 12

  
12 13
import org.cresques.cts.IProjection;
......
27 28
import org.gvsig.fmap.dal.DALLocator;
28 29
import org.gvsig.fmap.dal.DataManager;
29 30
import org.gvsig.fmap.dal.DataServerExplorer;
31
import org.gvsig.fmap.dal.DataStoreNotification;
30 32
import org.gvsig.fmap.dal.DataTypes;
31 33
import org.gvsig.fmap.dal.exception.DataException;
32 34
import org.gvsig.fmap.dal.exception.InitializeException;
......
67 69
import org.gvsig.fmap.geom.primitive.Surface2DZ;
68 70
import org.gvsig.fmap.geom.util.Converter;
69 71
import org.gvsig.fmap.geom.util.UtilFunctions;
72
import org.gvsig.tools.dynobject.exception.DynMethodException;
70 73
import org.gvsig.tools.exception.NotYetImplemented;
71
import org.gvsig.tools.operations.OperationNotSupportedException;
72 74
import org.gvsig.tools.persistence.AbstractPersistenceManager;
73 75
import org.gvsig.tools.persistence.PersistenceException;
74 76
import org.gvsig.tools.persistence.PersistentState;
......
76 78
public class DXFStoreProvider extends AbstractMemoryStoreProvider implements
77 79
		ResourceConsumer {
78 80

  
79
	final public static String NAME = "DXF";
80
	final public static String DESCRIPTION = "DXF file";
81
	public static final String NAME = "DXF";
82
	public static final String DESCRIPTION = "DXF file";
83
	public static final String DYNCLASS_NAME = "DXFFile";
81 84

  
82 85
	private int ID_FIELD_ID = 0;
83 86
	private int ID_FIELD_GEOMETRY = 1;
......
123 126
		this.projection = this.getParameters().getCRS();
124 127

  
125 128
		try {
126
			leyendBuilder = (LegendBuilder) store.invokeOperation(
127
					LegendBuilder.OPERATION_NAME, null);
128
		} catch (OperationNotSupportedException e) {
129
			leyendBuilder = (LegendBuilder) store.invokeDynMethod(
130
					LegendBuilder.DYNMETHOD_BUILDER_NAME, null);
131
		} catch (DynMethodException e) {
129 132
			leyendBuilder = null;
130 133
		} catch (Exception e) {
131 134
			throw new InitializeException(e);
......
237 240
			}
238 241
			resource.notifyOpen();
239 242
			writer.end();
240
			resource.notifyClose();
243
			resource.notifyChanges();
241 244
			features.dispose();
242 245
			counterNewsOIDs = 0;
243 246

  
......
1359 1362
		return this.envelope;
1360 1363
	}
1361 1364

  
1365
	public Object getMetadataID() {
1366
		// TODO Auto-generated method stub
1367
		return null;
1368
	}
1362 1369

  
1370
	public Iterator getChilds() {
1371
		// TODO Auto-generated method stub
1372
		return null;
1373
	}
1363 1374

  
1375
	/*
1376
	 * (non-Javadoc)
1377
	 * 
1378
	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
1379
	 */
1380
	public Set getMetadataChildren() {
1381
		return null;
1382
	}
1383

  
1384
	/*
1385
	 * (non-Javadoc)
1386
	 * 
1387
	 * @see org.gvsig.metadata.Metadata#getMetadataName()
1388
	 */
1389
	public String getMetadataName() {
1390
		return this.getParameters().getFileName();
1391
	}
1392

  
1393
	/*
1394
	 * (non-Javadoc)
1395
	 * 
1396
	 * @see
1397
	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
1398
	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
1399
	 */
1400
	public void resourceChanged(ResourceProvider resource) {
1401
		this.store.notifyChange(DataStoreNotification.RESOURCE_CHANGED,
1402
				resource);
1403
	}
1364 1404
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegend.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.store.dxf.legend;
29

  
30
import org.gvsig.fmap.dal.exception.OpenException;
31
import org.gvsig.fmap.dal.feature.spi.LegendBuilder;
32
import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DynClass;
35
import org.gvsig.tools.dynobject.DynMethod;
36
import org.gvsig.tools.dynobject.DynObject;
37
import org.gvsig.tools.dynobject.exception.DynMethodException;
38
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
39

  
40
public class DXFGetLegend implements DynMethod {
41
	private static Integer code = null;
42

  
43
	static void resgister(DynClass dxfLegendDynClass) {
44
		if (code != null) {
45
			return;
46
		}
47
		code = new Integer(ToolsLocator.getDynObjectManager()
48
				.registerDynMethod(dxfLegendDynClass, new DXFGetLegend()));
49

  
50
	}
51
	public int getCode() throws DynMethodNotSupportedException {
52
		return code.intValue();
53
	}
54

  
55
	public String getDescription() {
56
		return "DXF Legend";
57
	}
58

  
59
	public String getName() {
60
		return LegendBuilder.DYNMETHOD_GET_NAME;
61
	}
62

  
63
	public Object invoke(Object self, DynObject context)
64
			throws DynMethodException {
65
		try {
66
			return ((DXFStoreProvider) self).getLeyend();
67
		} catch (OpenException e) {
68
			//FIXME
69
			throw new RuntimeException(e);
70
		}
71
	}
72

  
73
}
0 74

  
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.fmap.dal.store.dxf.legend;
32

  
33
import org.gvsig.fmap.dal.store.dxf.DXFLibrary;
34
import org.gvsig.fmap.dal.store.dxf.DXFStoreProvider;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DynClass;
37
import org.gvsig.tools.dynobject.DynObjectManager;
38
import org.gvsig.tools.locator.BaseLibrary;
39
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
40

  
41
/**
42
 * @author jmvivo
43
 *
44
 */
45
public class DXFLegendLibrary extends BaseLibrary {
46

  
47
	public static final String DXFLEGEND_DYNCLASS_NAME = "DXFLegend";
48

  
49
	public void initialize() throws ReferenceNotRegisteredException {
50
		super.initialize();
51
	}
52

  
53
	public void postInitialize() throws ReferenceNotRegisteredException {
54
		super.postInitialize();
55

  
56
		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
57
		DynClass dynClass = dynMan.get(DXFLEGEND_DYNCLASS_NAME);
58

  
59
		if (dynClass != null) {
60
			return;
61
		}
62

  
63
		dynClass = dynMan.add(DXFLEGEND_DYNCLASS_NAME);
64

  
65

  
66
		DXFGetLegendBuilder.resgister(dynClass);
67
		DXFGetLegend.resgister(dynClass);
68

  
69

  
70
		DynClass dxfDynClass = dynMan.get(DXFStoreProvider.DYNCLASS_NAME);
71
		if (dxfDynClass == null) {
72
			DXFLibrary dxfLibrary = new DXFLibrary();
73
			dxfLibrary.initialize();
74
			dxfLibrary.postInitialize();
75

  
76
			dxfDynClass = dynMan.get(DXFStoreProvider.DYNCLASS_NAME);
77
		}
78
		dxfDynClass.extend(dynClass);
79

  
80
	}
81

  
82
}
0 83

  
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFGetLegendBuilder.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.store.dxf.legend;
29

  
30
import org.gvsig.fmap.dal.feature.spi.LegendBuilder;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.dynobject.DynClass;
33
import org.gvsig.tools.dynobject.DynMethod;
34
import org.gvsig.tools.dynobject.DynObject;
35
import org.gvsig.tools.dynobject.exception.DynMethodException;
36
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
37

  
38
public class DXFGetLegendBuilder implements DynMethod {
39
	private static Integer code = null;
40

  
41
	static void resgister(DynClass dxfLegendDynClass) {
42
		if (code != null) {
43
			return;
44
		}
45
		code = new Integer(ToolsLocator.getDynObjectManager()
46
				.registerDynMethod(
47
						dxfLegendDynClass, new DXFGetLegendBuilder()));
48

  
49
	}
50
	public int getCode() throws DynMethodNotSupportedException {
51
		return code.intValue();
52
	}
53

  
54
	public String getDescription() {
55
		return "DXF LegendBuilder creator";
56
	}
57

  
58
	public String getName() {
59
		return LegendBuilder.DYNMETHOD_BUILDER_NAME;
60
	}
61

  
62
	public Object invoke(Object self, DynObject context)
63
			throws DynMethodException {
64
		return new DXFLegendBuilder();
65
	}
66

  
67
}
0 68

  
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/legend/DXFLegendBuilder.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.store.dxf.legend;
29

  
30
import org.gvsig.fmap.dal.feature.spi.FeatureData;
31
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
32
import org.gvsig.fmap.dal.feature.spi.LegendBuilder;
33

  
34
public class DXFLegendBuilder implements LegendBuilder {
35

  
36
	public void begin() {
37
		// TODO Auto-generated method stub
38

  
39
	}
40

  
41
	public void end() {
42
		// TODO Auto-generated method stub
43

  
44
	}
45

  
46
	public Object getLegend() {
47
		// TODO Auto-generated method stub
48
		return null;
49
	}
50

  
51
	public LegendBuilder initialize(FeatureStoreProvider store) {
52
		// TODO Auto-generated method stub
53
		return null;
54
	}
55

  
56
	public void process(FeatureData feature) {
57
		// TODO Auto-generated method stub
58

  
59
	}
60

  
61

  
62
}
0 63

  
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreParameters.java
11 11
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
12 12
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
13 13
import org.gvsig.tools.ToolsLocator;
14
import org.gvsig.tools.dynobject.DelegatedDynObject;
14 15
import org.gvsig.tools.dynobject.DynClass;
15 16
import org.gvsig.tools.dynobject.DynField;
16 17
import org.gvsig.tools.dynobject.DynObjectManager;
......
18 19
public class DXFStoreParameters extends AbstractDataParameters implements
19 20
		DataStoreParameters, FilesystemStoreParameters,
20 21
		NewFeatureStoreParameters {
21
    
22

  
22 23
    public static final String DYNCLASS_NAME = "DXFStoreParameters";
23 24

  
24 25
    private static final String FIELD_FILEPATH = "filepath";
25 26
    private static final String FIELD_SRSID = "srsid";
26 27

  
27 28
    public DXFStoreParameters() {
28
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
29
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
30
				.getDynObjectManager()
29 31
				.createDynObject(registerDynClass());
30 32
	}
31 33

  
......
85 87
	public void setDefaultFeatureType(FeatureType defaultFeatureType) {
86 88
		throw new UnsupportedOperationException();
87 89
	}
88
	  
90

  
89 91
    private DynClass registerDynClass() {
90 92
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
91 93
        DynClass dynClass = dynman.get(DYNCLASS_NAME);
......
94 96
            dynClass = dynman.add(DYNCLASS_NAME);
95 97

  
96 98
            field = dynClass.addDynField(FIELD_SRSID);
97
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
99
            field.setType(DataTypes.STRING);
98 100
            field.setDescription("The SRS identifier");
99
            field.setType(DynField.SINGLE);
101
            field.setTheTypeOfAvailableValues(DynField.SINGLE);
100 102

  
101 103
            field = dynClass.addDynField(FIELD_FILEPATH);
102
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
104
            field.setType(DataTypes.STRING);
103 105
            field.setDescription("The DXF file path");
104
            field.setType(DynField.SINGLE);
106
            field.setTheTypeOfAvailableValues(DynField.SINGLE);
105 107
        }
106 108
        return dynClass;
107 109
    }
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFLibrary.java
30 30
import org.gvsig.fmap.dal.DALFileLocator;
31 31
import org.gvsig.fmap.dal.DALLocator;
32 32
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.dynobject.DynClass;
35
import org.gvsig.tools.dynobject.DynField;
36
import org.gvsig.tools.dynobject.DynObjectManager;
33 37
import org.gvsig.tools.locator.BaseLibrary;
34 38
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
35 39

  
......
57 61
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
58 62
				DXFStoreProvider.NAME, DXFStoreProvider.DESCRIPTION,
59 63
				DXFFilesystemServerProvider.class);
64

  
65
		DynObjectManager dynMan = ToolsLocator.getDynObjectManager();
66
		DynClass dynClass = dynMan.get(
67
				DXFStoreProvider.DYNCLASS_NAME);
68
		DynField field;
69
		if (dynClass == null) {
70
			dynClass = dynMan.add(
71
					DXFStoreProvider.DYNCLASS_NAME);
72

  
73
		}
60 74
	}
61 75
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPFilesystemServerProvider.java
158 158
		SHPNewStoreParameters params = (SHPNewStoreParameters) super
159 159
				.getCreateParameters();
160 160

  
161
		EditableFeatureType fType = params.getDefaultFeatureType()
162
				.getEditable();
161
		EditableFeatureType fType = (EditableFeatureType) params
162
				.getDefaultFeatureType();
163 163
		SHPStoreProvider.addGeometryColumn(fType);
164 164
		params.setDefaultFeatureType(fType);
165 165
		return params;
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
56 56
import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider;
57 57
import org.gvsig.fmap.dal.store.shp.utils.SHPFile;
58 58
import org.gvsig.fmap.geom.primitive.Envelope;
59
import org.gvsig.tools.ToolsLocator;
60
import org.gvsig.tools.dynobject.DelegatedDynObject;
61
import org.gvsig.tools.dynobject.DynClass;
62
import org.gvsig.tools.dynobject.DynField;
63
import org.gvsig.tools.dynobject.DynObjectManager;
59 64
import org.gvsig.tools.persistence.PersistenceException;
60 65
import org.gvsig.tools.persistence.PersistentState;
61 66

  
......
66 71
	private ResourceProvider shpResource;
67 72
	private SHPStoreParameters shpParams;
68 73
	protected static final String GEOMETRY_ATTIBUTE_NAME = "GEOMETRY";
74
	protected static final String DYNFIELD_SRSORIGINALPARAMETERS_NAME = "SRSOriginalParameters";
75
	private static final String DYNCLASS_NAME = "SHPStore";
76
	protected static DynClass DYNCLASS = null;
77

  
69 78
	private SHPFeatureWriter writer = null;
70 79

  
71 80
	public SHPStoreProvider(SHPStoreParameters params)
......
77 86
				new Object[] { this.shpParams.getSHPFileName() });
78 87
		shpResource.addConsumer(this);
79 88

  
80
		//DBFResource tmpResource = new DBFResource(dbfParameters);
81
		//
82
		//try {
83
		//	this.dbf = (DBFResource) this.store.addResource(tmpResource);
84
		//} catch (DataException e1) {
85
		//	throw new InitializeException(this.getName(), e1);
86
		//}
89
		// FIXME
90
		this.dynObject = this.dynObject = (DelegatedDynObject) ToolsLocator
91
				.getDynObjectManager().createDynObject(DYNCLASS);
87 92

  
88 93
		this.shpFile = new SHPFile(this.shpParams);
89 94
	}
90 95

  
96
	protected static void registerDynClass() {
97
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
98
		DynClass dynClass;
99
		DynField field;
100
		if (DYNCLASS == null) {
101

  
102
			DynClass dbfDynClass = DBFStoreProvider.DYNCLASS;
103
			dynClass = dynman.add(DYNCLASS_NAME);
104

  
105

  
106
			field = dynClass.addDynField(DYNFIELD_SRSORIGINALPARAMETERS_NAME);
107

  
108
			field.setType(DataTypes.STRING);
109
			field.setDescription("SRS original parameters");
110

  
111
            // The SHP store parameters extend the DBF store parameters
112
			dynClass.extend(dbfDynClass);
113

  
114
			DYNCLASS = dynClass;
115
		}
116

  
117
	}
118

  
119

  
91 120
	protected static EditableFeatureAttributeDescriptor addGeometryColumn(
92 121
			EditableFeatureType fType) {
93 122

  
......
242 271
			this.shpFile.open();
243 272
			this.shpResource.notifyOpen();
244 273

  
274

  
275
			// load metadata
276
			this.dynObject.setDynValue(
277
					DYNFIELD_SRSORIGINALPARAMETERS_NAME,
278
					this.shpFile.getSRSParameters());
279

  
280
			this.dynObject.setDynValue("Envelope", shpFile.getFullExtent());
281

  
245 282
		} catch (UnsupportedVersionException e) {
246 283
			throw new OpenException(this.getName(), e);
247 284
		} catch (ResourceNotifyOpenException e) {
......
307 344
			FeatureSet set = this.store.getFeatureSet();
308 345
//			this.shpResource.begin();
309 346
			writer = new SHPFeatureWriter(this.getName());
347

  
310 348
			writer.begin(this.shpParams, fType, dbfFtype, set.getSize());
311 349

  
312 350
//			Iterator iter1 = set.iterator();
......
322 360
				Feature feature=(Feature) iter.next();
323 361
				writer.write(feature);
324 362
			}
363

  
325 364
			writer.end();
365

  
326 366
			shpResource.notifyChanges();
327 367
		} catch (Exception e) {
328 368
			throw new PerformEditingException(this.getName(), e);
......
394 434
			e.printStackTrace();
395 435
		}
396 436
	}
437

  
438
	/*
439
	 * (non-Javadoc)
440
	 * 
441
	 * @see org.gvsig.metadata.Metadata#getMetadataName()
442
	 */
443
	public String getMetadataName() {
444
		return this.shpParams.getSHPFile().getName();
445
	}
446

  
397 447
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPNewStoreParameters.java
29 29

  
30 30
import org.gvsig.fmap.dal.feature.FeatureType;
31 31
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
32
import org.gvsig.fmap.dal.store.dbf.DBFLibrary;
33
import org.gvsig.fmap.dal.store.dbf.DBFNewStoreParameters;
34
import org.gvsig.tools.ToolsLocator;
35
import org.gvsig.tools.dynobject.DelegatedDynObject;
36
import org.gvsig.tools.dynobject.DynClass;
37
import org.gvsig.tools.dynobject.DynField;
38
import org.gvsig.tools.dynobject.DynObjectManager;
32 39

  
33 40
public class SHPNewStoreParameters extends SHPStoreParameters implements
34 41
        NewFeatureStoreParameters {
35 42

  
43
    public static final String DYNCLASS_NAME = "SHPNewStoreParameters";
44

  
36 45
    private FeatureType defaultFeatureType;
37 46

  
47
    protected static DynClass DYNCLASS = null;
48

  
49
	protected static void registerDynClass() {
50
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
51
		DynClass dynClass;
52
		DynField field;
53
		if (DYNCLASS == null) {
54

  
55
			dynClass = dynman.add(DYNCLASS_NAME,
56
					"new SHP File Store parameters");
57
			dynClass.extend(SHPStoreParameters.DYNCLASS);
58
			dynClass.extend(dynman.get(DBFNewStoreParameters.DYNCLASS_NAME));
59
			DYNCLASS = dynClass;
60
		}
61

  
62
	}
63

  
64
    protected void initialize() {
65
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
66
				.getDynObjectManager().createDynObject(DYNCLASS);
67
	}
68

  
69
	public byte getCodePage() {
70
		return ((Byte) this.getDynValue(SHPLibrary.DYNFIELD_CODEPAGE_NAME))
71
				.byteValue();
72
	}
73

  
74
	public void setCodePage(byte value) {
75
		// TODO check value
76
		setDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME, new Byte(value));
77
	}
78

  
38 79
    public FeatureType getDefaultFeatureType() {
39 80
        return this.defaultFeatureType;
40 81
    }
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreParameters.java
33 33
import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
34 34
import org.gvsig.fmap.dal.store.shp.utils.SHP;
35 35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DelegatedDynObject;
36 37
import org.gvsig.tools.dynobject.DynClass;
37 38
import org.gvsig.tools.dynobject.DynField;
38 39
import org.gvsig.tools.dynobject.DynObjectManager;
......
42 43

  
43 44
public class SHPStoreParameters extends DBFStoreParameters {
44 45

  
45
    public static final String SHP_DYNCLASS_NAME = "SHPStoreParameters";
46
    public static final String DYNCLASS_NAME = "SHPStoreParameters";
46 47

  
47 48
	private static final String FIELD_SHXFILENAME = "shxfilename";
48 49
    private static final String FIELD_SHPFILENAME = "shpfilename";
49 50

  
51
    protected static DynClass DYNCLASS = null;
52

  
50 53
    protected void initialize() {
51
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
52
				.createDynObject(registerDynClass());
54
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
55
				.getDynObjectManager()
56
				.createDynObject(DYNCLASS);
53 57
	}
54 58

  
55 59
	public String getDataStoreName() {
......
128 132
		throw new NotYetImplemented();
129 133
	}
130 134

  
131
    protected DynClass registerDynClass() {
132
    	DynClass dbfDynClass =super.registerDynClass();
135
    protected static void registerDynClass() {
133 136
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
134
        DynClass dynClass = dynman.get(SHP_DYNCLASS_NAME);
137
        DynClass dynClass;
135 138
        DynField field;
136
        if (dynClass == null) {
137
            dynClass = dynman.add(SHP_DYNCLASS_NAME);
139
        if (DYNCLASS == null) {
140
        	DynClass dbfDynClass = DBFStoreParameters.DYNCLASS;
141
			dynClass = dynman.add(DYNCLASS_NAME);
138 142

  
139 143
            field = dynClass.addDynField(FIELD_SHPFILENAME);
140
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
141
            field.setDescription("The SHP file name");
142
            field.setType(DynField.SINGLE);
144
            field.setDescription("SHP file name");
145
            field.setType(DataTypes.STRING);
146
            field.setMandatory(true);
143 147

  
144 148
            field = dynClass.addDynField(FIELD_SHXFILENAME);
145
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
146
            field.setDescription("The DXF file name");
147
            field.setType(DynField.SINGLE);
149
            field.setDescription("SHX file name");
150
            field.setType(DataTypes.STRING);
151
            field.setMandatory(true);
148 152

  
149 153
            // The SHP store parameters extend the DBF store parameters
150 154
            dynClass.extend(dbfDynClass);
155

  
156
            DYNCLASS = dynClass;
151 157
        }
152
        return dynClass;
153 158
    }
154 159
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPLibrary.java
40 40

  
41 41
	public void postInitialize() throws ReferenceNotRegisteredException {
42 42
		super.postInitialize();
43
		
43

  
44
		SHPStoreParameters.registerDynClass();
45
		SHPNewStoreParameters.registerDynClass();
46
		SHPStoreProvider.registerDynClass();
47

  
44 48
		DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager();
45 49

  
46 50
        // DynClass dbfDynClass = dynObjectManager.get("DBFStoreParameters");
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreParameters.java
7 7
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
8 8
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
9 9
import org.gvsig.tools.ToolsLocator;
10
import org.gvsig.tools.dynobject.DelegatedDynObject;
10 11
import org.gvsig.tools.dynobject.DynClass;
11 12
import org.gvsig.tools.dynobject.DynField;
12 13
import org.gvsig.tools.dynobject.DynObjectManager;
......
14 15
public class DBFStoreParameters extends AbstractDataParameters implements
15 16
		DataStoreParameters, FilesystemStoreParameters {
16 17

  
17
    public static final String DBF_DYNCLASS_NAME = "DBFStoreParameters";
18
    public static final String DYNCLASS_NAME = "DBFStoreParameters";
18 19

  
19
    private static final String FIELD_DBFFILENAME = "dbffilename";
20
    protected static final String FIELD_DBFFILENAME = "dbffilename";
20 21

  
22
	protected static DynClass DYNCLASS = null;
23

  
24
    protected static void registerDynClass() {
25
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
26
		DynClass dynClass;
27
		DynField field;
28
		if (DYNCLASS == null) {
29
			dynClass = dynman.add(DYNCLASS_NAME);
30

  
31
			field = dynClass.addDynField(FIELD_DBFFILENAME);
32
			field.setTheTypeOfAvailableValues(DynField.SINGLE);
33
			field.setDescription("DBF file name");
34
			field.setType(DataTypes.STRING);
35
			field.setMandatory(true);
36
			DYNCLASS = dynClass;
37
		}
38

  
39
	}
40

  
21 41
	public DBFStoreParameters() {
22 42
		super();
23 43
		initialize();
24 44
	}
25 45

  
26 46
	protected void initialize() {
27
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
28
				.createDynObject(registerDynClass());
47
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
48
				.getDynObjectManager()
49
				.createDynObject(
50
						DBFStoreParameters.DYNCLASS);
29 51
	}
30 52

  
31 53
	public String getDataStoreName() {
......
67 89
	public String getDescription() {
68 90
		return DBFStoreProvider.DESCRIPTION;
69 91
	}
70

  
71
    protected DynClass registerDynClass() {
72
        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
73
        DynClass dynClass = dynman.get(DBF_DYNCLASS_NAME);
74
        DynField field;
75
        if (dynClass == null) {
76
            dynClass = dynman.add(DBF_DYNCLASS_NAME);
77

  
78
            field = dynClass.addDynField(FIELD_DBFFILENAME);
79
            field.setTheTypeOfAvailableValues(DataTypes.STRING);
80
            field.setDescription("The name of the DBF file");
81
            field.setType(DynField.SINGLE);
82
        }
83
        return dynClass;
84
    }
85 92
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFLibrary.java
29 29

  
30 30
import org.gvsig.fmap.dal.DALFileLocator;
31 31
import org.gvsig.fmap.dal.DALLocator;
32
import org.gvsig.fmap.dal.DataTypes;
32 33
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
34
import org.gvsig.tools.dynobject.DynClass;
35
import org.gvsig.tools.dynobject.DynField;
36
import org.gvsig.tools.dynobject.DynObjectValueItem;
33 37
import org.gvsig.tools.locator.BaseLibrary;
34 38
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
35 39

  
36 40

  
37 41
public class DBFLibrary extends BaseLibrary {
38 42

  
43
	public static final String DYNFIELD_CODEPAGE_NAME = "codePage";
44

  
45
	static DynField addCodePageField(DynClass dynClass) {
46

  
47
		DynField dynField = dynClass.addDynField(DYNFIELD_CODEPAGE_NAME);
48
		dynField.setDescription("Code Page");
49
		dynField.setDefaultValue(new Byte((byte) 0x2));
50
		dynField.setType(DataTypes.BYTE);
51
		dynField.setTheTypeOfAvailableValues(DynField.CHOICE);
52
		dynField.setAvailableValues(new DynObjectValueItem[] {
53
			new DynObjectValueItem(new Byte((byte) 0x1),"DOS USA"),
54
			new DynObjectValueItem(new Byte((byte) 0x2),"DOS Multilingual"),
55
			new DynObjectValueItem(new Byte((byte) 0x3),"Windows ANSI"),
56
			new DynObjectValueItem(new Byte((byte) 0x4),"Standard Macintosh"),
57
			new DynObjectValueItem(new Byte((byte) 0x64),"EE MS-DOS"),
58
			new DynObjectValueItem(new Byte((byte) 0x65),"Nordic MS-DOS"),
59
			new DynObjectValueItem(new Byte((byte) 0x66),"Russian MS-DOS"),
60
			new DynObjectValueItem(new Byte((byte) 0x67),"Icelandic MS-DOS"),
61
			new DynObjectValueItem(new Byte((byte) 0x68),"Kamenicky (Czech) MS-DOS"),
62
			new DynObjectValueItem(new Byte((byte) 0x69),"Mazovia (Polish) MS-DOS"),
63
			new DynObjectValueItem(new Byte((byte) 0x6A),"Greek MS-DOS (437G)"),
64
			new DynObjectValueItem(new Byte((byte) 0x6B),"Turkish MS-DOS"),
65
			new DynObjectValueItem(new Byte((byte) 0x96),"Russian Macintosh"),
66
			new DynObjectValueItem(new Byte((byte) 0x97),"Eastern European Macintosh"),
67
			new DynObjectValueItem(new Byte((byte) 0x98),"Greek Macintosh"),
68
			new DynObjectValueItem(new Byte((byte) 0xC8),"Windows EE"),
69
			new DynObjectValueItem(new Byte((byte) 0xC9),"Russian Windows"),
70
			new DynObjectValueItem(new Byte((byte) 0xCA),"Turkish Windows"),
71
			new DynObjectValueItem(new Byte((byte) 0xCB),"Greek Windows"),
72

  
73
		});
74
		return dynField;
75

  
76
	}
77

  
39 78
	public void postInitialize() throws ReferenceNotRegisteredException {
40 79
		super.postInitialize();
41 80

  
42
        // DynObjectManager dynObjectManager =
43
        // ToolsLocator.getDynObjectManager();
44
        //
45
        // DynClass dynClass = dynObjectManager.add("DBFStoreParameters",
46
        // "DBF File Store parameters");
47
        // dynClass.addDynField("dbffilename");
48 81

  
82
		DBFStoreParameters.registerDynClass();
83
		DBFNewStoreParameters.registerDynClass();
84
		DBFStoreProvider.registerDynClass();
85

  
49 86
        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
50 87
				.getDataManager();
51 88

  
......
54 91
					DBFStoreProvider.class, DBFStoreParameters.class);
55 92
		}
56 93

  
94

  
95

  
57 96
		DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
58 97
				DBFStoreProvider.NAME, DBFStoreProvider.DESCRIPTION,
59 98
				DBFFilesystemServerProvider.class);
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/utils/DbaseFile.java
177 177
		this.file= afile;
178 178
	}
179 179

  
180
	public byte getCodePage() {
181
		return myHeader.getLanguageID();
182
	}
183

  
180 184
	// Retrieve number of records in the DbaseFile
181 185
	public int getRecordCount() {
182 186
		return myHeader.getNumRecords();
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureData.java
18 18
	}
19 19

  
20 20
	protected void load() {
21
		if (loading) {
21
		if (loading || this.isNew()) {
22 22
			return;
23 23
		}
24 24
		loading = true;
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFilesystemServerProvider.java
12 12
import org.gvsig.fmap.dal.exception.FileNotFoundException;
13 13
import org.gvsig.fmap.dal.exception.InitializeException;
14 14
import org.gvsig.fmap.dal.exception.RemoveException;
15
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
15 16
import org.gvsig.fmap.dal.resource.file.FileResource;
16 17
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
17 18
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
......
123 124

  
124 125

  
125 126
	public NewDataStoreParameters getCreateParameters() {
126
		DBFNewStoreParameters params = (DBFNewStoreParameters) this
127
		NewFeatureStoreParameters params = (NewFeatureStoreParameters) this
127 128
				.createInstanceNewDataStoreParameters();
128 129
		params.setDefaultFeatureType(this.serverExplorer
129 130
				.getServerExplorerProviderServices().createNewFeatureType());
......
150 151

  
151 152
	public boolean closeResourceRequested(ResourceProvider resource) {
152 153
		// while it is using a resource anyone can't close it
153
		return false;
154
		return !(this.equals(resource));
154 155
	}
155 156

  
157
	/*
158
	 * (non-Javadoc)
159
	 * 
160
	 * @see
161
	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
162
	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
163
	 */
164
	public void resourceChanged(ResourceProvider resource) {
165
		// Do nothing
166
	}
167

  
156 168
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
5 5
import java.text.DateFormat;
6 6
import java.text.ParseException;
7 7
import java.util.ArrayList;
8
import java.util.Arrays;
8 9
import java.util.Date;
9 10
import java.util.Iterator;
10 11
import java.util.List;
11 12
import java.util.Locale;
13
import java.util.Set;
12 14

  
13 15
import org.gvsig.fmap.dal.DALLocator;
14 16
import org.gvsig.fmap.dal.DataManager;
15 17
import org.gvsig.fmap.dal.DataServerExplorer;
18
import org.gvsig.fmap.dal.DataStoreNotification;
16 19
import org.gvsig.fmap.dal.DataTypes;
17 20
import org.gvsig.fmap.dal.exception.CloseException;
18 21
import org.gvsig.fmap.dal.exception.DataException;
......
27 30
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
28 31
import org.gvsig.fmap.dal.feature.FeatureQuery;
29 32
import org.gvsig.fmap.dal.feature.FeatureSet;
33
import org.gvsig.fmap.dal.feature.FeatureStore;
30 34
import org.gvsig.fmap.dal.feature.FeatureType;
31 35
import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
32 36
import org.gvsig.fmap.dal.feature.exception.UnknowDataTypeException;
......
48 52
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
49 53
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
50 54
import org.gvsig.fmap.dal.store.dbf.utils.DbaseFile;
51
import org.gvsig.metadata.Metadata;
52
import org.gvsig.tools.exception.NotYetImplemented;
55
import org.gvsig.tools.ToolsLocator;
56
import org.gvsig.tools.dynobject.DelegatedDynObject;
57
import org.gvsig.tools.dynobject.DynClass;
58
import org.gvsig.tools.dynobject.DynField;
59
import org.gvsig.tools.dynobject.DynObject;
60
import org.gvsig.tools.dynobject.DynObjectManager;
61
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
53 62
import org.gvsig.tools.persistence.PersistenceException;
54 63
import org.gvsig.tools.persistence.PersistentState;
55 64

  
......
61 70
	//	private DBFResource dbf = null;
62 71
	private DbaseFile dbfFile = null;
63 72
	private ResourceProvider dbfResource;
64
	protected Metadata metadata;
65 73
	private static final Locale ukLocale = new Locale("en", "UK");
74
	private static final String DYNCLASS_NAME = "DBFStore";
75
	protected static DynClass DYNCLASS = null;
66 76
	private DBFStoreParameters dbfParams;
67 77
	private long counterNewsOIDs = -1;
68 78
	private DBFFeatureWriter writer;
......
80 90

  
81 91
	protected void init(DBFStoreParameters params) throws InitializeException {
82 92
		this.dbfParams = params;
93
		this.dynObject = (DelegatedDynObject) ToolsLocator
94
				.getDynObjectManager().createDynObject(
95
				DYNCLASS);
83 96

  
84 97
		File theFile = getDBFParameters().getDBFFile();
85 98
		dbfResource = this.createResource(FileResource.NAME,
86 99
				new Object[] { theFile.getAbsolutePath() });
87 100
		dbfResource.addConsumer(this);
88 101

  
89
		//DBFResource tmpResource = new DBFResource(dbfParameters);
90
		//
91
		//try {
92
		//	this.dbf = (DBFResource) this.store.addResource(tmpResource);
93
		//} catch (DataException e1) {
94
		//	throw new InitializeException(this.getName(), e1);
95
		//}
102
		this.dbfFile = new DbaseFile(theFile);
96 103

  
97

  
98
		this.dbfFile = new DbaseFile(theFile);
99 104
	}
100 105

  
101 106
	public FeatureStoreProvider initialize(FeatureStoreProviderServices store)
......
429 434
			this.dbfFile.open();
430 435
			this.dbfResource.notifyOpen();
431 436

  
437
			// Load metadata values
438
			this.dynObject.setDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME,
439
					new Byte(this.dbfFile.getCodePage()));
440

  
432 441
		} catch (UnsupportedVersionException e) {
433 442
			throw new OpenException(this.getName(), e);
434 443
		} catch (ResourceNotifyOpenException e) {
......
469 478
		dbfFile = null;
470 479
		this.dbfResource.removeConsumer(this);
471 480
		dbfResource = null;
472
		metadata = null;
473 481
		super.dispose();
474 482
	}
475 483

  
......
632 640
		}
633 641
	}
634 642

  
643
	public Object getMetadataID() {
644
		try {
645
			return ((FileResource) this.dbfResource).getFile()
646
					.getAbsolutePath();
647
		} catch (AccessResourceException e) {
648
			// FIXME Exception
649
			throw new RuntimeException(e);
650
		}
651
	}
635 652

  
653
	public Iterator getChilds() {
654
		return Arrays.asList(new DynObject[] { this.dbfParams }).iterator();
655

  
656
	}
657

  
658
	protected static void registerDynClass() {
659
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
660
		DynClass dynClass;
661
		DynField field;
662
		if (DYNCLASS == null) {
663
			dynClass = dynman.add(DYNCLASS_NAME,
664
					"DBF File Store");
665
			field = DBFLibrary.addCodePageField(dynClass);
666

  
667
			dynClass.extend(dynman.get(FeatureStore.DYNCLASS_NAME));
668

  
669
			DYNCLASS = dynClass;
670
		}
671

  
672
	}
673

  
674
	public Object getDynValue(String name) throws DynFieldNotFoundException {
675
		try {
676
			this.open();
677
		} catch (OpenException e) {
678
			// FIXME
679
			throw new RuntimeException(e);
680
		}
681
		return super.getDynValue(name);
682
	}
683

  
684
	/*
685
	 * (non-Javadoc)
686
	 * 
687
	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
688
	 */
689
	public Set getMetadataChildren() {
690
		return null;
691
	}
692

  
693
	/*
694
	 * (non-Javadoc)
695
	 * 
696
	 * @see org.gvsig.metadata.Metadata#getMetadataName()
697
	 */
698
	public String getMetadataName() {
699
		return this.getDBFParameters().getDBFFile().getName();
700
	}
701

  
702
	/*
703
	 * (non-Javadoc)
704
	 * 
705
	 * @see
706
	 * org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org.
707
	 * gvsig.fmap.dal.resource.spi.ResourceProvider)
708
	 */
709
	public void resourceChanged(ResourceProvider resource) {
710
		this.store.notifyChange(DataStoreNotification.RESOURCE_CHANGED,
711
				resource);
712
	}
636 713
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFNewStoreParameters.java
29 29

  
30 30
import org.gvsig.fmap.dal.feature.FeatureType;
31 31
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.dynobject.DelegatedDynObject;
34
import org.gvsig.tools.dynobject.DynClass;
35
import org.gvsig.tools.dynobject.DynField;
36
import org.gvsig.tools.dynobject.DynObjectManager;
32 37

  
33 38
public class DBFNewStoreParameters extends DBFStoreParameters implements
34 39
		NewFeatureStoreParameters {
35 40

  
41
    public static final String DYNCLASS_NAME = "DBFNewStoreParameters";
42

  
43
	private static final String FIELD_DBFFILENAME = "dbffilename";
44

  
45
	protected static DynClass DYNCLASS = null;
46

  
36 47
	private FeatureType defaultFeatureType;
37 48

  
49
	protected static void registerDynClass() {
50
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
51
		DynClass dynClass;
52
		DynField field;
53
		if (DYNCLASS == null) {
54

  
55
			dynClass = dynman.add(DYNCLASS_NAME,
56
					"new DBF File Store parameters");
57
			field = DBFLibrary.addCodePageField(dynClass);
58
			dynClass.extend(DBFStoreParameters.DYNCLASS);
59
			DYNCLASS = dynClass;
60
		}
61

  
62
	}
63

  
64
	public byte getCodePage(){
65
		return ((Byte) this.getDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME))
66
				.byteValue();
67
	}
68

  
69
	public void setCodePage(byte value){
70
		// TODO check value
71
		setDynValue(DBFLibrary.DYNFIELD_CODEPAGE_NAME, new Byte(value));
72
	}
73

  
38 74
	public FeatureType getDefaultFeatureType() {
39 75
		return this.defaultFeatureType;
40 76
	}
......
43 79
		this.defaultFeatureType = defaultFeatureType;
44 80
	}
45 81

  
46
    // protected void initialize() {
47
    //
48
    // this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
49
    // .createDynObject(
50
    // ToolsLocator.getDynObjectManager().get(
51
    // "DBFStoreParameters"));
52
    //
53
    // /*
54
    // this.addParameter(
55
    // "codepage",
56
    // DataTypes.INT,
57
    // "Charaset code page",
58
    // new Integer(2),
59
    // new Integer[]{
60
    // new Integer(1), // DOS USA code page 437
61
    // new Integer(2), // DOS Multilingual code page 850
62
    // //TODO Apadir el resto
63
    // }
64
    // );
65
    // */
66
    //
67
    // }
82
	protected void initialize() {
83
		this.delegatedDynObjet = (DelegatedDynObject) ToolsLocator
84
				.getDynObjectManager().createDynObject(
85
						DBFNewStoreParameters.DYNCLASS);
86
	}
68 87

  
69

  
70

  
71 88
}
branches/v2_0_0_prep/libraries/libFMap_dalfile/build.xml
28 28
	<!-- dgn -->
29 29

  
30 30
	<property name="dgn-jarName" value="org.gvsig.fmap.dal.store.dgn.jar"/>
31
	<property name="dgn-legend-jarName" value="org.gvsig.fmap.dal.store.dgn.legend.jar"/>
32

  
31 33
	<property name="dgn-jarIncludes" value="org/gvsig/fmap/dal/store/dgn/**/**"/>
32
	<property name="dgn-jarExcludes" value="org/gvsig/fmap/dal/store/dgn/operation/**/**"/>
34
	<property name="dgn-legend-jarIncludes" value="org/gvsig/fmap/dal/store/dgn/legend/**/**"/>
33 35

  
34
	<property name="dgn-operation-jarName" value="org.gvsig.fmap.dal.operation.dgn.jar"/>
35
	<property name="dgn-operation-jarIncludes" value="${dgn-jarExcludes}"/>
36
	<property name="dgn-operation-jarExcludes" value=""/>
36
	<property name="dgn-jarExcludes" value="${dgn-legend-jarIncludes}"/>
37
	<property name="dgn-legend-jarExcludes" value=""/>
37 38

  
38 39

  
39 40
	<!-- dxf -->
40 41
	<property name="dxf-jarName" value="org.gvsig.fmap.dal.store.dxf.jar"/>
42
	<property name="dxf-legend-jarName" value="org.gvsig.fmap.dal.store.dxf.legend.jar"/>
43

  
41 44
	<property name="dxf-jarIncludes" value="org/gvsig/fmap/dal/store/dxf/**/**"/>
42
	<property name="dxf-jarExcludes" value="org/gvsig/fmap/dal/store/dxf/operation/**/**"/>
45
	<property name="dxf-legend-jarIncludes" value="org/gvsig/fmap/dal/store/dxf/legend/**/**"/>
43 46

  
44
	<property name="dxf-operation-jarName" value="org.gvsig.fmap.dal.operation.dxf.jar"/>
45
	<property name="dxf-operation-jarIncludes" value="${dxf-jarExcludes}"/>
46
	<property name="dxf-operation-jarExcludes" value=""/>
47
	<property name="dxf-jarExcludes" value="${dxf-legend-jarIncludes}"/>
48
	<property name="dxf-legend-jarExcludes" value=""/>
47 49

  
48 50
	<!-- shp -->
49 51
	<property name="shp-jarName" value="org.gvsig.fmap.dal.store.shp.jar"/>
......
86 88
          target: batch-build
87 89
         ================================= -->
88 90
	<target name="batch-build"
89
		depends="compile,generate-common,generate-dbf,generate-dgn,generate-dgn-operation,generate-dxf,generate-dxf-operation,generate-shp"
91
		depends="compile,generate-common,generate-dbf,generate-dgn,generate-dgn-legend,generate-dxf,generate-dxf-legend,generate-shp"
90 92
		description="--> Prepare library">
91 93
	</target>
92 94

  
......
123 125
			excludes="${dgn-jarExcludes}"/>
124 126
	</target>
125 127

  
126
	<target name="generate-dgn-operation" depends="compile,generate-common,generate-dgn">
128
	<target name="generate-dgn-legend" depends="compile,generate-common,generate-dgn">
127 129
		<mkdir dir="${dist}"/>
128
		<jar destfile="${dist}/${dgn-operation-jarName}"
130
		<jar destfile="${dist}/${dgn-legend-jarName}"
129 131
			basedir="${build}"
130
			includes="${dgn-operation-jarIncludes}"
131
			excludes="${dgn-operation-jarExcludes}"/>
132
			includes="${dgn-legend-jarIncludes}"
133
			excludes="${dgn-legend-jarExcludes}"/>
132 134
	</target>
133 135

  
134 136

  
......
140 142
			excludes="${dxf-jarExcludes}"/>
141 143
	</target>
142 144

  
143
	<target name="generate-dxf-operation" depends="compile,generate-common,generate-dxf">
145
	<target name="generate-dxf-legend" depends="compile,generate-common,generate-dxf">
144 146
		<mkdir dir="${dist}"/>
145
		<jar destfile="${dist}/${dxf-operation-jarName}"
147
		<jar destfile="${dist}/${dxf-legend-jarName}"
146 148
			basedir="${build}"
147
			includes="${dxf-operation-jarIncludes}"
148
			excludes="${dxf-operation-jarExcludes}"/>
149
			includes="${dxf-legend-jarIncludes}"
150
			excludes="${dxf-legend-jarExcludes}"/>
149 151
	</target>
150 152

  
151 153

  
branches/v2_0_0_prep/libraries/libFMap_dalfile/.classpath
2 2
<classpath>
3 3
	<classpathentry kind="src" path="src"/>
4 4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry combineaccessrules="false" kind="src" path="/libTools"/>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff