V1_0.java [src/java/m/gis/intersect] Revision: a4a40fd9940713e61b1286a9f136adc49d7c6ee9  Date: Tue May 12 15:29:30 MDT 2015
/*
 * 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.gis.intersect;

import csip.ModelDataService;
import javax.ws.rs.Path;
import m.gis.Database;
import m.gis.DatabaseBuilder;
import oms3.annotations.*;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;

/**
 * GIS Intersection.
 *
 * @author od
 */
@Name("intersect")
@Description("CSIP Intersection Service")
@Path("m/intersect/1.0")
public class V1_0 extends ModelDataService {

    JSONArray geoms;	
    JSONObject result;	

    private Database db;


    @Override
    protected void preProcess() throws Exception {
	    geoms = getJSONArrayParam("geometries");
        LOG.info("received geometries: " + geoms.toString());  
        db = new DatabaseBuilder()
                .setAll(System.getProperty("user.home") + "/.csip-gis.properties")
                .create();
    }

    @Override
    protected String process() throws Exception {
        result = new JSONObject();
        return EXEC_OK;
    }

    @Override
    protected void postProcess() throws Exception {
        putResult("geometry", result);
    }

}