V1_0.java [src/java/m/example/gis_objects] Revision: 1019df6c91ae168bbcad91c34dbfd42818256f61 Date: Mon Apr 11 19:22:07 MDT 2016
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package m.example.gis_objects;
//import GISObjects.GISObject;
//import GISObjects.GISObjectConsumerFactory;
//import GISObjects.GISObjectFactory;
import csip.ModelDataService;
import csip.ServiceException;
import csip.annotations.Resource;
import static csip.annotations.ResourceType.JDBC;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.Path;
import oms3.annotations.Description;
import oms3.annotations.Name;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
/**
* Basic usage of the GIS-Objects.
*
* @author Shaun Case
*/
@Name("GIS_Objects")
@Description("An example of how to ")
@Path("m/gis_objects/1.0")
@Resource(type = JDBC, file = "${mssql.db}", id = "mssql", env = {
"removeAbandoned=false", "defaultReadOnly=true", "defaultAutoCommit=false",
"jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
+ "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;"
+ "org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
})
public class V1_0 extends ModelDataService {
// JSONObject aoa_geometry;
// double finalArea;
//
// @Override
// protected void preProcess() throws csip.ServiceException {
// Map<String, JSONObject> inputParams = getParamMap();
// if (inputParams.containsKey("aoa_geometry")) {
// aoa_geometry = inputParams.get("aoa_geometry");
// } else {
// throw new csip.ServiceException("Missing input parameter 'aoa_geometry'.");
// }
// }
//
// @Override
// protected void doProcess() throws ServiceException {
// GISObject inputGIS;
// try (Connection connection = getResourceJDBC("mssql");) {
// GISObjectFactory.setGISObjectEngine(GISObjectConsumerFactory.createGISEngine(connection));
// inputGIS = GISObjects.GISObjectFactory.createGISObject(aoa_geometry);
//
// finalArea = inputGIS.areaInAcres();
//
// } catch (SQLException | JSONException | IOException ex) {
// LOG.log(Level.SEVERE, null, ex);
// throw new csip.ServiceException("Cannot process request: ", ex);
// }
// }
//
// @Override
// protected void postProcess() throws csip.ServiceException {
// putResult("area", finalArea, "Area of the aoa_geometry specified", "Acres");
// }
}