Displaying differences for changeset
 
display as  

nbproject/build-impl.xml

@@ -1009,8 +1009,8 @@
         <copyfiles files="${libs.restapi.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${libs.jaxws21.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${libs.restlib.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.commons-compress-1.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.csip-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.commons-compress-1.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.commons-io-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.commons-logging-1.1.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.commons-pool-1.6.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
@@ -1027,6 +1027,9 @@
         <copyfiles files="${file.reference.commons-math-2.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.htmlunit-2.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.htmlunit-core-js-2.8.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jersey-media-multipart-2.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.mimepull-1.9.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.javax.inject.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <mkdir dir="${build.web.dir}/META-INF"/>
         <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
@@ -1034,8 +1037,8 @@
         <copyfiles files="${libs.restapi.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${libs.jaxws21.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${libs.restlib.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.commons-compress-1.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${reference.csip-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.commons-compress-1.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.commons-io-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.commons-logging-1.1.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.commons-pool-1.6.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
@@ -1052,6 +1055,9 @@
         <copyfiles files="${file.reference.commons-math-2.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.htmlunit-2.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.htmlunit-core-js-2.8.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.jersey-media-multipart-2.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.mimepull-1.9.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.javax.inject.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
     </target>
     <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
         <delete dir="${build.web.dir}/WEB-INF/lib"/>

src/java/m/cfa/Baseflow_V1_0.java

@@ -6,7 +6,6 @@
 
 import cfa.guiBaseflow_Model;
 import csip.AbstractModelService;
-import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import javax.ws.rs.Path;
@@ -14,10 +13,10 @@
 import oms3.annotations.Name;
 import oms3.annotations.VersionInfo;
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import java.io.File;
 
 @Name("baseflow")
 @Description("baseflow")
@@ -55,8 +54,8 @@
     }
     
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {model.getGraph(), model.getBaseflow_out().getName()};
+    public File[] postprocess() throws Exception {
+        return new File[] {new File(model.getGraph()), model.getBaseflow_out()};
     }
     
     @Override

src/java/m/cfa/Download_V1_0.java

@@ -6,17 +6,16 @@
 
 import cfa.guiDownload_Data;
 import csip.AbstractModelService;
-import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import javax.ws.rs.Path;
 import oms3.annotations.Description;
 import oms3.annotations.Name;
 import oms3.annotations.VersionInfo;
-import org.apache.commons.io.IOUtils;
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import java.io.File;
 
 @Name("download")
 @Description("download")
@@ -47,8 +46,8 @@
     }
     
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {model.getOutput().getName()};
+    public File[] postprocess() throws Exception {
+        return new File[] {model.getOutput()};
     }
     
     @Override

src/java/m/cfa/Drought_V1_0.java

@@ -16,6 +16,8 @@
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import csip.ServiceUtils;
+import java.io.File;
 
 @Name("drought")
 @Description("drought")
@@ -46,7 +48,7 @@
                 model.setUserData(m.get("user_data").getString(ServiceConst.VALUE));
                 model.setMergeDatasets(m.get("merge_datasets").getBoolean(ServiceConst.VALUE));
                 model.setMergeMethod(m.get("merge_method").getString(ServiceConst.VALUE));
-                
+
                 model.run();
                 return ServiceConst.EXEC_OK;
             }
@@ -54,24 +56,25 @@
     }
 
     @Override
