Revision 20802 trunk/libraries/libFMap_dataDB/src/org/gvsig/data/datastores/vectorial/db/sde/SDEExplorer.java
SDEExplorer.java | ||
---|---|---|
35 | 35 |
import org.gvsig.data.IDataExplorerParameters; |
36 | 36 |
import org.gvsig.data.IDataStoreParameters; |
37 | 37 |
import org.gvsig.data.INewDataStoreParameters; |
38 |
import org.gvsig.data.ResourceManager; |
|
38 | 39 |
import org.gvsig.data.datastores.vectorial.db.DBExplorer; |
39 | 40 |
import org.gvsig.data.datastores.vectorial.db.DBParameters; |
41 |
import org.gvsig.data.datastores.vectorial.db.jdbc.h2.H2ExplorerParameters; |
|
42 |
import org.gvsig.data.datastores.vectorial.db.jdbc.h2.H2Resource; |
|
43 |
import org.gvsig.data.exception.DataException; |
|
40 | 44 |
import org.gvsig.data.exception.InitializeException; |
41 | 45 |
import org.gvsig.data.exception.InitializeWriterException; |
42 | 46 |
import org.gvsig.data.exception.ReadException; |
... | ... | |
60 | 64 |
public static String DATAEXPLORER_NAME = "SDEExplorer"; |
61 | 65 |
private SDEExplorerParameters parameters; |
62 | 66 |
private String defaultSchema; |
63 |
|
|
67 |
private SDEResource resource; |
|
64 | 68 |
/** |
65 | 69 |
* DOCUMENT ME! |
66 | 70 |
* |
... | ... | |
68 | 72 |
* |
69 | 73 |
* @throws InitializeException DOCUMENT ME! |
70 | 74 |
*/ |
71 |
protected SeConnection getConnection() throws InitializeException { |
|
72 |
String host = parameters.getHost(); |
|
73 |
String port = parameters.getPort(); |
|
74 |
String db = parameters.getDb(); |
|
75 |
String dbuser = parameters.getUser(); |
|
76 |
String dbpass = parameters.getPassw(); |
|
75 |
protected SeConnection getConnection() throws ReadException { |
|
77 | 76 |
|
78 |
return SDEUtils.getConnection(host, port, db, dbuser, dbpass); |
|
77 |
return this.resource.getConnection();//SDEUtils.getConnection(host, port, db, dbuser, dbpass);
|
|
79 | 78 |
} |
80 | 79 |
|
81 | 80 |
/** |
... | ... | |
90 | 89 |
*/ |
91 | 90 |
public IDataStoreParameters add(INewFeatureStoreParameters ndsp) |
92 | 91 |
throws InitializeException, InitializeWriterException { |
93 |
SeConnection conn = this.getConnection(); |
|
92 |
SeConnection conn; |
|
93 |
try { |
|
94 |
conn = this.getConnection(); |
|
95 |
} catch (ReadException e) { |
|
96 |
throw new InitializeException(DATAEXPLORER_NAME,e); |
|
97 |
} |
|
94 | 98 |
|
95 | 99 |
// try { |
96 | 100 |
// conn.setAutoCommit(true); |
... | ... | |
270 | 274 |
*/ |
271 | 275 |
public void init(IDataExplorerParameters parameters) |
272 | 276 |
throws InitializeException { |
273 |
this.parameters = (SDEExplorerParameters) parameters; |
|
277 |
SDEResource tmpResource = new SDEResource((SDEExplorerParameters)parameters); |
|
278 |
SDEResource theResource; |
|
279 |
ResourceManager resMan = ResourceManager.getResourceManager(); |
|
274 | 280 |
|
275 |
// this.defaultSchema = SDEUtils.getDefaultSchema(this.getConnection(), this.parameters.getCatalog()); |
|
276 |
} |
|
281 |
try { |
|
282 |
theResource = (SDEResource)resMan.addResource(tmpResource); |
|
283 |
} catch (DataException e1) { |
|
284 |
throw new InitializeException(this.getName(),e1); |
|
285 |
} |
|
286 |
this.parameters = (SDEExplorerParameters) parameters; |
|
287 |
this.resource=theResource; |
|
288 |
} |
|
277 | 289 |
|
278 | 290 |
private SDEStoreParameters newStoreParamters() { |
279 | 291 |
DataManager manager = DataManager.getManager(); |
Also available in: Unified diff