@@ -177,16 +177,23 @@ |
|
// protect the DLL? |
private static final Object romeLock = new Object(); |
+ private static boolean lockRusle = Config.getBoolean("r2.3.0.lock", false); |
|
|
@Override |
protected void doProcess() throws Exception { |
try { |
- synchronized (romeLock) { |
- Executable python = resources().getExe(V3_0.PYTHON); |
+ Executable python = resources().getExe(V3_0.PYTHON); |
+ if (lockRusle) { |
+ synchronized (romeLock) { |
+ LOG.log(Level.INFO, "EXECUTING PYROME FROM doProcess()..."); |
+ int result = r2run.executePyrome(new File(workspace().getDir(), R2_TMP_FILENAME + R2_TMP_FILEEXT), python, getSUID()); |
+ } |
+ } else { |
LOG.log(Level.INFO, "EXECUTING PYROME FROM doProcess()..."); |
- int result = r2run.executePyrome(new File(workspace().getDir(), R2_TMP_FILENAME + R2_TMP_FILEEXT), python); |
+ int result = r2run.executePyrome(new File(workspace().getDir(), R2_TMP_FILENAME + R2_TMP_FILEEXT), python, getSUID()); |
} |
+ |
} catch (Exception e) { |
LOG.log(Level.SEVERE, "ERROR EXECUTING PYTHON-RUSLE2", e); |
throw e; |
@@ -264,7 +271,10 @@ |
protected void createInputFile(File file, Map<String, JSONObject> param) |
throws Exception { |
|
- steepness = JSONUtils.getDoubleParam(param, KEY_STEEPNESS, 0.0); |
+ steepness = JSONUtils.getDoubleParam(param, KEY_STEEPNESS, 0.01); |
+ if (steepness < 0.01) |
+ steepness = 0.01; |
+ |
length = JSONUtils.getDoubleParam(param, KEY_LENGTH, 0.0); |
boolean resolveLoc = JSONUtils.getBooleanParam(param, KEY_RESOLVE_LOCATION, false); |
double latitude = JSONUtils.getDoubleParam(param, KEY_LATITUDE, 0.0); |
@@ -519,7 +529,10 @@ |
for (int i = 0; i < aTopoLength.length(); i++) { |
text = " RomeFileSetAttrValue(profile, 'TOPO_HORIZ', '" + aTopoLength.getString(i) + "', " + i + ")\n"; |
fos.write(text.getBytes()); |
- text = " RomeFileSetAttrValue(profile, 'TOPO_STEEP', '" + aTopoSteepness.getString(i) + "', " + i + ")\n"; |
+ String tstr = aTopoSteepness.getString(i); |
+ if (tstr.isEmpty() || Double.parseDouble(tstr) < 0.01) |
+ tstr = "0.01"; |
+ text = " RomeFileSetAttrValue(profile, 'TOPO_STEEP', '" + tstr + "', " + i + ")\n"; |
fos.write(text.getBytes()); |
} |
} |
@@ -231,7 +231,7 @@ |
try { |
Executable python = resources().getExe(V3_0.PYTHON); |
LOG.log(Level.INFO, "EXECUTING PYROME FROM doProcess()..."); |
- int result = r2run.executePyrome(new File(workspace().getDir(), R2_TMP_FILENAME + R2_TMP_FILEEXT), python); |
+ int result = r2run.executePyrome(new File(workspace().getDir(), R2_TMP_FILENAME + R2_TMP_FILEEXT), python, getSUID()); |
callAnn(); |
} catch (Exception e) { |
LOG.log(Level.SEVERE, "ERROR EXECUTING PYTHON-RUSLE2", e); |