-    public String[] postprocess() throws Exception {
+    public File[] postprocess() throws Exception {
          //This result array is more complex because drought can pass back 1, 2, or 5 graphs
-        
-        if(model.getAction().equalsIgnoreCase("all")){
-            return model.get_all_output();
 
-        }else if(model.getAction().equalsIgnoreCase("optimizeModel")){
-            return model.get_optimizeModel_output();
-            
-        }else{
-            return new String[] {model.get_parameter_output()};
+        if (model.getAction().equalsIgnoreCase("all")) {
+
+            return ServiceUtils.toFiles(model.get_all_output());
+
+        } else if (model.getAction().equalsIgnoreCase("optimizeModel")) {
+            return ServiceUtils.toFiles(model.get_optimizeModel_output());
+
+        } else {
+            return ServiceUtils.toFiles(model.get_parameter_output());
         }
     }
-    
+
     @Override
     protected JSONArray createResults() throws Exception {
         //This result array is more complex because drought can pass back 1, 2, or 5 graphs
-        if(model.getAction().equalsIgnoreCase("all")){
+        if (model.getAction().equalsIgnoreCase("all")) {
             String[] graphs = model.get_all_output();
             String graph1 = graphs[0];
             String graph2 = graphs[1];
@@ -91,9 +94,9 @@
             result.put(JSONUtils.data("graph5", graph5));
             result.put(JSONUtils.data("output", output));
             return result;
-        }else if(model.getAction().equalsIgnoreCase("optimizeModel")){
+        } else if (model.getAction().equalsIgnoreCase("optimizeModel")) {
             String[] graphs = model.get_optimizeModel_output();
-            if(model.getThetaValues().equalsIgnoreCase("")){
+            if (model.getThetaValues().equalsIgnoreCase("")) {
                 //The drought model is AR(p) so only 1 graph
                 String graph1 = graphs[0];
                 String output = FileUtils.readFileToString(model.getResult());
@@ -105,7 +108,7 @@
                 result.put(JSONUtils.data("graph1", graph1));
                 result.put(JSONUtils.data("output", output));
                 return result;
-            }else{
+            } else {
                 //The drought model used is ARMA(p,q) so only 2 graphs
                 String graph1 = graphs[0];
                 String graph2 = graphs[1];
@@ -120,7 +123,7 @@
                 result.put(JSONUtils.data("output", output));
                 return result;
             }
-        }else{
+        } else {
             //Return only one graph and updated parameter info
             String graph1 = model.get_parameter_output();
             String output = FileUtils.readFileToString(model.getResult());

src/java/m/cfa/DurationCurve_V1_0.java

@@ -16,6 +16,8 @@
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import csip.ServiceUtils;
+import java.io.File;
 
 @Name("durationcurve")
 @Description("durationcurve")
@@ -55,8 +57,8 @@
     }
 
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {model.getGraph(), model.getDurationCurve_results().getName()};
+    public File[] postprocess() throws Exception {
+        return ServiceUtils.toFiles(model.getGraph(), model.getDurationCurve_results().getName());
     }
 
     @Override

src/java/m/cfa/Flood_V1_0.java

@@ -16,6 +16,8 @@
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import csip.ServiceUtils;
+import java.io.File;
 
 @Name("flood")
 @Description("flood")
@@ -55,8 +57,8 @@
     }
 
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {model.getGraph()};
+    public File[] postprocess() throws Exception {
+        return ServiceUtils.toFiles(model.getGraph());
     }
 
     @Override

src/java/m/cfa/LOADEST_V1_0.java

@@ -13,6 +13,7 @@
 import org.codehaus.jettison.json.*;
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
+import java.io.File;
 
 @Name("loadest")
 @Description("loadest")
@@ -53,14 +54,14 @@
     }
 
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {//Results files needed for JavaScript graphing with JHighCharts
-                             model.getDailyTimeseries().getName(),
-                             model.getDailyBoxplot().getName(),
-                             model.getMonthlyTimeseries().getName(),
-                             model.getMonthlyBoxplot().getName(),
-                             model.getYearlyTimeseries().getName(),
-                             model.getYearlyBoxplot().getName(),
+    public File[] postprocess() throws Exception {
+        return new File[] {//Results files needed for JavaScript graphing with JHighCharts
+                             model.getDailyTimeseries(),
+                             model.getDailyBoxplot(),
+                             model.getMonthlyTimeseries(),
+                             model.getMonthlyBoxplot(),
+                             model.getYearlyTimeseries(),
+                             model.getYearlyBoxplot(),
                              //Graphs no longer handled with Java
 //                             model.getDailyGraph(),
 //                             model.getDailyBoxplotGraph(),
@@ -69,9 +70,9 @@
 //                             model.getYearlyGraph(),
 //                             model.getYearlyBoxplotGraph(),
                              //Results files desired by the user as output of the model
-                             model.getOutputResult1().getName(),
-                             model.getOutputResult2().getName(),
-                             model.getOutputResult3().getName()};
+                             model.getOutputResult1(),
+                             model.getOutputResult2(),
+                             model.getOutputResult3()};
     }
     
     @Override

src/java/m/cfa/Timeseries_V1_0.java

@@ -12,6 +12,8 @@
 import csip.utils.JSONUtils;
 import csip.ServiceConst;
 import csip.AbstractModelService;
+import csip.ServiceUtils;
+import java.io.File;
 
 @Name("timeseries")
 @Description("timeseries")
@@ -49,8 +51,8 @@
 
     
     @Override
-    public String[] postprocess() throws Exception {
-        return new String[] {model.getGraph(), model.getBoxplot()};
+    public File[] postprocess() throws Exception {
+        return ServiceUtils.toFiles(model.getGraph(), model.getBoxplot());
     }
      
     @Override