Revision 19907
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataSourceParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataSourceFileParameters; |
|
4 |
|
|
5 |
public class DXFDataSourceParameters extends DataSourceFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DXFDataSource.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataSource.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.DataSourceManager; |
|
7 |
import org.gvsig.data.IDataSourceParameters; |
|
8 |
import org.gvsig.data.IDataStore; |
|
9 |
import org.gvsig.data.IDataStoreParameters; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
11 |
import org.gvsig.data.exception.InitializeException; |
|
12 |
import org.gvsig.data.exception.InitializeWriterException; |
|
13 |
import org.gvsig.data.exception.ReadException; |
|
14 |
import org.gvsig.data.explorer.file.AbstractDataSourceFile; |
|
15 |
import org.gvsig.data.vectorial.IFeatureType; |
|
16 |
|
|
17 |
public class DXFDataSource extends AbstractDataSourceFile { |
|
18 |
public static String DATASOURCE_NAME="DXFDataSource"; |
|
19 |
protected DXFDataSourceParameters parameters; |
|
20 |
protected File path; |
|
21 |
|
|
22 |
|
|
23 |
public IDataStoreParameters[] getSources() throws ReadException { |
|
24 |
if (!this.path.exists()){ |
|
25 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
26 |
} |
|
27 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
28 |
|
|
29 |
String files[] = this.path.list(); |
|
30 |
int i; |
|
31 |
File theFile; |
|
32 |
ArrayList fileList = new ArrayList(); |
|
33 |
IDataStoreParameters dsp = null; |
|
34 |
|
|
35 |
for (i=0;i<files.length;i++){ |
|
36 |
theFile = new File(this.path,files[i]); |
|
37 |
|
|
38 |
if (this.isValid(theFile)){ |
|
39 |
dsp= this.newParameter(theFile); |
|
40 |
fileList.add(dsp); |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
|
|
45 |
} |
|
46 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
47 |
x[0]=dsp; |
|
48 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
49 |
} |
|
50 |
|
|
51 |
protected IDataStoreParameters newParameter(File file){ |
|
52 |
DXFStoreParameters param = new DXFStoreParameters(); |
|
53 |
param.setDXFFile(file); |
|
54 |
return param; |
|
55 |
} |
|
56 |
|
|
57 |
protected boolean isValid(String file){ |
|
58 |
return this.isValid(new File(file)); |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
protected boolean isValid(File file){ |
|
63 |
if (!file.exists()){ |
|
64 |
return false; |
|
65 |
} |
|
66 |
return (file.getName().toLowerCase().endsWith(".dxf")); |
|
67 |
} |
|
68 |
|
|
69 |
public String getName() { |
|
70 |
return DATASOURCE_NAME; |
|
71 |
} |
|
72 |
|
|
73 |
public void init(IDataSourceParameters parameters) { |
|
74 |
this.parameters = (DXFDataSourceParameters)parameters; |
|
75 |
this.path = this.parameters.getSource(); |
|
76 |
} |
|
77 |
|
|
78 |
public IDataStore createNewDataStore(IDataStoreParameters dsp, IFeatureType featureType) throws InitializeException, InitializeWriterException { |
|
79 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
80 |
return dsm.createDataStore(dsp); |
|
81 |
} |
|
82 |
|
|
83 |
public boolean canCreate() { |
|
84 |
return true; |
|
85 |
} |
|
86 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataExplorer.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.DataManager; |
|
7 |
import org.gvsig.data.IDataExplorerParameters; |
|
8 |
import org.gvsig.data.IDataStore; |
|
9 |
import org.gvsig.data.IDataStoreParameters; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.RemoveFileException; |
|
11 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFNewStoreParameters; |
|
12 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFStoreParameters; |
|
13 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
14 |
import org.gvsig.data.exception.InitializeException; |
|
15 |
import org.gvsig.data.exception.InitializeWriterException; |
|
16 |
import org.gvsig.data.exception.OpenException; |
|
17 |
import org.gvsig.data.exception.ReadException; |
|
18 |
import org.gvsig.data.explorer.file.AbstractDataExplorerFile; |
|
19 |
import org.gvsig.data.vectorial.IFeatureType; |
|
20 |
import org.gvsig.data.vectorial.INewDataStoreParameters; |
|
21 |
|
|
22 |
public class DXFDataExplorer extends AbstractDataExplorerFile { |
|
23 |
public static String DATASOURCE_NAME="DXFDataSource"; |
|
24 |
protected DXFDataExplorerParameters parameters; |
|
25 |
protected File path; |
|
26 |
|
|
27 |
|
|
28 |
public IDataStoreParameters[] list() throws ReadException { |
|
29 |
if (!this.path.exists()){ |
|
30 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
31 |
} |
|
32 |
// DataManager dsm=DataManager.getManager(); |
|
33 |
|
|
34 |
String files[] = this.path.list(); |
|
35 |
int i; |
|
36 |
File theFile; |
|
37 |
ArrayList fileList = new ArrayList(); |
|
38 |
IDataStoreParameters dsp = null; |
|
39 |
|
|
40 |
for (i=0;i<files.length;i++){ |
|
41 |
theFile = new File(this.path,files[i]); |
|
42 |
|
|
43 |
if (this.isValid(theFile)){ |
|
44 |
dsp= this.newParameter(theFile); |
|
45 |
fileList.add(dsp); |
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
} |
|
51 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
52 |
x[0]=dsp; |
|
53 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
54 |
} |
|
55 |
|
|
56 |
protected IDataStoreParameters newParameter(File file){ |
|
57 |
DXFStoreParameters param = new DXFStoreParameters(); |
|
58 |
param.setDXFFile(file); |
|
59 |
return param; |
|
60 |
} |
|
61 |
|
|
62 |
protected boolean isValid(String file){ |
|
63 |
return this.isValid(new File(file)); |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
protected boolean isValid(File file){ |
|
68 |
if (!file.exists()){ |
|
69 |
return false; |
|
70 |
} |
|
71 |
return (file.getName().toLowerCase().endsWith(".dxf")); |
|
72 |
} |
|
73 |
|
|
74 |
public String getName() { |
|
75 |
return DATASOURCE_NAME; |
|
76 |
} |
|
77 |
|
|
78 |
public void init(IDataExplorerParameters parameters) { |
|
79 |
this.parameters = (DXFDataExplorerParameters)parameters; |
|
80 |
this.path = this.parameters.getSource(); |
|
81 |
} |
|
82 |
|
|
83 |
public IDataStore createDataStore(IDataStoreParameters dsp) throws InitializeException, InitializeWriterException { |
|
84 |
DataManager dsm=DataManager.getManager(); |
|
85 |
return dsm.createDataStore(dsp); |
|
86 |
} |
|
87 |
|
|
88 |
public boolean canCreate() { |
|
89 |
return true; |
|
90 |
} |
|
91 |
|
|
92 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws OpenException, InitializeWriterException { |
|
93 |
IDataStoreParameters dsp=ndsp.getDataStoreParameters(); |
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
return dsp; |
|
98 |
} |
|
99 |
|
|
100 |
public INewDataStoreParameters createNewDataStoreParameter(IDataStoreParameters dsp) { |
|
101 |
DXFNewStoreParameters dbfnsp=new DXFNewStoreParameters(); |
|
102 |
dbfnsp.setDataStoreParameters(dsp); |
|
103 |
return dbfnsp; |
|
104 |
} |
|
105 |
|
|
106 |
public void remove(IDataStoreParameters dsp) throws RemoveFileException { |
|
107 |
DXFStoreParameters dxfsp=(DXFStoreParameters)dsp; |
|
108 |
File f=dxfsp.getDXFFile(); |
|
109 |
if (f.exists()) { |
|
110 |
if (!f.delete()){ |
|
111 |
throw new RemoveFileException(this.getName(),new Exception()); |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
} |
|
116 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFNewStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.AbstractNewDataStoreParameter; |
|
4 |
|
|
5 |
public class DXFNewStoreParameters extends AbstractNewDataStoreParameter{ |
|
6 |
|
|
7 |
public DXFNewStoreParameters() { |
|
8 |
// TODO Auto-generated constructor stub |
|
9 |
} |
|
10 |
|
|
11 |
public String getDataStoreName() { |
|
12 |
return DXFStore.DATASTORE_NAME; |
|
13 |
} |
|
14 |
|
|
15 |
public boolean isValid() { |
|
16 |
// TODO Auto-generated method stub |
|
17 |
return false; |
|
18 |
} |
|
19 |
|
|
20 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFStore.java | ||
---|---|---|
23 | 23 |
import org.cresques.px.gml.Polygon; |
24 | 24 |
import org.cresques.px.gml.Polygon3D; |
25 | 25 |
import org.gvsig.data.IDataCollection; |
26 |
import org.gvsig.data.IDataExplorer; |
|
26 | 27 |
import org.gvsig.data.IDataStoreParameters; |
27 | 28 |
import org.gvsig.data.datastores.vectorial.IFeaturesReader; |
28 | 29 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
... | ... | |
117 | 118 |
descriptorShape.setName("GEOMETRY"); |
118 | 119 |
descriptorShape.setDefaultValue(null); |
119 | 120 |
featureType.add(descriptorShape); |
121 |
featureType.setDefaultGeometry("GEOMETRY"); |
|
120 | 122 |
|
121 | 123 |
DefaultAttributeDescriptor descriptorEntity = new DefaultAttributeDescriptor(); |
122 | 124 |
descriptorEntity.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
... | ... | |
905 | 907 |
public IDataStoreParameters getParameters() { |
906 | 908 |
return parameters; |
907 | 909 |
} |
910 |
|
|
911 |
public IDataExplorer getExplorer() { |
|
912 |
// TODO Auto-generated method stub |
|
913 |
return null; |
|
914 |
} |
|
908 | 915 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFDataExplorerParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataExplorerFileParameters; |
|
4 |
|
|
5 |
public class DXFDataExplorerParameters extends DataExplorerFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DXFDataExplorer.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/Register.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dxf; |
2 | 2 |
|
3 |
import org.gvsig.data.DataSourceManager;
|
|
3 |
import org.gvsig.data.DataManager; |
|
4 | 4 |
|
5 | 5 |
public class Register { |
6 | 6 |
public static void selfRegister() { |
7 |
DataSourceManager dsm = DataSourceManager.getManager();
|
|
7 |
DataManager dsm = DataManager.getManager();
|
|
8 | 8 |
|
9 | 9 |
dsm.registerDataStore(DXFStore.DATASTORE_NAME, |
10 | 10 |
DXFStore.class, |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataSource.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.DataSourceManager; |
|
7 |
import org.gvsig.data.IDataSourceParameters; |
|
8 |
import org.gvsig.data.IDataStoreParameters; |
|
9 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
10 |
import org.gvsig.data.exception.ReadException; |
|
11 |
import org.gvsig.data.explorer.file.AbstractDataSourceFile; |
|
12 |
|
|
13 |
public class DGNDataSource extends AbstractDataSourceFile { |
|
14 |
|
|
15 |
public static String DATASOURCE_NAME="DGNDataSource"; |
|
16 |
|
|
17 |
protected DGNDataSourceParameters parameters; |
|
18 |
protected File path; |
|
19 |
|
|
20 |
|
|
21 |
public IDataStoreParameters[] getSources() throws ReadException { |
|
22 |
if (!this.path.exists()){ |
|
23 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
24 |
} |
|
25 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
26 |
|
|
27 |
String files[] = this.path.list(); |
|
28 |
int i; |
|
29 |
File theFile; |
|
30 |
ArrayList fileList = new ArrayList(); |
|
31 |
IDataStoreParameters dsp = null; |
|
32 |
|
|
33 |
for (i=0;i<files.length;i++){ |
|
34 |
theFile = new File(this.path,files[i]); |
|
35 |
|
|
36 |
if (this.isValid(theFile)){ |
|
37 |
dsp= this.newParameter(theFile); |
|
38 |
|
|
39 |
|
|
40 |
fileList.add(dsp); |
|
41 |
|
|
42 |
} |
|
43 |
|
|
44 |
|
|
45 |
} |
|
46 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
47 |
x[0]=dsp; |
|
48 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
49 |
} |
|
50 |
|
|
51 |
protected IDataStoreParameters newParameter(File file){ |
|
52 |
DGNStoreParameters param = new DGNStoreParameters(); |
|
53 |
param.setDGNFile(file); |
|
54 |
return param; |
|
55 |
} |
|
56 |
|
|
57 |
protected boolean isValid(String file){ |
|
58 |
return this.isValid(new File(file)); |
|
59 |
|
|
60 |
} |
|
61 |
|
|
62 |
protected boolean isValid(File file){ |
|
63 |
if (!file.exists()){ |
|
64 |
return false; |
|
65 |
} |
|
66 |
return (file.getName().toLowerCase().endsWith(".dgn")); |
|
67 |
} |
|
68 |
|
|
69 |
public String getName() { |
|
70 |
return this.DATASOURCE_NAME; |
|
71 |
} |
|
72 |
|
|
73 |
public void init(IDataSourceParameters parameters) { |
|
74 |
this.parameters = (DGNDataSourceParameters)parameters; |
|
75 |
this.path = this.parameters.getSource(); |
|
76 |
} |
|
77 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataSourceParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataSourceFileParameters; |
|
4 |
|
|
5 |
public class DGNDataSourceParameters extends DataSourceFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DGNDataSource.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataExplorer.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.IDataExplorerParameters; |
|
7 |
import org.gvsig.data.IDataStoreParameters; |
|
8 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
9 |
import org.gvsig.data.exception.InitializeWriterException; |
|
10 |
import org.gvsig.data.exception.OpenException; |
|
11 |
import org.gvsig.data.exception.ReadException; |
|
12 |
import org.gvsig.data.explorer.file.AbstractDataExplorerFile; |
|
13 |
import org.gvsig.data.vectorial.INewDataStoreParameters; |
|
14 |
|
|
15 |
public class DGNDataExplorer extends AbstractDataExplorerFile { |
|
16 |
|
|
17 |
public static String DATASOURCE_NAME="DGNDataExplorer"; |
|
18 |
|
|
19 |
protected DGNDataExplorerParameters parameters; |
|
20 |
protected File path; |
|
21 |
|
|
22 |
|
|
23 |
public IDataStoreParameters[] list() throws ReadException { |
|
24 |
if (!this.path.exists()){ |
|
25 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
26 |
} |
|
27 |
// DataManager dsm=DataManager.getManager(); |
|
28 |
|
|
29 |
String files[] = this.path.list(); |
|
30 |
int i; |
|
31 |
File theFile; |
|
32 |
ArrayList fileList = new ArrayList(); |
|
33 |
IDataStoreParameters dsp = null; |
|
34 |
|
|
35 |
for (i=0;i<files.length;i++){ |
|
36 |
theFile = new File(this.path,files[i]); |
|
37 |
|
|
38 |
if (this.isValid(theFile)){ |
|
39 |
dsp= this.newParameter(theFile); |
|
40 |
|
|
41 |
|
|
42 |
fileList.add(dsp); |
|
43 |
|
|
44 |
} |
|
45 |
|
|
46 |
|
|
47 |
} |
|
48 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
49 |
x[0]=dsp; |
|
50 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
51 |
} |
|
52 |
|
|
53 |
protected IDataStoreParameters newParameter(File file){ |
|
54 |
DGNStoreParameters param = new DGNStoreParameters(); |
|
55 |
param.setDGNFile(file); |
|
56 |
return param; |
|
57 |
} |
|
58 |
|
|
59 |
protected boolean isValid(String file){ |
|
60 |
return this.isValid(new File(file)); |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
protected boolean isValid(File file){ |
|
65 |
if (!file.exists()){ |
|
66 |
return false; |
|
67 |
} |
|
68 |
return (file.getName().toLowerCase().endsWith(".dgn")); |
|
69 |
} |
|
70 |
|
|
71 |
public String getName() { |
|
72 |
return this.DATASOURCE_NAME; |
|
73 |
} |
|
74 |
|
|
75 |
public void init(IDataExplorerParameters parameters) { |
|
76 |
this.parameters = (DGNDataExplorerParameters)parameters; |
|
77 |
this.path = this.parameters.getSource(); |
|
78 |
} |
|
79 |
|
|
80 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws OpenException, InitializeWriterException { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return null; |
|
83 |
} |
|
84 |
|
|
85 |
public INewDataStoreParameters createNewDataStoreParameter(IDataStoreParameters dsp) { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
public void remove(IDataStoreParameters dsp) { |
|
91 |
// TODO Auto-generated method stub |
|
92 |
|
|
93 |
} |
|
94 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/Register.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
2 | 2 |
|
3 |
import org.gvsig.data.DataSourceManager;
|
|
3 |
import org.gvsig.data.DataManager; |
|
4 | 4 |
|
5 | 5 |
public class Register { |
6 | 6 |
public static void selfRegister() { |
7 |
DataSourceManager dsm = DataSourceManager.getManager();
|
|
7 |
DataManager dsm = DataManager.getManager();
|
|
8 | 8 |
|
9 | 9 |
dsm.registerDataStore(DGNStore.DATASTORE_NAME, |
10 | 10 |
DGNStore.class, |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNStore.java | ||
---|---|---|
10 | 10 |
import java.util.List; |
11 | 11 |
|
12 | 12 |
import org.gvsig.data.IDataCollection; |
13 |
import org.gvsig.data.IDataExplorer; |
|
13 | 14 |
import org.gvsig.data.IDataStoreParameters; |
14 | 15 |
import org.gvsig.data.datastores.vectorial.IFeaturesReader; |
15 | 16 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
... | ... | |
144 | 145 |
descriptorShape.setName("GEOMETRY"); |
145 | 146 |
descriptorShape.setDefaultValue(null); |
146 | 147 |
featureType.add(descriptorShape); |
148 |
featureType.setDefaultGeometry("GEOMETRY"); |
|
147 | 149 |
|
148 | 150 |
} |
149 | 151 |
protected void doFinishEdition() throws WriteException, ReadException { |
... | ... | |
838 | 840 |
DGNFeature f=new DGNFeature(feature); |
839 | 841 |
super.addFeature(f); |
840 | 842 |
} |
843 |
|
|
844 |
public IDataExplorer getExplorer() { |
|
845 |
// TODO Auto-generated method stub |
|
846 |
return null; |
|
847 |
} |
|
841 | 848 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dgn/DGNDataExplorerParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dgn; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataExplorerFileParameters; |
|
4 |
|
|
5 |
public class DGNDataExplorerParameters extends DataExplorerFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DGNDataExplorer.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/ShpDataSource.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.DataSourceManager; |
|
6 |
import org.gvsig.data.IDataSourceParameters; |
|
7 |
import org.gvsig.data.IDataStore; |
|
8 |
import org.gvsig.data.IDataStoreParameters; |
|
9 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFDataSource; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.shp.utils.SHP; |
|
11 |
import org.gvsig.data.exception.InitializeException; |
|
12 |
import org.gvsig.data.exception.InitializeWriterException; |
|
13 |
import org.gvsig.data.vectorial.IFeatureType; |
|
14 |
|
|
15 |
public class ShpDataSource extends DBFDataSource { |
|
16 |
protected ShpDataSourceParameters parameters; |
|
17 |
public static String DATASOURCE_NAME="ShpDataSource"; |
|
18 |
|
|
19 |
protected boolean isValid(File file) { |
|
20 |
if (!file.exists()){ |
|
21 |
return false; |
|
22 |
} |
|
23 |
if (!(file.getName().toLowerCase().endsWith(".shp"))){ |
|
24 |
return false; |
|
25 |
} |
|
26 |
File shx = SHP.getShxFile(file); |
|
27 |
if (!shx.exists()){ |
|
28 |
return false; |
|
29 |
} |
|
30 |
File dbf = SHP.getDbfFile(file); |
|
31 |
return super.isValid(dbf); |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
public void init(IDataSourceParameters parameters) { |
|
36 |
this.parameters = (ShpDataSourceParameters)parameters; |
|
37 |
this.path = this.parameters.getSource(); |
|
38 |
} |
|
39 |
|
|
40 |
|
|
41 |
public String getName() { |
|
42 |
return DATASOURCE_NAME; |
|
43 |
} |
|
44 |
|
|
45 |
public IDataStore createNewDataStore(IDataStoreParameters dsp,IFeatureType featureType) throws InitializeException, InitializeWriterException{ |
|
46 |
ShpFeaturesWriter.create((SHPStoreParameters)dsp,featureType); |
|
47 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
48 |
return dsm.createDataStore(dsp); |
|
49 |
} |
|
50 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/ShpDataSourceParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataSourceFileParameters; |
|
4 |
|
|
5 |
public class ShpDataSourceParameters extends DataSourceFileParameters { |
|
6 |
public String getDataSourceName() { |
|
7 |
return ShpDataSource.DATASOURCE_NAME; |
|
8 |
} |
|
9 |
|
|
10 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/Register.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
2 | 2 |
|
3 |
import org.gvsig.data.DataSourceManager;
|
|
3 |
import org.gvsig.data.DataManager; |
|
4 | 4 |
|
5 | 5 |
public class Register { |
6 | 6 |
public static void selfRegister() { |
7 |
DataSourceManager dsm = DataSourceManager.getManager();
|
|
7 |
DataManager dsm = DataManager.getManager();
|
|
8 | 8 |
|
9 | 9 |
dsm.registerDataStore(SHPStore.DATASTORE_NAME, |
10 | 10 |
SHPStore.class, |
11 | 11 |
SHPStoreParameters.class |
12 | 12 |
); |
13 | 13 |
dsm.registerDataSource( |
14 |
ShpDataSource.DATASOURCE_NAME,
|
|
15 |
ShpDataSource.class,
|
|
16 |
ShpDataSourceParameters.class
|
|
14 |
SHPDataExplorer.DATASOURCE_NAME,
|
|
15 |
SHPDataExplorer.class,
|
|
16 |
SHPDataExplorerParameters.class
|
|
17 | 17 |
); |
18 | 18 |
} |
19 | 19 |
|
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/SHPDataExplorer.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.data.DataManager; |
|
6 |
import org.gvsig.data.IDataExplorerParameters; |
|
7 |
import org.gvsig.data.IDataStore; |
|
8 |
import org.gvsig.data.IDataStoreParameters; |
|
9 |
import org.gvsig.data.datastores.vectorial.file.RemoveFileException; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFDataExplorer; |
|
11 |
import org.gvsig.data.datastores.vectorial.file.shp.utils.SHP; |
|
12 |
import org.gvsig.data.exception.InitializeException; |
|
13 |
import org.gvsig.data.exception.InitializeWriterException; |
|
14 |
import org.gvsig.data.exception.OpenException; |
|
15 |
import org.gvsig.data.vectorial.IFeatureType; |
|
16 |
import org.gvsig.data.vectorial.INewDataStoreParameters; |
|
17 |
|
|
18 |
public class SHPDataExplorer extends DBFDataExplorer { |
|
19 |
protected SHPDataExplorerParameters parameters; |
|
20 |
public static String DATASOURCE_NAME="ShpDataSource"; |
|
21 |
|
|
22 |
protected boolean isValid(File file) { |
|
23 |
if (!file.exists()){ |
|
24 |
return false; |
|
25 |
} |
|
26 |
if (!(file.getName().toLowerCase().endsWith(".shp"))){ |
|
27 |
return false; |
|
28 |
} |
|
29 |
File shx = SHP.getShxFile(file); |
|
30 |
if (!shx.exists()){ |
|
31 |
return false; |
|
32 |
} |
|
33 |
File dbf = SHP.getDbfFile(file); |
|
34 |
return super.isValid(dbf); |
|
35 |
} |
|
36 |
|
|
37 |
|
|
38 |
public void init(IDataExplorerParameters parameters) { |
|
39 |
this.parameters = (SHPDataExplorerParameters)parameters; |
|
40 |
this.path = this.parameters.getSource(); |
|
41 |
} |
|
42 |
|
|
43 |
|
|
44 |
public String getName() { |
|
45 |
return DATASOURCE_NAME; |
|
46 |
} |
|
47 |
|
|
48 |
public IDataStore createDataStore(IDataStoreParameters dsp) throws InitializeException, InitializeWriterException{ |
|
49 |
DataManager dsm=DataManager.getManager(); |
|
50 |
return dsm.createDataStore(dsp); |
|
51 |
} |
|
52 |
|
|
53 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws OpenException, InitializeWriterException { |
|
54 |
IDataStoreParameters dsp=ndsp.getDataStoreParameters(); |
|
55 |
IFeatureType ft=ndsp.getFeatureType(); |
|
56 |
ShpFeaturesWriter.create((SHPStoreParameters)dsp,ft); |
|
57 |
return dsp; |
|
58 |
} |
|
59 |
|
|
60 |
public INewDataStoreParameters createNewDataStoreParameter(IDataStoreParameters dsp) { |
|
61 |
SHPNewStoreParameters dbfnsp=new SHPNewStoreParameters(); |
|
62 |
dbfnsp.setDataStoreParameters(dsp); |
|
63 |
return dbfnsp; |
|
64 |
} |
|
65 |
|
|
66 |
public void remove(IDataStoreParameters dsp) throws RemoveFileException { |
|
67 |
SHPStoreParameters shpsp=(SHPStoreParameters)dsp; |
|
68 |
File shp=shpsp.getSHPFile(); |
|
69 |
File dbf=shpsp.getDBFFile(); |
|
70 |
File shx=shpsp.getSHXFile(); |
|
71 |
if (shp.exists()) { |
|
72 |
// shp.deleteOnExit(); |
|
73 |
|
|
74 |
if (!shp.delete()){ |
|
75 |
throw new RemoveFileException(shp.getName(),new Exception()); |
|
76 |
} |
|
77 |
} |
|
78 |
if (dbf.exists()) { |
|
79 |
// dbf.deleteOnExit(); |
|
80 |
if (!dbf.delete()){ |
|
81 |
throw new RemoveFileException(dbf.getName(),new Exception()); |
|
82 |
} |
|
83 |
} |
|
84 |
if (shx.exists()) { |
|
85 |
// shx.deleteOnExit(); |
|
86 |
if (!shx.delete()){ |
|
87 |
throw new RemoveFileException(shx.getName(),new Exception()); |
|
88 |
} |
|
89 |
} |
|
90 |
} |
|
91 |
} |
|
0 | 92 |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/SHPNewStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
|
2 |
|
|
3 |
import org.gvsig.data.datastores.vectorial.file.dbf.DBFNewStoreParameters; |
|
4 |
|
|
5 |
public class SHPNewStoreParameters extends DBFNewStoreParameters{ |
|
6 |
|
|
7 |
public SHPNewStoreParameters() { |
|
8 |
// TODO Auto-generated constructor stub |
|
9 |
} |
|
10 |
|
|
11 |
public String getDataStoreName() { |
|
12 |
return SHPStore.DATASTORE_NAME; |
|
13 |
} |
|
14 |
|
|
15 |
public boolean isValid() { |
|
16 |
// TODO Auto-generated method stub |
|
17 |
return false; |
|
18 |
} |
|
19 |
|
|
20 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/ShpFeaturesWriter.java | ||
---|---|---|
127 | 127 |
{ |
128 | 128 |
System.out.println("No se ha escrito la geometr?a " |
129 | 129 |
+ feature.getID().toString() + " geomType=" + theGeom.getGeometryType()); |
130 |
throw new WriteException(SHPStore.DATASTORE_NAME,new Exception()); |
|
130 | 131 |
} |
131 | 132 |
} |
132 | 133 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/SHPStore.java | ||
---|---|---|
70 | 70 |
dad.setName("GEOMETRY"); |
71 | 71 |
dad.setType(IFeatureAttributeDescriptor.TYPE_GEOMETRY); |
72 | 72 |
featureType.add(dad); |
73 |
featureType.setDefaultGeometry("GEOMETRY"); |
|
73 | 74 |
|
74 | 75 |
SHPStoreParameters shpParameters=(SHPStoreParameters)parameters; |
75 | 76 |
|
... | ... | |
339 | 340 |
String fieldType=descriptor.getDataType(); |
340 | 341 |
if (fieldType.equals(IFeatureAttributeDescriptor.TYPE_GEOMETRY)){ |
341 | 342 |
IGeometry geometry=getGeometry(position); |
342 |
feature.set(i,geometry); |
|
343 |
feature.setGeometry(i,geometry);
|
|
343 | 344 |
// feature.setDefaultGeometry(geometry); |
344 | 345 |
|
345 | 346 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/shp/SHPDataExplorerParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.shp; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataExplorerFileParameters; |
|
4 |
|
|
5 |
public class SHPDataExplorerParameters extends DataExplorerFileParameters { |
|
6 |
public String getDataSourceName() { |
|
7 |
return SHPDataExplorer.DATASOURCE_NAME; |
|
8 |
} |
|
9 |
|
|
10 |
} |
|
0 | 11 |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataSource.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.DataSourceManager; |
|
7 |
import org.gvsig.data.IDataSourceParameters; |
|
8 |
import org.gvsig.data.IDataStore; |
|
9 |
import org.gvsig.data.IDataStoreParameters; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
11 |
import org.gvsig.data.exception.InitializeException; |
|
12 |
import org.gvsig.data.exception.InitializeWriterException; |
|
13 |
import org.gvsig.data.exception.ReadException; |
|
14 |
import org.gvsig.data.explorer.file.AbstractDataSourceFile; |
|
15 |
import org.gvsig.data.vectorial.IFeatureType; |
|
16 |
|
|
17 |
public class DBFDataSource extends AbstractDataSourceFile { |
|
18 |
|
|
19 |
public static String DATASOURCE_NAME="DBFDataSource"; |
|
20 |
|
|
21 |
protected DBFDataSourceParameters parameters; |
|
22 |
protected File path; |
|
23 |
|
|
24 |
|
|
25 |
public IDataStoreParameters[] getSources() throws ReadException { |
|
26 |
if (!this.path.exists()){ |
|
27 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
28 |
} |
|
29 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
30 |
|
|
31 |
String files[] = this.path.list(); |
|
32 |
int i; |
|
33 |
File theFile; |
|
34 |
ArrayList fileList = new ArrayList(); |
|
35 |
IDataStoreParameters dsp = null; |
|
36 |
|
|
37 |
for (i=0;i<files.length;i++){ |
|
38 |
theFile = new File(this.path,files[i]); |
|
39 |
|
|
40 |
if (this.isValid(theFile)){ |
|
41 |
dsp= this.newParameter(theFile); |
|
42 |
|
|
43 |
|
|
44 |
// dsp=dsm.createDataStoreParameters(DBFStore.DATASTORE_NAME); |
|
45 |
|
|
46 |
// ((IDriverStoreParameters)dsp).setDriverParameters(param); |
|
47 |
|
|
48 |
fileList.add(dsp); |
|
49 |
|
|
50 |
} |
|
51 |
|
|
52 |
|
|
53 |
} |
|
54 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
55 |
x[0]=dsp; |
|
56 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
57 |
} |
|
58 |
|
|
59 |
protected IDataStoreParameters newParameter(File file){ |
|
60 |
DBFStoreParameters param = new DBFStoreParameters(); |
|
61 |
param.setDBFFile(file); |
|
62 |
return param; |
|
63 |
} |
|
64 |
|
|
65 |
protected boolean isValid(String file){ |
|
66 |
return this.isValid(new File(file)); |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
protected boolean isValid(File file){ |
|
71 |
if (!file.exists()){ |
|
72 |
return false; |
|
73 |
} |
|
74 |
return (file.getName().toLowerCase().endsWith(".dbf")); |
|
75 |
} |
|
76 |
|
|
77 |
public String getName() { |
|
78 |
return DATASOURCE_NAME; |
|
79 |
} |
|
80 |
|
|
81 |
public void init(IDataSourceParameters parameters) { |
|
82 |
this.parameters = (DBFDataSourceParameters)parameters; |
|
83 |
this.path = this.parameters.getSource(); |
|
84 |
} |
|
85 |
|
|
86 |
public IDataStore createNewDataStore(IDataStoreParameters dsp,IFeatureType featureType) throws InitializeException, InitializeWriterException{ |
|
87 |
DBFFeaturesWriter.create((DBFStoreParameters)dsp,featureType); |
|
88 |
DataSourceManager dsm=DataSourceManager.getManager(); |
|
89 |
return dsm.createDataStore(dsp); |
|
90 |
} |
|
91 |
|
|
92 |
public boolean canCreate() { |
|
93 |
return true; |
|
94 |
} |
|
95 |
|
|
96 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataSourceParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataSourceFileParameters; |
|
4 |
|
|
5 |
public class DBFDataSourceParameters extends DataSourceFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DBFDataSource.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/Register.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
2 | 2 |
|
3 |
import org.gvsig.data.DataSourceManager;
|
|
3 |
import org.gvsig.data.DataManager; |
|
4 | 4 |
|
5 | 5 |
public class Register { |
6 | 6 |
public static void selfRegister() { |
7 |
DataSourceManager dsm = DataSourceManager.getManager();
|
|
7 |
DataManager dsm = DataManager.getManager();
|
|
8 | 8 |
|
9 | 9 |
dsm.registerDataStore(DBFStore.DATASTORE_NAME, |
10 | 10 |
DBFStore.class, |
11 | 11 |
DBFStoreParameters.class |
12 | 12 |
); |
13 | 13 |
dsm.registerDataSource( |
14 |
DBFDataSource.DATASOURCE_NAME,
|
|
15 |
DBFDataSource.class,
|
|
16 |
DBFDataSourceParameters.class
|
|
14 |
DBFDataExplorer.DATASOURCE_NAME,
|
|
15 |
DBFDataExplorer.class,
|
|
16 |
DBFDataExplorerParameters.class
|
|
17 | 17 |
); |
18 | 18 |
} |
19 | 19 |
|
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataExplorer.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.ArrayList; |
|
5 |
|
|
6 |
import org.gvsig.data.DataManager; |
|
7 |
import org.gvsig.data.IDataExplorerParameters; |
|
8 |
import org.gvsig.data.IDataStore; |
|
9 |
import org.gvsig.data.IDataStoreParameters; |
|
10 |
import org.gvsig.data.datastores.vectorial.file.RemoveFileException; |
|
11 |
import org.gvsig.data.datastores.vectorial.file.exception.FileNotFoundDriverException; |
|
12 |
import org.gvsig.data.exception.InitializeException; |
|
13 |
import org.gvsig.data.exception.InitializeWriterException; |
|
14 |
import org.gvsig.data.exception.OpenException; |
|
15 |
import org.gvsig.data.exception.ReadException; |
|
16 |
import org.gvsig.data.explorer.file.AbstractDataExplorerFile; |
|
17 |
import org.gvsig.data.vectorial.IFeatureType; |
|
18 |
import org.gvsig.data.vectorial.INewDataStoreParameters; |
|
19 |
|
|
20 |
public class DBFDataExplorer extends AbstractDataExplorerFile { |
|
21 |
|
|
22 |
public static String DATASOURCE_NAME="DBFDataExplorer"; |
|
23 |
|
|
24 |
protected DBFDataExplorerParameters parameters; |
|
25 |
protected File path; |
|
26 |
|
|
27 |
|
|
28 |
public IDataStoreParameters[] list() throws ReadException { |
|
29 |
if (!this.path.exists()){ |
|
30 |
new FileNotFoundDriverException(this.getName()+": Path not found '"+this.path+"'",new Exception()); |
|
31 |
} |
|
32 |
// DataManager dsm=DataManager.getManager(); |
|
33 |
|
|
34 |
String files[] = this.path.list(); |
|
35 |
int i; |
|
36 |
File theFile; |
|
37 |
ArrayList fileList = new ArrayList(); |
|
38 |
IDataStoreParameters dsp = null; |
|
39 |
|
|
40 |
for (i=0;i<files.length;i++){ |
|
41 |
theFile = new File(this.path,files[i]); |
|
42 |
|
|
43 |
if (this.isValid(theFile)){ |
|
44 |
dsp= this.newParameter(theFile); |
|
45 |
|
|
46 |
|
|
47 |
// dsp=dsm.createDataStoreParameters(DBFStore.DATASTORE_NAME); |
|
48 |
|
|
49 |
// ((IDriverStoreParameters)dsp).setDriverParameters(param); |
|
50 |
|
|
51 |
fileList.add(dsp); |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
} |
|
57 |
IDataStoreParameters[] x = new IDataStoreParameters[1]; |
|
58 |
x[0]=dsp; |
|
59 |
return (IDataStoreParameters[])fileList.toArray(x); |
|
60 |
} |
|
61 |
|
|
62 |
protected IDataStoreParameters newParameter(File file){ |
|
63 |
DBFStoreParameters param = new DBFStoreParameters(); |
|
64 |
param.setDBFFile(file); |
|
65 |
return param; |
|
66 |
} |
|
67 |
|
|
68 |
protected boolean isValid(String file){ |
|
69 |
return this.isValid(new File(file)); |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
protected boolean isValid(File file){ |
|
74 |
if (!file.exists()){ |
|
75 |
return false; |
|
76 |
} |
|
77 |
return (file.getName().toLowerCase().endsWith(".dbf")); |
|
78 |
} |
|
79 |
|
|
80 |
public String getName() { |
|
81 |
return DATASOURCE_NAME; |
|
82 |
} |
|
83 |
|
|
84 |
public void init(IDataExplorerParameters parameters) { |
|
85 |
this.parameters = (DBFDataExplorerParameters)parameters; |
|
86 |
this.path = this.parameters.getSource(); |
|
87 |
} |
|
88 |
|
|
89 |
public IDataStore createDataStore(IDataStoreParameters dsp) throws InitializeException, InitializeWriterException{ |
|
90 |
DataManager dsm=DataManager.getManager(); |
|
91 |
return dsm.createDataStore(dsp); |
|
92 |
} |
|
93 |
|
|
94 |
public boolean canCreate() { |
|
95 |
return true; |
|
96 |
} |
|
97 |
|
|
98 |
public IDataStoreParameters add(INewDataStoreParameters ndsp) throws OpenException, InitializeWriterException { |
|
99 |
IDataStoreParameters dsp=ndsp.getDataStoreParameters(); |
|
100 |
IFeatureType ft=ndsp.getFeatureType(); |
|
101 |
DBFFeaturesWriter.create((DBFStoreParameters)dsp,ft); |
|
102 |
return dsp; |
|
103 |
} |
|
104 |
|
|
105 |
public INewDataStoreParameters createNewDataStoreParameter(IDataStoreParameters dsp) { |
|
106 |
DBFNewStoreParameters dbfnsp=new DBFNewStoreParameters(); |
|
107 |
dbfnsp.setDataStoreParameters(dsp); |
|
108 |
return dbfnsp; |
|
109 |
} |
|
110 |
|
|
111 |
public void remove(IDataStoreParameters dsp) throws RemoveFileException { |
|
112 |
DBFStoreParameters dbfsp=(DBFStoreParameters)dsp; |
|
113 |
File f=dbfsp.getDBFFile(); |
|
114 |
if (f.exists()) { |
|
115 |
if (!f.delete()){ |
|
116 |
throw new RemoveFileException(this.getName(),new Exception()); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
} |
|
121 |
} |
|
0 | 122 |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFNewStoreParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.AbstractNewDataStoreParameter; |
|
4 |
|
|
5 |
public class DBFNewStoreParameters extends AbstractNewDataStoreParameter{ |
|
6 |
|
|
7 |
public DBFNewStoreParameters() { |
|
8 |
// TODO Auto-generated constructor stub |
|
9 |
} |
|
10 |
|
|
11 |
public String getDataStoreName() { |
|
12 |
return DBFStore.DATASTORE_NAME; |
|
13 |
} |
|
14 |
|
|
15 |
public boolean isValid() { |
|
16 |
// TODO Auto-generated method stub |
|
17 |
return false; |
|
18 |
} |
|
19 |
|
|
20 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFStore.java | ||
---|---|---|
11 | 11 |
import java.util.Locale; |
12 | 12 |
|
13 | 13 |
import org.gvsig.data.IDataCollection; |
14 |
import org.gvsig.data.IDataExplorer; |
|
14 | 15 |
import org.gvsig.data.IDataStoreParameters; |
15 | 16 |
import org.gvsig.data.datastores.vectorial.IFeaturesReader; |
16 | 17 |
import org.gvsig.data.datastores.vectorial.IFeaturesWriter; |
... | ... | |
288 | 289 |
public IDataStoreParameters getParameters() { |
289 | 290 |
return parameters; |
290 | 291 |
} |
292 |
|
|
293 |
|
|
294 |
public IDataExplorer getExplorer() { |
|
295 |
// TODO Auto-generated method stub |
|
296 |
return null; |
|
297 |
} |
|
291 | 298 |
} |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFDataExplorerParameters.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
|
2 |
|
|
3 |
import org.gvsig.data.explorer.file.DataExplorerFileParameters; |
|
4 |
|
|
5 |
public class DBFDataExplorerParameters extends DataExplorerFileParameters { |
|
6 |
|
|
7 |
public String getDataSourceName() { |
|
8 |
return DBFDataExplorer.DATASOURCE_NAME; |
|
9 |
} |
|
10 |
|
|
11 |
} |
|
0 | 12 |
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/RemoveFileException.java | ||
---|---|---|
1 |
package org.gvsig.data.datastores.vectorial.file; |
|
2 |
|
|
3 |
import org.gvsig.data.exception.ReadException; |
|
4 |
|
|
5 |
public class RemoveFileException extends ReadException{ |
|
6 |
|
|
7 |
public RemoveFileException(String l,Throwable exception) { |
|
8 |
super(l,exception); |
|
9 |
init(); |
|
10 |
} |
|
11 |
/** |
|
12 |
* |
|
13 |
*/ |
|
14 |
private void init() { |
|
15 |
messageKey = "error_remove"; |
|
16 |
formatString = "Can?t remove: %(name) "; |
|
17 |
} |
|
18 |
|
|
19 |
} |
Also available in: Unified diff