Revision 43377 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/JDBCHelperBase.java
JDBCHelperBase.java | ||
---|---|---|
4 | 4 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.OperationsFactoryBase; |
5 | 5 |
import java.sql.Connection; |
6 | 6 |
import java.sql.ResultSet; |
7 |
import java.sql.SQLException; |
|
8 |
import org.apache.commons.dbcp.BasicDataSource; |
|
9 |
import org.apache.commons.lang3.BooleanUtils; |
|
7 | 10 |
import org.apache.commons.lang3.StringUtils; |
8 | 11 |
import org.cresques.cts.IProjection; |
9 | 12 |
import org.gvsig.fmap.crs.CRSFactory; |
... | ... | |
31 | 34 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
32 | 35 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
33 | 36 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCCantFetchValueException; |
37 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCDriverClassNotFoundException; |
|
34 | 38 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
35 | 39 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
36 | 40 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCStoreProvider; |
... | ... | |
43 | 47 |
import org.gvsig.fmap.geom.GeometryManager; |
44 | 48 |
import org.gvsig.tools.dispose.impl.AbstractDisposable; |
45 | 49 |
import org.gvsig.tools.exception.BaseException; |
50 |
import org.gvsig.tools.exception.NotYetImplemented; |
|
46 | 51 |
import org.slf4j.Logger; |
47 | 52 |
import org.slf4j.LoggerFactory; |
48 | 53 |
|
... | ... | |
53 | 58 |
private static final String QUOTE_FOR_USE_IN_STRINGS = "'"; |
54 | 59 |
|
55 | 60 |
private static final Logger logger = LoggerFactory.getLogger(JDBCHelperBase.class); |
56 |
|
|
57 |
// protected JDBCResource resource = null; |
|
58 | 61 |
|
59 | 62 |
private ResulSetControler resulSetControler = null; |
60 | 63 |
|
... | ... | |
193 | 196 |
|
194 | 197 |
@Override |
195 | 198 |
public Connection getConnection() throws AccessResourceException { |
196 |
// return this.resource.getJDBCConnection(); |
|
197 |
return null; |
|
199 |
throw new NotYetImplemented(); |
|
198 | 200 |
} |
199 | 201 |
|
200 | 202 |
@Override |
203 |
public Connection getConnectionWritable() throws AccessResourceException { |
|
204 |
return this.getConnection(); |
|
205 |
} |
|
206 |
|
|
207 |
@Override |
|
201 | 208 |
public String getConnectionURL() { |
202 | 209 |
return null; |
203 | 210 |
} |
... | ... | |
209 | 216 |
|
210 | 217 |
@Override |
211 | 218 |
public void closeConnection(Connection connection) { |
212 |
// this.getResource().closeConnection(connection); |
|
213 |
JDBCUtils.closeQuietly(connection); |
|
219 |
if( connection != null ) { |
|
220 |
logger.debug("Clossing connection "+connection.hashCode()); |
|
221 |
try { |
|
222 |
connection.close(); |
|
223 |
} catch(Exception ex) { |
|
224 |
logger.warn("Can't close connection.", ex); |
|
225 |
} |
|
214 | 226 |
} |
227 |
} |
|
215 | 228 |
|
216 | 229 |
@Override |
217 | 230 |
protected void doDispose() throws BaseException { |
... | ... | |
341 | 354 |
|
342 | 355 |
@Override |
343 | 356 |
public String getDatabaseCodeFromProyection(IProjection proj) { |
344 |
String[] s = proj.getAbrev().split(":"); |
|
345 | 357 |
return this.srss.getDatabaseCode(proj.getAbrev()); |
346 | 358 |
} |
347 | 359 |
|
348 | 360 |
@Override |
349 | 361 |
public IProjection getProjectionFromDatabaseCode(String databaseCode) { |
362 |
if( StringUtils.trimToEmpty(databaseCode).equals("0") ) { |
|
363 |
return null; |
|
364 |
} |
|
350 | 365 |
String abbrev = this.srss.getApplicationAbbrev(databaseCode); |
351 | 366 |
if( StringUtils.isEmpty(abbrev) ) { |
352 | 367 |
return null; |
Also available in: Unified diff