Displaying differences for changeset
 
display as  

nbproject/private/private.xml

@@ -42,24 +42,20 @@
             <file>file:/od/projects/csip-all/csip-example/web/WEB-INF/csip-defaults.json</file>
             <file>file:/od/projects/csip-all/csip-example/build.xml</file>
         </group>
+        <group name="csip-core">
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_01.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/py/V1_0.py</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_0.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0_1.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/stats/V2_0.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/jdbc/V1_0.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0.json</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0.java</file>
+            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V3.java</file>
+        </group>
         <group name="RTI">
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/py/V1_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/py/V1_0.py</file>
             <file>file:/od/projects/csip-all/csip-example/build.xml</file>
             <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/web/WEB-INF/csip-defaults.json</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_01.java</file>
-        </group>
-        <group name="csip-core">
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V3.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/py/V1_0.py</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V1_01.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/stats/V2_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/jdbc/V1_0.java</file>
-            <file>file:/od/projects/csip-all/csip-example/src/java/m/example/simpleservice/V2_0_1.java</file>
         </group>
     </open-files>
 </project-private>

src/java/m/example/externalexe/V1_0.java

@@ -33,7 +33,7 @@
     protected void doProcess() throws Exception {
         
         // get the resource by its 'id'
-        Executable e = getResourceExe("mod"); 
+        Executable e = resources().getExe("mod"); 
         // provide arguments
         e.setArguments("1", "2", "3");
         // execute it

src/java/m/example/jdbc/V1_0.java

@@ -43,7 +43,7 @@
 
   @Override
   protected void doProcess() throws Exception {
-    try (Connection c = getResourceJDBC(P_ID); Statement st = c.createStatement()) {
+    try (Connection c = resources().getJDBC(P_ID); Statement st = c.createStatement()) {
       try (ResultSet rs = st.executeQuery("select * from patches;")) {
         while (rs.next()) {
           System.out.println(rs.getDouble("nval"));
@@ -57,7 +57,7 @@
 
   @Override
   protected void postProcess() throws Exception {
-    putResult("result", "done.");
+    results().put("result", "done.");
   }
 
 }

src/java/m/example/logging/V1_0.java

@@ -25,7 +25,7 @@
     // 1) parse the service input 
     @Override
     protected void preProcess() throws Exception {
-        temp = getDoubleParam("temp");
+        temp = parameter().getDouble("temp");
         LOG.info("Got input temp: " + temp);
     }
 
@@ -41,7 +41,7 @@
     @Override
     protected void postProcess() throws Exception {
         LOG.info("put result " + temp);
-        putResult("temp", temp, "F");
+        results().put("temp", temp, "F");
     }
 
 }

src/java/m/example/simpleservice/V1_01.java

@@ -8,6 +8,7 @@
 import csip.ModelDataService;
 import javax.ws.rs.Path;
 import oms3.annotations.*;
+import org.apache.commons.io.FileUtils;
 
 /**
  * Fahrenheit conversion.
@@ -22,10 +23,15 @@
   // 2) convert the temperature
   @Override
   protected void doProcess() throws Exception {
-//    System.out.println("File " + getFileInput("test.txt"));
-    System.out.println("File " + attachments().getFile("test.txt"));
-    System.out.println("File " + formdata().getFile("file1"));
-    System.out.println("File " + formdata().getKeys());
+    
+    FileUtils.writeStringToFile(getWorkspaceFile("abc"), "string content");
+
+    results().put(getWorkspaceFile("abc"));
+    
+////    System.out.println("File " + getFileInput("test.txt"));
+//    System.out.println("File " + attachments().getFile("test.txt"));
+//    System.out.println("File " + formdata().getFile("file1"));
+//    System.out.println("File " + formdata().getKeys());
   }
 
 }

src/java/m/example/simpleservice/V2_0.java

@@ -23,20 +23,22 @@
 @Path("m/simpleservice/2.0")
 public class V2_0 extends csip.ModelDataService {
 
-    @Override
-    protected void doProcess() throws Exception {
+  @Override
+  protected void doProcess() throws Exception {
 //        long sleep = getLongParam("sleep", 0);
-        long sleep = parameter().getLong("sleep", 0);
-        Thread.sleep(sleep);
+    int sleep = parameter().getInt("sleep", 25);
+    boolean b = parameter().getBoolean("b", true);
+    System.out.println("Value " + sleep + " " + b);
+//        Thread.sleep(sleep);
 //        double temp = getDoubleParam("temp");
-        double temp = parameter().getDouble("temp");
+    double temp = parameter().getDouble("temp");
 //        String un = getParamUnit("temp");
-        String un = parameter().getUnit("temp");
-        if (un.equals("C")) {
+    String un = parameter().getUnit("temp");
+    if (un.equals("C")) {
 //            putResult("temp", temp * 9 / 5 + 32, "temperature", "F");
-            results().put("temp", temp * 9 / 5 + 32, "temperature", "F");
-            return;
-        }
-        throw new ServiceException("missing unit.");
+      results().put("temp", temp * 9 / 5 + 32, "temperature", "F");
+      return;
     }
+    throw new ServiceException("missing unit.");
+  }
 }

src/java/m/example/simpleservice/V2_0_1.java

@@ -33,6 +33,6 @@
     for (double i = 0; i < 5; i++) {
       f[(int)i] = (long)i;
     }
-    putResult("temp", f, "test", "F");
+    results().put("temp", f, "test", "F");
   }
 }

src/java/m/example/stats/V1_0.java

@@ -25,7 +25,7 @@
         
         List<Double> l = new ArrayList<>();
         
-        JSONArray v = getJSONArrayParam("result");
+        JSONArray v = parameter().getJSONArray("result");
         JSONObject ts = v.getJSONObject(0);
         JSONArray a = ts.getJSONArray("data");
         for (int i = 0; i < a.length(); i++) {
@@ -44,15 +44,15 @@
         double q3 = uncertResult.get(3);
         double max = uncertResult.get(4);
         
-        putResult("mean", s.mean(),"Mean");
-        putResult("count", s.count(),"Count");
-        putResult("pop_stdev", s.populationStandardDeviation(), "populationStandardDeviation");
-        putResult("pop_var", s.populationVariance(), "populationVariance");
-        putResult("min", min,"minimum");
-        putResult("q1", q1,"1st Quartile");
-        putResult("median", med,"Median");
-        putResult("q3", q3,"3nd Quartile");
-        putResult("max", max,"maximum");
+        results().put("mean", s.mean(),"Mean");
+        results().put("count", s.count(),"Count");
+        results().put("pop_stdev", s.populationStandardDeviation(), "populationStandardDeviation");
+        results().put("pop_var", s.populationVariance(), "populationVariance");
+        results().put("min", min,"minimum");
+        results().put("q1", q1,"1st Quartile");
+        results().put("median", med,"Median");
+        results().put("q3", q3,"3nd Quartile");
+        results().put("max", max,"maximum");
     }
     
     public static double[] toDoubleArray(List<Double> data) {