SoilParamsAoAFactory.java [src/java/d/soils/wwe01_wwesoilparams] Revision: default Date:
/*
* 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 d.soils.wwe01_wwesoilparams;
import csip.api.server.ServiceException;
import csip.SessionLogger;
import d.soils.fpp01_fppsoilparams.FPP_V1_0_AoA;
import d.soils.fpp01_fppsoilparams.FPP_V2_0_AoA;
import gisobjects.GISObjectException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import soils.db.SOILS_DATA;
/**
*
* @author scase
*/
public class SoilParamsAoAFactory {
public static final String WWE_SOIL_PARAMS_1_2 = "1.2";
public static final String WWE_SOIL_PARAMS_2_0 = "2.0";
public static final String WWE_SOIL_PARAMS_2_1 = "wwe 2.1";
public static final String WWE_SOIL_PARAMS_2_2 = "wwe 2.2";
public static final String FPP_SOIL_PARAMS_1_0 = "fpp 1.0";
public static final String FPP_SOIL_PARAMS_2_0 = "fpp 2.0";
public static SoilParamsAoA getAoA(String serviceVersion, SOILS_DATA soilsDb, Connection gisDb, JSONObject geometry, SessionLogger LOG) throws GISObjectException, SQLException, JSONException, IOException, ServiceException {
switch (serviceVersion) {
case WWE_SOIL_PARAMS_1_2:
// throw new ServiceException("This service is deprecated. Please use version 2.1");
return new V1_2_AoA(soilsDb, gisDb, geometry, LOG);
case WWE_SOIL_PARAMS_2_0:
// throw new ServiceException("This service is deprecated. Please use version 2.1");
return new V2_0_AoA(soilsDb, gisDb, geometry, LOG);
case WWE_SOIL_PARAMS_2_1:
return new V2_1_AoA(soilsDb, gisDb, geometry, LOG);
case WWE_SOIL_PARAMS_2_2:
return new V2_2_AoA(soilsDb, gisDb, geometry, LOG);
case FPP_SOIL_PARAMS_1_0:
//throw new ServiceException("This service is deprecated. Please use version 2.0");
return new FPP_V1_0_AoA(soilsDb, gisDb, geometry, LOG);
case FPP_SOIL_PARAMS_2_0:
return new FPP_V2_0_AoA(soilsDb, gisDb, geometry, LOG);
default:
throw new ServiceException("Invalid SoilParams AoA Version, " + serviceVersion + " .");
}
}
public static SoilParamsAoA getAoA(String serviceVersion, SOILS_DATA soilsDb, Connection gisDb, String mupolygonkey, SessionLogger LOG) throws GISObjectException, SQLException, JSONException, IOException, ServiceException {
switch (serviceVersion) {
case WWE_SOIL_PARAMS_2_1:
return new V2_1_AoA(soilsDb, gisDb, mupolygonkey, LOG);
default:
throw new ServiceException("Invalid SoilParams AoA Version, " + serviceVersion + " .");
}
}
}