Displaying differences for changeset
 
display as  

src/java/m/crp/climate_wind_soil/V1_0.java

@@ -64,7 +64,12 @@
         windURI = Config.getString("crp.windgen", windURI);
         climateURI = Config.getString("crp.cligen", climateURI);
 
-        aoa_geometry = params.getJSON("aoa_geometry");
+        if (params.has("aoa_geometry")) {
+            aoa_geometry = getParam("aoa_geometry");
+
+        } else {
+            throw new ServiceException("Service requires an aoa_geometry input.");
+        }
 
         if (params.has("stream_file")) {
             streamOutputFile = params.getBoolean("stream_file");
@@ -138,4 +143,23 @@
             throw new ServiceException("Cannot write to that file: " + filename, ex);
         }
     }
+////////////////////////////////    
+//    
+//  Private member functions
+//    
+//////////////////////////////// 
+
+    /**
+     * Get the full JSON parameter record.
+     *
+     * @param name
+     * @return the JSON record.
+     */
+    private JSONObject getParam(String name) throws ServiceException {
+        JSONObject p = getParamMap().get(name);
+        if (p == null) {
+            throw new ServiceException("Parameter not found: '" + name + "'");
+        }
+        return p;
+    }
 }