@@ -20,6 +20,10 @@ |
import org.codehaus.jettison.json.JSONException; |
import org.codehaus.jettison.json.JSONObject; |
import csip.ModelDataService; |
+import static csip.ModelDataService.KEY_METAINFO; |
+import static csip.ModelDataService.KEY_MODE; |
+import static csip.ModelDataService.KEY_REQUEST_RESULTS; |
+import static csip.ModelDataService.SYNC; |
import static util.ErosionConst.CONV_KGM2_TONACRE; |
import static util.ErosionConst.KEY_LENGTH; |
import static util.ErosionConst.KEY_MGMTS; |
@@ -101,6 +105,7 @@ |
double r2sci_fo = 0.0; |
double r2sci_er = 0.0; |
|
+ JSONObject syncRequest = JSONUtils.clone(getRequest()); |
File[] dummy = new File[0]; // the client function should check for null array. |
if (JSONUtils.checkKeyExistsB(getParamMap(), KEY_LENGTH) |
&& JSONUtils.checkKeyExistsB(getParamMap(), KEY_STEEPNESS)) { |
@@ -113,14 +118,18 @@ |
req_results.put(RES_SLOPE_DELIVERY); |
req_results.put(RES_SLOPE_T_VALUE); |
req_results.put(RES_SLOPE_DEGRAD); |
- getRequest().getJSONObject(KEY_METAINFO).put(KEY_REQUEST_RESULTS, req_results); |
- getRequest().getJSONObject(KEY_METAINFO).put(KEY_MODE, SYNC); |
+ |
+ |
+ syncRequest.getJSONObject(KEY_METAINFO).put(KEY_MODE, SYNC); |
+ syncRequest.getJSONObject(KEY_METAINFO).put(KEY_REQUEST_RESULTS, req_results); |
//LOG.info("This is the request =) : "+getRequest().toString()); |
//String url = Config.getString("codebase.url", "bad")+"/csip-erosion/m/rusle2/1.2"; |
//LOG.info(url); |
LOG.info("STARTING RUSLE2"); |
+ LOG.info("R2 Request" + syncRequest); |
//JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.2", getRequest(), dummy); |
- JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.3", getRequest()); |
+ JSONObject r2Response = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/rusle2/1.3", syncRequest); |
+ LOG.info("R2 Response "+ syncRequest); |
|
Map<String, JSONObject> r2Results = JSONUtils.preprocess(r2Response.getJSONArray(KEY_RESULT)); |
|
@@ -148,20 +157,20 @@ |
|
LOG.info("The soil is: " + wepsSoil.toString()); |
//getParamMap().put(WEPS_KEY_SOIL, wepsSoil); |
- getRequest().getJSONArray(KEY_PARAMETER).put(wepsSoil); |
+ syncRequest.getJSONArray(KEY_PARAMETER).put(wepsSoil); |
} |
if (!JSONUtils.checkKeyExistsB(getParamMap(), WEPS_KEY_MANAGEMENT)) { |
|
JSONObject lmodweps = (JSONObject) JSONUtils.getJSONArrayParam(getParamMap(), KEY_MGMTS).get(0); |
JSONObject lmodwepsobj = JSONUtils.data(WEPS_KEY_MANAGEMENT, lmodweps); |
//getParamMap().put(WEPS_KEY_MANAGEMENT, lmodwepsobj); |
- getRequest().getJSONArray(KEY_PARAMETER).put(lmodwepsobj); |
+ syncRequest.getJSONArray(KEY_PARAMETER).put(lmodwepsobj); |
} |
|
LOG.info("Trying to invoke WEPS for SCI"); |
|
//JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.2", getRequest(), dummy); |
- JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.3", getRequest()); |
+ JSONObject wepsResponse = new Client(LOG).doPOST("http://localhost:8080/csip-erosion/m/weps/1.3", syncRequest); |
|
|
Map<String, JSONObject> wepsResults = JSONUtils.preprocess(wepsResponse.getJSONArray(KEY_RESULT)); |
@@ -47,6 +47,7 @@ |
*/ |
public boolean loadFiles(String path) { |
try { |
+ |
// Try loading each of the output files in sequence. |
// Configuration is handled within each of these functions. |
// Failure will throw an exception. |
@@ -99,7 +100,7 @@ |
public void loadOutputResultSet(String path) { |
// @todo Check configuration options to see if we should load this file. |
try { |
- Binaries.unpackResourceAbsolute(DETAIL_SOURCE, System.getProperty("user.dir") +"/"+ PATH_META); |
+ Binaries.unpackResourceAbsolute(DETAIL_SOURCE, path +"/"+ PATH_META); |
OutputResultSet resultset = new OutputResultSet(m_con, m_sInputDirectory, m_sUnits); |
resultset.setWorkingDir(path); |
resultset.fill(); |