src/java/c/GIS_DB.java
@@ -16,7 +16,7 @@ |
* |
* @author Shaun Case |
*/ |
-public interface GIS_DB { |
+public interface GIS_DB extends AutoCloseable { |
|
public static class FileQryResult { |
|
src/java/c/MsSQLGIS.java
@@ -63,7 +63,7 @@ |
throw new csip.ServiceException("No connection object passed to MsSQLGIS. Class requires a connection to a MsSQL server."); |
} |
} |
- |
+ |
private GIS_DB.FileQryResult findFile(String select) throws SQLException { |
GIS_DB.FileQryResult res = null; |
try (Statement s = connection.createStatement();) { |
@@ -800,6 +800,9 @@ |
|
@Override |
public void close() throws SQLException { |
+ if ( null != connection ){ |
+ connection.close(); |
+ } |
} |
|
} |
src/java/d/soils/V1_2.java
@@ -60,7 +60,7 @@ |
|
@Override |
protected String process() throws ServiceException { |
- try |
+ try( GIS_DB gisDB = GIS_DB_Factory.createGISEngine();) |
{ |
LOG.log(Level.INFO, "phacil soils input obj dump"); |
outputObj = new JSONArray(getParam().toString()); |
@@ -114,7 +114,7 @@ |
if ((sPolygon != null) && (sPolygon.length() > 0)) |
newPolygon=sPolygon; |
|
- Collection<GIS_DB.Soil> soils = GIS_DB_Factory.createGISEngine().findSoilsForPolygonWithSand(newPolygon, firstLong); |
+ Collection<GIS_DB.Soil> soils = gisDB.findSoilsForPolygonWithSand(newPolygon, firstLong); |
|
for (GIS_DB.Soil soilObj : soils) { |
LOG.log(Level.INFO, "\n\n\n\n\n\n\n\n\nSAND TOTAL VALUE=" + soilObj.sandtotalR); |
@@ -157,7 +157,7 @@ |
aPoly.put(aSoil); |
} |
LOG.log(Level.INFO, "Query WEPS Soils coverage"); |
- Collection<GIS_DB.Soil> soilsW = GIS_DB_Factory.createGISEngine().findSoilsForPolygonWeps(newPolygon, firstLong); |
+ Collection<GIS_DB.Soil> soilsW = gisDB.findSoilsForPolygonWeps(newPolygon, firstLong); |
for (GIS_DB.Soil soilObj : soilsW) { |
String sSoil = "WEPS SOIL INTERSECTION: cokey:" + soilObj.coKey; |
sSoil += ", mukey:" + soilObj.muKey; |
@@ -219,7 +219,7 @@ |
} |
catch (Exception e) |
{ |
- throw new ServiceException("Error executing soil serivce "); |
+ throw new ServiceException("Error executing soil serivce ", e); |
} |
} |
|