@@ -35,10 +35,12 @@ |
resources.add(csip.ArchiveService.class); |
resources.add(csip.CatalogService.class); |
resources.add(csip.ControlService.class); |
+ resources.add(csip.DynamicPyModelDataService.class); |
resources.add(csip.QueryService.class); |
+ resources.add(csip.QueueingModelDataService.class); |
resources.add(csip.ReportService.class); |
resources.add(csip.UIService.class); |
- resources.add(m.sq.sci.V1_0.class); |
- resources.add(m.sq.stir.V1_0.class); |
+ resources.add(m.sq.sci.V1_0.class); |
+ resources.add(m.sq.stir.V1_0.class); |
} |
} |
@@ -9,7 +9,6 @@ |
import javax.ws.rs.Path; |
import oms3.annotations.Description; |
import oms3.annotations.Name; |
-import static m.sq.Constants.*; |
|
/** |
* SCI service. |
@@ -21,31 +20,31 @@ |
@Path("m/sci/1.0") |
public class V1_0 extends ModelDataService { |
|
- private static final double SCI_FACTOR = .078740157; |
- private double water_erosion; |
- private double water_sci; |
- private double wind_erosion; |
- private double wind_sci; |
- private double sci_total; |
+ static final String KEY_EROSION_WATER = "erosion_water"; |
+ static final String KEY_SCI_WATER = "sci_water"; |
+ static final String KEY_EROSION_WIND = "erosion_wind"; |
+ static final String KEY_SCI_WIND = "sci_wind"; |
+ static final String KEY_SCI_TOTAL = "sci_total"; |
+ |
+ static final double SCI_FACTOR = .078740157; |
+ double water_erosion; |
+ double water_sci; |
+ double wind_erosion; |
+ double wind_sci; |
+ double sci_total; |
|
|
@Override |
- protected void preProcess() throws Exception { |
- try { |
- water_erosion = getDoubleParam(KEY_EROSION_WATER); |
- water_sci = getDoubleParam(KEY_SCI_WATER); |
- wind_erosion = getDoubleParam(KEY_EROSION_WIND); |
- wind_sci = getDoubleParam(KEY_SCI_WIND); |
- } catch (ServiceException ex) { |
- LOG.severe(ex.getMessage()); |
- throw ex; |
- } |
- |
+ protected void preProcess() throws ServiceException { |
+ water_erosion = getDoubleParam(KEY_EROSION_WATER); |
+ water_sci = getDoubleParam(KEY_SCI_WATER); |
+ wind_erosion = getDoubleParam(KEY_EROSION_WIND); |
+ wind_sci = getDoubleParam(KEY_SCI_WIND); |
} |
|
|
@Override |
- public void doProcess() throws Exception { |
+ public void doProcess() { |
if (water_erosion < wind_erosion) { |
sci_total = wind_sci - SCI_FACTOR * water_erosion; |
} else { |
@@ -8,7 +8,6 @@ |
import javax.ws.rs.Path; |
import oms3.annotations.Description; |
import oms3.annotations.Name; |
-import static m.sq.Constants.*; |
import org.codehaus.jettison.json.JSONArray; |
import org.codehaus.jettison.json.JSONObject; |
|
@@ -22,6 +21,13 @@ |
@Path("m/stir/1.0") |
public class V1_0 extends ModelDataService { |
|
+ static final String KEY_MANAGEMENT = "management"; |
+ static final String KEY_DURATION_IN_MAN = "duration_in_man"; |
+ static final String KEY_OPERATIONS = "operations"; |
+ static final String KEY_STIR = "stir"; |
+ static final String KEY_TOTAL_STIR = "total_stir"; |
+ static final String KEY_AVERAGE_ANNUAL_STIR = "average_annual_stir"; |
+ |
private double[] operation_stirs; |
private int duration; |
private double total_stir; |
@@ -30,23 +36,19 @@ |
|
@Override |
protected void preProcess() throws Exception { |
- JSONObject management; |
- JSONArray operations; |
- JSONObject operation; |
- |
- management = getJSONParam(KEY_MANAGEMENT); |
+ JSONObject management = getJSONParam(KEY_MANAGEMENT); |
duration = management.getInt(KEY_DURATION_IN_MAN); |
- operations = management.getJSONArray(KEY_OPERATIONS); |
+ JSONArray operations = management.getJSONArray(KEY_OPERATIONS); |
operation_stirs = new double[operations.length()]; |
for (int i = 0; i < operations.length(); i++) { |
- operation = operations.getJSONObject(i); |
+ JSONObject operation = operations.getJSONObject(i); |
operation_stirs[i] = operation.getDouble(KEY_STIR); |
} |
} |
|
|
@Override |
- public void doProcess() throws Exception { |
+ public void doProcess() { |
total_stir = 0; |
for (int i = 0; i < operation_stirs.length; i++) { |
total_stir += operation_stirs[i]; |