svn-gvsig-desktop / trunk / libraries / libDataSourceDBBaseDrivers / src / org / gvsig / data / datastores / vectorial / driver / jdbc / h2 / H2DataSource.java @ 19738
History | View | Annotate | Download (1.97 KB)
1 |
package org.gvsig.data.datastores.vectorial.driver.jdbc.h2; |
---|---|
2 |
|
3 |
import java.sql.Connection; |
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.driver.IDriverStoreParameters; |
10 |
import org.gvsig.data.datastores.vectorial.driver.jdbc.AbstractDataSourceDBDriverJDBC; |
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.vectorial.IFeatureType; |
15 |
|
16 |
public class H2DataSource extends AbstractDataSourceDBDriverJDBC { |
17 |
public static String DATASOURCE_NAME="H2DataSource"; |
18 |
|
19 |
private Connection connection; |
20 |
|
21 |
public String getName() { |
22 |
// TODO Auto-generated method stub
|
23 |
return null; |
24 |
} |
25 |
|
26 |
public IDataStoreParameters[] getSources() throws ReadException { |
27 |
// TODO Auto-generated method stub
|
28 |
return null; |
29 |
} |
30 |
|
31 |
public void init(IDataSourceParameters parameters) { |
32 |
// TODO Auto-generated method stub
|
33 |
|
34 |
} |
35 |
|
36 |
Connection getConnection(){
|
37 |
// FIXME: OJO REsource manager
|
38 |
return this.connection; |
39 |
|
40 |
} |
41 |
|
42 |
|
43 |
|
44 |
private void initConnection() throws ReadException{ |
45 |
// String dburl = this.getParameters().getUrl();
|
46 |
// String dbuser = this.getParameters().getUser();
|
47 |
// String dbpass = this.getParameters().getPassw();
|
48 |
|
49 |
|
50 |
//TODO: Aqu? habria que implementar la llamada
|
51 |
// al Resource Manager para comprobar si ya hay
|
52 |
// una connexion a la BD
|
53 |
|
54 |
Connection conn = null; |
55 |
|
56 |
// conn = H2DriverUtils.getConnection(dburl, dbuser, dbpass);
|
57 |
|
58 |
|
59 |
this.connection = conn;
|
60 |
|
61 |
// conn.getMetaData().
|
62 |
} |
63 |
|
64 |
public IDataStore createNewDataStore(IDataStoreParameters dsp, IFeatureType featureType) throws InitializeException, InitializeWriterException { |
65 |
H2FeaturesWriter.create((H2StoreParameters)dsp,featureType); |
66 |
DataSourceManager dsm=DataSourceManager.getManager(); |
67 |
return dsm.createDataStore(dsp);
|
68 |
} |
69 |
|
70 |
public boolean canCreate() { |
71 |
return true; |
72 |
} |
73 |
|
74 |
|
75 |
} |