Revision 10627 trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/db/DBSpatialDataSourceAdapter.java
DBSpatialDataSourceAdapter.java | ||
---|---|---|
3 | 3 |
import java.awt.geom.Rectangle2D; |
4 | 4 |
import java.sql.SQLException; |
5 | 5 |
|
6 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
6 | 7 |
import com.hardcode.gdbms.engine.data.SpatialDataSource; |
7 | 8 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
8 | 9 |
import com.hardcode.gdbms.engine.data.driver.SpatialDBDriver; |
9 | 10 |
import com.hardcode.gdbms.engine.spatial.Geometry; |
10 | 11 |
|
11 | 12 |
/** |
12 |
*
|
|
13 |
* |
|
13 | 14 |
*/ |
14 | 15 |
public class DBSpatialDataSourceAdapter extends DBDataSourceAdapter implements |
15 | 16 |
DBDataSource, SpatialDataSource { |
16 | 17 |
|
17 |
public void start() throws DriverException { |
|
18 |
public void start() throws ReadDriverException {
|
|
18 | 19 |
try { |
19 | 20 |
if (sem == 0) { |
20 | 21 |
con = getConnection(); |
21 | 22 |
SpatialDBTableSourceInfo info = (SpatialDBTableSourceInfo) getSourceInfo(); |
22 | 23 |
((SpatialDBDriver) driver).open(con, sql, info.tableName, info.geometryField); |
23 | 24 |
} |
24 |
|
|
25 |
|
|
25 | 26 |
sem++; |
26 | 27 |
} catch (SQLException e) { |
27 |
throw new DriverException(e);
|
|
28 |
throw new ReadDriverException(getName(),e);
|
|
28 | 29 |
} |
29 | 30 |
} |
30 | 31 |
|
... | ... | |
32 | 33 |
* @throws DriverException |
33 | 34 |
* @see com.hardcode.gdbms.engine.data.SpatialDataSource#getFullExtent() |
34 | 35 |
*/ |
35 |
public Rectangle2D getFullExtent() throws DriverException { |
|
36 |
public Rectangle2D getFullExtent() throws ReadDriverException {
|
|
36 | 37 |
return ((SpatialDBDriver) getDriver()).getFullExtent(); |
37 | 38 |
} |
38 | 39 |
|
39 | 40 |
/** |
40 |
* @throws DriverException |
|
41 | 41 |
* @see com.hardcode.gdbms.engine.data.SpatialDataSource#getGeometry(long) |
42 | 42 |
*/ |
43 |
public Geometry getGeometry(long rowIndex) throws DriverException { |
|
43 |
public Geometry getGeometry(long rowIndex) throws ReadDriverException {
|
|
44 | 44 |
return ((SpatialDBDriver) getDriver()).getGeometry(rowIndex); |
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
/** |
48 | 48 |
* @see com.hardcode.gdbms.engine.data.driver.SpatialDriver#getJTSGeometry(long) |
49 | 49 |
*/ |
50 |
public com.vividsolutions.jts.geom.Geometry getJTSGeometry(long rowIndex) throws DriverException { |
|
50 |
public com.vividsolutions.jts.geom.Geometry getJTSGeometry(long rowIndex) throws ReadDriverException {
|
|
51 | 51 |
return ((SpatialDBDriver) getDriver()).getJTSGeometry(rowIndex); |
52 | 52 |
} |
53 | 53 |
|
Also available in: Unified diff