Displaying differences for changeset
 
display as  

nbproject/ant-deploy.xml

@@ -20,30 +20,18 @@
     </target>
     <target name="-deploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
         <echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/>
-        <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
-            <classpath>
-                <pathelement path="${tomcat.home}/lib/catalina-ant.jar"/>
-                <pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/>
-                <pathelement path="${tomcat.home}/lib/tomcat-util.jar"/>
-                <pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/>
-            </classpath>
-        </taskdef>
-        <deploy url="${tomcat.url}/manager/text" username="${tomcat.username}"
+        <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
+                 classpath="${tomcat.home}/server/lib/catalina-ant.jar"/>
+        <deploy url="${tomcat.url}/manager" username="${tomcat.username}"
                 password="${tomcat.password}" path="${Context(path)}"
                 war="${deploy.ant.archive}"/>
         <property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/>
     </target>
     <target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
         <echo message="Undeploying ${Context(path)}"/>
-        <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask">
-            <classpath>
-                <pathelement path="${tomcat.home}/lib/catalina-ant.jar"/>
-                <pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/>
-                <pathelement path="${tomcat.home}/lib/tomcat-util.jar"/>
-                <pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/>
-            </classpath>
-        </taskdef>
-        <undeploy url="${tomcat.url}/manager/text" username="${tomcat.username}" 
+        <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
+                classpath="${tomcat.home}/server/lib/catalina-ant.jar"/>
+        <undeploy url="${tomcat.url}/manager" username="${tomcat.username}" 
                   password="${tomcat.password}" path="${Context(path)}"/>
     </target>
 </project>

nbproject/build-impl.xml

@@ -50,6 +50,36 @@
     </target>
     <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" if="dist.ear.dir" name="-do-ear-init"/>
     <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+        <webproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
+        <webproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
+        <webproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
+        <webproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
+        <condition property="platform.javac" value="${platform.home}/bin/javac">
+            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
+        </condition>
+        <property name="platform.javac" value="${platform.javac.tmp}"/>
+        <webproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
+        <condition property="platform.java" value="${platform.home}/bin/java">
+            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
+        </condition>
+        <property name="platform.java" value="${platform.java.tmp}"/>
+        <webproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
+        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
+            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
+        </condition>
+        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
+        <fail unless="platform.home">Must set platform.home</fail>
+        <fail unless="platform.bootcp">Must set platform.bootcp</fail>
+        <fail unless="platform.java">Must set platform.java</fail>
+        <fail unless="platform.javac">Must set platform.javac</fail>
+        <fail if="platform.invalid">
+ The J2SE Platform is not correctly set up.
+ Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 
+ Either open the project in the IDE and setup the Platform with the same name or add it manually.
+ For example like this:
+     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
+  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) 
+  </fail>
         <condition property="have.tests">
             <or>
                 <available file="${test.src.dir}"/>
@@ -191,15 +221,6 @@
                 <length length="0" string="${endorsed.classpath}" when="greater"/>
             </and>
         </condition>
-        <condition else="false" property="jdkBug6558476">
-            <and>
-                <matches pattern="1\.[56]" string="${java.specification.version}"/>
-                <not>
-                    <os family="unix"/>
-                </not>
-            </and>
-        </condition>
-        <property name="javac.fork" value="${jdkBug6558476}"/>
         <condition property="junit.available">
             <or>
                 <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
@@ -294,7 +315,7 @@
                 <property location="${build.dir}/empty" name="empty.dir"/>
                 <mkdir dir="${empty.dir}"/>
                 <mkdir dir="@{apgeneratedsrcdir}"/>
-                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
                     <src>
                         <dirset dir="@{gensrcdir}" erroronmissingdir="false">
                             <include name="*"/>
@@ -331,7 +352,7 @@
             <sequential>
                 <property location="${build.dir}/empty" name="empty.dir"/>
                 <mkdir dir="${empty.dir}"/>
-                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
                     <src>
                         <dirset dir="@{gensrcdir}" erroronmissingdir="false">
                             <include name="*"/>
@@ -408,7 +429,7 @@
             <attribute default="" name="testmethods"/>
             <element name="customize" optional="true"/>
             <sequential>
-                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
+                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true" tempdir="${java.io.tmpdir}">
                     <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
                     <syspropertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -431,7 +452,7 @@
             <element name="customize" optional="true"/>
             <sequential>
                 <property name="run.jvmargs.ide" value=""/>
-                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
+                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
                     <batchtest todir="${build.test.results.dir}">
                         <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
@@ -471,7 +492,7 @@
                     </fileset>
                 </union>
                 <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
-                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="csip-hydrotools" testname="TestNG tests" workingDir="${basedir}">
+                <testng classfilesetref="test.set" failureProperty="tests.failed" jvm="${platform.java}" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="csip-hydrotools" testname="TestNG tests" workingDir="${basedir}">
                     <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
                     <propertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -549,7 +570,7 @@
             <attribute default="" name="testmethods"/>
             <element name="customize" optional="true"/>
             <sequential>
-                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
+                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true" tempdir="${java.io.tmpdir}">
                     <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
                     <syspropertyset>
                         <propertyref prefix="test-sys-prop."/>
@@ -574,7 +595,7 @@
             <element name="customize" optional="true"/>
             <sequential>
                 <property name="run.jvmargs.ide" value=""/>
-                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
+                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
                     <batchtest todir="${build.test.results.dir}">
                         <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
@@ -698,7 +719,7 @@
             <attribute default="${debug.classpath}" name="classpath"/>
             <element name="customize" optional="true"/>
             <sequential>
-                <java classname="@{classname}" fork="true">
+                <java classname="@{classname}" fork="true" jvm="${platform.java}">
                     <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
                     <jvmarg line="${runmain.jvmargs}"/>
                     <classpath>
@@ -730,6 +751,9 @@
                     <classpath>
                         <path path="@{classpath}"/>
                     </classpath>
+                    <bootclasspath>
+                        <path path="${platform.bootcp}"/>
+                    </bootclasspath>
                 </nbjpdastart>
             </sequential>
         </macrodef>
@@ -750,7 +774,9 @@
         </macrodef>
     </target>
     <target name="-init-debug-args">
-        <property name="version-output" value="java version &quot;${ant.java.version}"/>
+        <exec executable="${platform.java}" outputproperty="version-output">
+            <arg value="-version"/>
+        </exec>
         <condition property="have-jdk-older-than-1.4">
             <or>
                 <contains string="${version-output}" substring="java version &quot;1.0"/>
@@ -776,7 +802,7 @@
             <attribute default="${application.args.param}" name="args"/>
             <element name="customize" optional="true"/>
             <sequential>
-                <java classname="@{classname}" fork="true">
+                <java classname="@{classname}" fork="true" jvm="${platform.java}">
                     <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
                     <jvmarg line="${debug-args-line}"/>
                     <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
@@ -1006,48 +1032,14 @@
     </target>
     <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
     <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
-        <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="${libs.groovy-all.classpath}" 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"/>
-        <copyfiles files="${file.reference.httpclient-4.1.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.httpcore-4.1.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.httpmime-4.2.5.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.java-uuid-generator-3.1.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.jedis-2.1.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.json-org.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.oms-all.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"/>
-        <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.velocity-1.7-dep.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" 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>
     <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
-        <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="${libs.groovy-all.classpath}" 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"/>
-        <copyfiles files="${file.reference.httpclient-4.1.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.httpcore-4.1.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.httpmime-4.2.5.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.java-uuid-generator-3.1.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.jedis-2.1.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.json-org.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.oms-all.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.javax.inject.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.velocity-1.7-dep.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" 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"/>
@@ -1213,6 +1205,9 @@
             <sourcepath>
                 <path path="${web.docbase.dir}"/>
             </sourcepath>
+            <bootclasspath>
+                <path path="${platform.bootcp}"/>
+            </bootclasspath>
         </nbjpdaconnect>
     </target>
     <target if="do.display.browser.debug.old" name="debug-display-browser-old">
@@ -1335,7 +1330,7 @@
             -->
     <target depends="init" if="have.sources" name="javadoc-build">
         <mkdir dir="${dist.javadoc.dir}"/>
-        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
             <classpath>
                 <path path="${javac.classpath}:${j2ee.platform.classpath}"/>
             </classpath>

nbproject/project.properties

@@ -33,48 +33,17 @@
 endorsed.classpath=\
     ${libs.javaee-endorsed-api-6.0.classpath}
 excludes=
-file.reference.commons-compress-1.3.jar=../csip-core/lib/commons-compress-1.3.jar
-file.reference.commons-io-2.3.jar=../csip-core/lib/commons-io-2.3.jar
-file.reference.commons-logging-1.1.1.jar=../csip-core/lib/commons-logging-1.1.1.jar
-file.reference.commons-pool-1.6.jar=../csip-core/lib/commons-pool-1.6.jar
-file.reference.httpclient-4.1.3.jar=../csip-core/lib/httpclient-4.1.3.jar
-file.reference.httpcore-4.1.4.jar=../csip-core/lib/httpcore-4.1.4.jar
-file.reference.httpmime-4.2.5.jar=../csip-core/lib/httpmime-4.2.5.jar
-file.reference.java-uuid-generator-3.1.3.jar=../csip-core/lib/java-uuid-generator-3.1.3.jar
-file.reference.javax.inject.jar=../csip-core/lib/javax.inject.jar
-file.reference.jedis-2.1.0.jar=../csip-core/lib/jedis-2.1.0.jar
-file.reference.jersey-media-multipart-2.0.jar=../csip-core/lib/jersey-media-multipart-2.0.jar
-file.reference.json-org.jar=../csip-core/lib/json-org.jar
-file.reference.oms-all.jar=../csip-core/lib/oms-all.jar
-file.reference.velocity-1.7-dep.jar=lib/velocity-1.7-dep.jar
 includes=**
 j2ee.compile.on.save=false
 j2ee.copy.static.files.on.save=false
 j2ee.deploy.on.save=false
 j2ee.platform=1.6-web
-j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar
+j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.4.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/sqljdbc4.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-spdy.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
 j2ee.server.type=Tomcat
 jar.compress=false
 javac.classpath=\
-    ${libs.restapi.classpath}:\
-    ${libs.jaxws21.classpath}:\
-    ${libs.restlib.classpath}:\
-    ${libs.groovy-all.classpath}:\
     ${reference.csip-core.jar}:\
-    ${file.reference.commons-compress-1.3.jar}:\
-    ${file.reference.commons-io-2.3.jar}:\
-    ${file.reference.commons-logging-1.1.1.jar}:\
-    ${file.reference.commons-pool-1.6.jar}:\
-    ${file.reference.httpclient-4.1.3.jar}:\
-    ${file.reference.httpcore-4.1.4.jar}:\
-    ${file.reference.httpmime-4.2.5.jar}:\
-    ${file.reference.java-uuid-generator-3.1.3.jar}:\
-    ${file.reference.jedis-2.1.0.jar}:\
-    ${file.reference.json-org.jar}:\
-    ${file.reference.oms-all.jar}:\
-    ${file.reference.javax.inject.jar}:\
-    ${file.reference.jersey-media-multipart-2.0.jar}:\
-    ${file.reference.velocity-1.7-dep.jar}
+    ${libs.CSIP-Jersey-2.16.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.debug=true
@@ -103,7 +72,7 @@
 javadoc.windowtitle=
 lib.dir=${web.docbase.dir}/WEB-INF/lib
 persistence.xml.dir=${conf.dir}
-platform.active=default_platform
+platform.active=JDK_1.7
 project.csip-core=../csip-core
 reference.csip-core.jar=${project.csip-core}/dist/csip-core.jar
 resource.dir=setup

nbproject/project.xml

@@ -10,81 +10,14 @@
         <data xmlns="http://www.netbeans.org/ns/web-project/3">
             <name>csip-hydrotools</name>
             <minimum-ant-version>1.6.5</minimum-ant-version>
+            <explicit-platform explicit-source-supported="true"/>
             <web-module-libraries>
                 <library dirs="200">
-                    <file>${libs.restapi.classpath}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${libs.jaxws21.classpath}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${libs.restlib.classpath}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${libs.groovy-all.classpath}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
                     <file>${reference.csip-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
                 <library dirs="200">
-                    <file>${file.reference.commons-compress-1.3.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.commons-io-2.3.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.commons-logging-1.1.1.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.commons-pool-1.6.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.httpclient-4.1.3.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.httpcore-4.1.4.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.httpmime-4.2.5.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.java-uuid-generator-3.1.3.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.jedis-2.1.0.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.json-org.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.oms-all.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.javax.inject.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.jersey-media-multipart-2.0.jar}</file>
-                    <path-in-war>WEB-INF/lib</path-in-war>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.velocity-1.7-dep.jar}</file>
+                    <file>${libs.CSIP-Jersey-2.16.classpath}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
             </web-module-libraries>

src/java/bin/lin-amd64/HECRAS_Converter_V31.exe

 

src/java/bin/lin-amd64/NOAA_Converter_V31_non.exe

 

src/java/bin/lin-amd64/NOAA_Converter_V31_sm.exe

 

src/java/bin/lin-amd64/NRCC_Converter_V31_non.exe

 

src/java/bin/lin-amd64/NRCC_Converter_V31_sm.exe

 

src/java/bin/lin-amd64/TR20.exe

 

src/java/m/hydrotools/ApplicationConfig.java

@@ -31,7 +31,6 @@
      * given list with all resources defined in the project.
      */
     private void addRestResourceClasses(Set<Class<?>> resources) {
-        resources.add(csip.AbstractModelService.class);
         resources.add(csip.ArchiveService.class);
         resources.add(csip.CatalogService.class);
         resources.add(csip.ControlService.class);

src/java/m/hydrotools/conv/HECRAS_V1_0.java

@@ -5,10 +5,10 @@
  */
 package m.hydrotools.conv;
 
+import csip.ModelDataService;
 import csip.annotations.*;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
-
 
 /**
  * HECRAS converter for Hydrotools.
@@ -19,8 +19,10 @@
 @Description("HECRAS converter.")
 @Path("m/hecras/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/HECRAS_Converter_V31.exe")
-@OutputFiles({"*.err", "*.inp", "*.dbg", "stdout.txt", "stderr.txt"})
-public class HECRAS_V1_0 extends csip.ExternalModelService {
+@Resources({
+    @Resource(file = "/bin/lin-amd64/HECRAS_Converter_V31.exe", type = ResourceType.EXECUTABLE, id="auto"),
+    @Resource(file = "*.inp *.err *.dbg *stdout.txt *stderr.txt", type = ResourceType.OUTPUT)
+})
+public class HECRAS_V1_0 extends ModelDataService {
     // nothing else to do here :)
 }

src/java/m/hydrotools/conv/NOAA_non_V1_0.java

@@ -5,9 +5,10 @@
  */
 package m.hydrotools.conv;
 
+import csip.ModelDataService;
 import csip.annotations.*;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
 
 
 /**
@@ -19,8 +20,10 @@
 @Description("NOAA converter. (non-smoothing)")
 @Path("m/noaa-non/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/NOAA_Converter_V31_non.exe")
-@OutputFiles({"*.err", "*.inp", "*.dbg", "stdout.txt", "stderr.txt"})
-public class NOAA_non_V1_0 extends csip.ExternalModelService {
+@Resources({
+ @Resource(file="/bin/lin-amd64/NOAA_Converter_V31.exe", type=ResourceType.EXECUTABLE, id="auto"),
+ @Resource(file="*.inp *.err *.dbg *stdout.txt *stderr.txt", type=ResourceType.OUTPUT)
+})
+public class NOAA_non_V1_0 extends ModelDataService {
     // nothing else to do here :)
 }

src/java/m/hydrotools/conv/NOAA_sm_V1_0.java

@@ -5,13 +5,14 @@
  */
 package m.hydrotools.conv;
 
+import csip.ModelDataService;
 import csip.annotations.*;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
 
 
 /**
- * TR20 Service. Plain execution of the original executable.
+ * NOAA converter Service. 
  *
  * @author od
  */
@@ -19,8 +20,10 @@
 @Description("NOAA converter. (smoothing)")
 @Path("m/noaa-sm/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/NOAA_Converter_V31_sm.exe")
-@OutputFiles({"*.err", "*.inp", "*.dbg", "stdout.txt", "stderr.txt"})
-public class NOAA_sm_V1_0 extends csip.ExternalModelService {
+@Resources({
+ @Resource(file="/bin/lin-amd64/NOAA_Converter_V31_sm.exe", type=ResourceType.EXECUTABLE, id="auto"),
+ @Resource(file="*.inp *.err *.dbg *stdout.txt *stderr.txt", type=ResourceType.OUTPUT),
+})
+public class NOAA_sm_V1_0 extends ModelDataService {
     // nothing else to do here :)
 }

src/java/m/hydrotools/conv/NRCC_non_V1_0.java

@@ -5,10 +5,10 @@
  */
 package m.hydrotools.conv;
 
+import csip.ModelDataService;
 import csip.annotations.*;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
-
 
 /**
  * NRCC converter for Hydrotools.
@@ -19,8 +19,10 @@
 @Description("NRCC converter. (non-smoothing)")
 @Path("m/nrcc-non/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/NRCC_Converter_V31_non.exe")
-@OutputFiles({"*.err", "*.inp", "*.dbg", "stdout.txt", "stderr.txt"})
-public class NRCC_non_V1_0 extends csip.ExternalModelService {
+@Resources({
+    @Resource(file = "/bin/lin-amd64/NRCC_Converter_V31_non.exe", type = ResourceType.EXECUTABLE, id = "auto"),
+    @Resource(file = "*.inp *.err *.dbg *stdout.txt *stderr.txt", type = ResourceType.OUTPUT)
+})
+public class NRCC_non_V1_0 extends ModelDataService {
     // nothing else to do here :)
 }

src/java/m/hydrotools/conv/NRCC_sm_V1_0.java

@@ -5,10 +5,10 @@
  */
 package m.hydrotools.conv;
 
+import csip.ModelDataService;
 import csip.annotations.*;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
-
 
 /**
  * NRCC converter.
@@ -19,8 +19,10 @@
 @Description("NRCC converter. (smoothing)")
 @Path("m/nrcc-sm/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/NRCC_Converter_V31_sm.exe")
-@OutputFiles({"*.err", "*.inp", "*.dbg", "stdout.txt", "stderr.txt"})
-public class NRCC_sm_V1_0 extends csip.ExternalModelService {
+@Resources({
+    @Resource(file = "/bin/lin-amd64/NRCC_Converter_V31_sm.exe", type = ResourceType.EXECUTABLE, id = "auto"),
+    @Resource(file = "*.inp *.err *.dbg *stdout.txt *stderr.txt", type = ResourceType.OUTPUT)
+})
+public class NRCC_sm_V1_0 extends ModelDataService {
     // nothing else to do here :)
 }

src/java/m/hydrotools/efh2/V1_0.java

@@ -4,19 +4,16 @@
  */
 package m.hydrotools.efh2;
 
+import csip.ModelDataService;
+import javax.ws.rs.Path;
 import m.efh2.EFH2HydrologyModel;
-import csip.AbstractModelService;
-import java.util.Map;
-import javax.ws.rs.Path;
 import oms3.annotations.Description;
 import oms3.annotations.Name;
-import org.codehaus.jettison.json.*;
-import csip.utils.JSONUtils;
 
 @Name("EFH2")
 @Description("Storm runoff model based on conventions in Engineering Field Handbook.")
 @Path("m/efh2/1.0")
-public class V1_0 extends AbstractModelService {
+public class V1_0 extends ModelDataService {
 
     static final String PRECIP = "precip";
     static final String RUNOFF = "runoff";
@@ -30,31 +27,29 @@
     EFH2HydrologyModel model = new EFH2HydrologyModel();
 
     @Override
-    protected String process() throws Exception {
-        Map<String, JSONObject> m = getParamMap();
-        model.setPrecip(m.get(PRECIP).getDouble(VALUE)); // 14
-        model.setRunoffCurveNumber(m.get(RUNOFFCURVENUMBER).getInt(VALUE)); // 90
-        model.setStormType(m.get(STORMTYPE).getString(VALUE)); // 'I'
-        model.setWatershedLength(m.get(WATERSHEDLENGTH).getDouble(VALUE)); // 1500
-        model.setWatershedSlope(m.get(WATERSHEDSLOPE).getDouble(VALUE)); // 0.5
-        model.simulate();
-        return EXEC_OK; //To change body of generated methods, choose Tools | Templates.
+    protected void preProcess() throws Exception {
+        model.setPrecip(getDoubleParam(PRECIP)); // 14
+        model.setRunoffCurveNumber(getIntParam(RUNOFFCURVENUMBER)); // 90
+        model.setStormType(getStringParam(STORMTYPE)); // 'I'
+        model.setWatershedLength(getDoubleParam(WATERSHEDLENGTH)); // 1500
+        model.setWatershedSlope(getDoubleParam(WATERSHEDSLOPE)); // 0.5
     }
 
     @Override
-    protected JSONArray createResults() throws Exception {
-        JSONArray result = new JSONArray();
+    protected String process() throws Exception {
         model.simulate();
-        result.put(JSONUtils.data(RUNOFF, model.getRunoffQ()));
-        result.put(JSONUtils.data(TIMEOFCONCENTRATION, model.getTimeOfConcentration()));
-        result.put(JSONUtils.data(UNITPEAKDISCHARGE, model.getUnitPeakDischarge()));
-        return result;
+        return EXEC_OK;
     }
 
     @Override
-    protected JSONArray createReport() throws Exception {
-        JSONArray arr = new JSONArray();
-        arr.put(new JSONObject().put("RUNOFF", model.getRunoffQ()));
-        return arr;
+    protected void postProcess() throws Exception {
+        putResult(RUNOFF, model.getRunoffQ());
+        putResult(TIMEOFCONCENTRATION, model.getTimeOfConcentration());
+        putResult(UNITPEAKDISCHARGE, model.getUnitPeakDischarge());
+    }
+
+    @Override
+    protected void report() throws Exception {
+        putReport("RUNOFF", model.getRunoffQ());
     }
 }

src/java/m/hydrotools/efh2/V2_0.java

@@ -5,17 +5,15 @@
  */
 package m.hydrotools.efh2;
 
-import static csip.AbstractModelService.EXEC_FAILED;
-import static csip.AbstractModelService.EXEC_OK;
 import csip.Config;
+import csip.Executable;
 import csip.annotations.*;
+import static csip.annotations.ResourceType.EXECUTABLE;
 import csip.utils.Binaries;
-import csip.utils.JSONUtils;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -27,8 +25,6 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONObject;
 
 /**
  * TR20 Service, efh2 version.
@@ -38,8 +34,11 @@
 @Name("Hydrotools")
 @Description("EFH2 service based on TR20")
 @Path("m/efh2/2.0")
+@Resources({
+    @Resource(file = "/bin/lin-amd64/TR20.exe", type = EXECUTABLE, id = "tr20")
+})
 @Polling(first = 10000, next = 2000)
-public class V2_0 extends csip.AbstractModelService {
+public class V2_0 extends csip.ModelDataService {
 
     // parameter
     static final String WATERSHED_NAME = "watershed_name";
@@ -58,23 +57,23 @@
 
     // internal result string.
     private String[] res;
-    
-    //
-    static String format = "%-10.3f"; 
+
+    static String format = "%-10.3f";
+
+    String st_name;
+
 
     @Override
-    protected String process() throws Exception {
-
+    protected void preProcess() throws Exception {
         // get the parameter
-        Map<String, JSONObject> param = getParamMap();
-        String ws_name = param.get(WATERSHED_NAME).getString(VALUE);
-        double dr_area = param.get(DRAINAGE_AREA).getDouble(VALUE);
-        double cu_number = param.get(CURVE_NUMBER).getDouble(VALUE);
-        double ws_slope = param.get(WATERSHED_SLOPE).getDouble(VALUE);
-        double ws_length = param.get(WATERSHED_LENGTH).getDouble(VALUE);
-        String st_name = param.get(STORM_NAME).getString(VALUE);
-        double ra_depth = param.get(RAIN_DEPTH).getDouble(VALUE);
-        String ra_dist = param.get(RAIN_DIST).getString(VALUE);
+        String ws_name = getStringParam(WATERSHED_NAME);
+        double dr_area = getDoubleParam(DRAINAGE_AREA);
+        double cu_number = getDoubleParam(CURVE_NUMBER);
+        double ws_slope = getDoubleParam(WATERSHED_SLOPE);
+        double ws_length = getDoubleParam(WATERSHED_LENGTH);
+        st_name = getStringParam(STORM_NAME);
+        double ra_depth = getDoubleParam(RAIN_DEPTH);
+        String ra_dist = getStringParam(RAIN_DIST);
 
         // populate the input
         Map<String, Object> m = new HashMap<>();
@@ -83,34 +82,41 @@
         m.put("cn______", String.format(format, cu_number));
         m.put("wl______", String.format(format, ws_length));
         m.put("ws______", String.format(format, ws_slope));
-        m.put("sn______", pad(st_name,10));
+        m.put("sn______", pad(st_name, 10));
         m.put("rde_____", String.format(format, ra_depth));
         m.put("rdi_____", pad(ra_dist, 10));
-        
         createTR20Input(m, new File(getWorkspaceDir(), "TR20.inp"));
+    }
 
-        // run the model
-        run("/bin/lin-amd64/TR20.exe", false);
 
+    @Override
+    protected String process() throws Exception {
+
+        Executable tr20 = getResourceExe("tr20");
+        int ret = tr20.exec();
+        if (ret != 0) {
+            File err = tr20.stderr();
+            if (err.exists()) {
+                return FileUtils.readFileToString(err);
+            }
+        }
         res = parseOutput(st_name, new File(getWorkspaceDir(), "TR20.out"));
-
         if (res.length == 3) {
-            // get the output
             return EXEC_OK;
         } else {
             return "Missing output.";
         }
     }
 
+
     @Override
-    protected JSONArray createResults() throws Exception {
-        JSONArray result = new JSONArray();
-        result.put(JSONUtils.data(RUNOFF_VOLUME, res[0],  "inches"));
-        result.put(JSONUtils.data(PEAK_TIME, res[1], "h"));
-        result.put(JSONUtils.data(PEAK_DISCHARGE, res[2], "cfs"));
-        return result;
+    protected void postProcess() throws Exception {
+        putResult(RUNOFF_VOLUME, res[0], "inches");
+        putResult(PEAK_TIME, res[1], "h");
+        putResult(PEAK_DISCHARGE, res[2], "cfs");
     }
 
+
     static private String[] parseOutput(String st_name, File outFile) throws IOException {
         List<String> out = FileUtils.readLines(outFile);
 
@@ -140,38 +146,6 @@
         return null;
     }
 
-    private String run(String exe, boolean wine) throws Exception {
-        File csip_home = new File(Config.getString("m.csip.dir", "/tmp/csip"));
-        // handle executable
-        File executable = Binaries.unpackResource(exe, csip_home);
-
-        ProcessExecution p = null;
-        List<Object> args = new ArrayList<>();
-        if (wine) {
-            p = new ProcessExecution(new File(Config.getString("wine.path", "/usr/bin/wine")));
-            args.add(executable.toString());
-        } else {
-            p = new ProcessExecution(new File(executable.toString()));
-        }
-
-        p.redirectOutput(new FileWriter(new File(getWorkspaceDir(), "stdout.txt")));
-        p.redirectError(new FileWriter(new File(getWorkspaceDir(), "stderr.txt")));
-        p.setWorkingDirectory(getWorkspaceDir());
-        p.setLogger(LOG);
-
-        LOG.info("running : " + executable.toString());
-        int ret = p.exec();
-        LOG.info("done with exit value: " + ret);
-
-        if (ret == 0) {
-            return EXEC_OK;
-        }
-        File errFile = new File(getWorkspaceDir(), "stderr.txt");
-        if (errFile.exists()) {
-            return FileUtils.readFileToString(errFile);
-        }
-        return EXEC_FAILED + " return code " + ret;
-    }
 
     public static void createTR20Input(Map<String, Object> inp, File file) throws Exception {
         Properties props = new Properties();
@@ -186,6 +160,23 @@
         writer.close();
     }
 
+
+    /**
+     *
+     * @param s
+     * @param len
+     * @return
+     */
+    private static String pad(String s, int len) {
+        if (s.length() == len) {
+            return s;
+        }
+        if (s.length() > len) {
+            return s.substring(0, len);
+        }
+        return String.format("%1$-" + len + "s", s);
+    }
+
 //    public static void main(String[] args) throws IOException, Exception {
 ////        parseOutput("storm1", new File("/od/projects/csip-all/csip-hydrotools/src/java/bin/lin-amd64/TR20.out"));
 //
@@ -214,20 +205,4 @@
 //        System.out.println("'" + pad("ssdddg", 10) + "'");
 //        System.out.println("'" + pad("stormchaserolaf", 10) + "'");
 //    }
-    
-    /**
-     * 
-     * @param s
-     * @param len
-     * @return 
-     */
-    private static String pad(String s, int len) {
-        if (s.length() == len) {
-            return s;
-        }
-        if (s.length() > len) {
-            return s.substring(0, len);
-        }
-        return String.format("%1$-" + len + "s", s);  
-    }
 }

src/java/m/hydrotools/efh2/V2_0.json

@@ -1,6 +1,6 @@
 {
  "metainfo": {
-  "tr20_version": "3.10 tag:May062014",
+  "tr20_version": "3.10 tag:May062014"
  },
  "parameter": [
   {

src/java/m/hydrotools/tr20/V1_0.java

@@ -5,13 +5,10 @@
  */
 package m.hydrotools.tr20;
 
+import csip.ModelDataService;
 import csip.annotations.*;
-import java.io.File;
-import java.io.FilenameFilter;
 import javax.ws.rs.Path;
 import oms3.annotations.*;
-import org.apache.commons.io.filefilter.WildcardFileFilter;
-
 
 /**
  * TR20 Service. Plain execution of the original executable.
@@ -22,16 +19,10 @@
 @Description("TR20")
 @Path("m/tr20/1.0")
 @Polling(first = 10000, next = 2000)
-@ExternalExec(exe = "/bin/lin-amd64/TR20.exe")
-@OutputFiles({"*.out", "*.hyd", "*.err", "*.dbg", "stdout.txt", "stderr.txt"})
-public class V1_0 extends csip.ExternalModelService {
+@Resources({
+ @Resource(file="/bin/lin-amd64/TR20.exe", type=ResourceType.EXECUTABLE, id="auto"),
+ @Resource(file="*.out *.hyd *.err *.dbg stdout.txt stderr.txt", type=ResourceType.OUTPUT),
+})
+public class V1_0 extends ModelDataService {
 
-    @Override
-    protected String[] getExeArguments() {
-        File[] f = getWorkspaceDir().listFiles((FilenameFilter) new WildcardFileFilter("*.inp"));
-        if (f == null || f.length == 0) {
-            return null;
-        }
-        return new String[] {f[0].getName()};
-    }
 }

src/java/m/hydrotools/tr20/V2_0.java

@@ -5,10 +5,17 @@
  */
 package m.hydrotools.tr20;
 
+import csip.Executable;
+import csip.ModelDataService;
+import csip.ServiceException;
 import csip.annotations.*;
+import static csip.annotations.ResourceType.EXECUTABLE;
+import static csip.annotations.ResourceType.OUTPUT;
+import java.io.File;
+import java.util.List;
+import javax.ws.rs.Path;
 import oms3.annotations.*;
-import javax.ws.rs.Path;
-
+import org.apache.commons.io.FileUtils;
 
 /**
  * TR20 Service. Execution with converters.
@@ -19,18 +26,67 @@
 @Description("TR20 with converters.")
 @Path("m/tr20/2.0")
 @Polling(first = 10000, next = 2000)
-public class V2_0 extends csip.AbstractModelService {
+@Resources({
+    @Resource(file = "/bin/lin-amd64/TR20.exe", type = ResourceType.EXECUTABLE, id = "tr20"),
+    @Resource(file = "/bin/lin-amd64/HECRAS_Converter_V31.exe", type = EXECUTABLE, id = "hecras"),
+    @Resource(file = "/bin/lin-amd64/NOAA_Converter_V31.exe", type = EXECUTABLE, id = "noaa"),
+    @Resource(file = "/bin/lin-amd64/NOAA_Converter_V31_sm.exe", type = EXECUTABLE, id = "noaa_sm"),
+    @Resource(file = "/bin/lin-amd64/NRCC_Converter_V31_non.exe", type = EXECUTABLE, id = "nrcc"),
+    @Resource(file = "/bin/lin-amd64/NRCC_Converter_V31_sm.exe", type = EXECUTABLE, id = "nrcc_sm"),
+    @Resource(file = "*.out *.hyd *.err *.dbg stdout.txt stderr.txt", type = OUTPUT)
+})
+
+public class V2_0 extends ModelDataService {
+
+    String conv;
+    String tr20name;
+    String convinput;
+
+
+    @Override
+    protected void preProcess() throws Exception {
+        conv = getStringParam("conv");
+        tr20name = getStringParam("tr20_input");
+        convinput = getStringParam("conv_input");
+    }
+
+    // hecras nrcc: txt, 
+    // noaa csv
+    // all produce inp.
 
     @Override
     protected String process() throws Exception {
-        
-        // 1. Get the 
-        
-        // execute TR20.exe
-        
+        Executable e = getResourceExe(conv);
+        int ret = e.exec();
+        if (ret != 0) {
+            return " Converter error " + conv;
+        }
+
+        File conv_output = new File(getWorkspaceDir(), convinput.substring(0, convinput.indexOf('.')) + ".inp");
+        if (!conv_output.exists()) {
+            throw new ServiceException("No converter output.");
+        }
+
+        List<String> inp = FileUtils.readLines(conv_output);
+        inp.remove(0);
+        inp.remove(0);
+        inp.remove(0);
+
+        FileUtils.writeLines(getFileInput(tr20name), inp, true);
+
+        // merge the input files.
+        Executable e1 = getResourceExe("tr20");
+        e1.setArguments(tr20name);
+        ret = e1.exec();
+        if (ret != 0) {
+            return " TR20 error " + conv;
+        }
         return EXEC_OK;
     }
-    
-    
-    // convert services.
+
+
+    @Override
+    protected void postProcess() throws Exception {
+        super.postProcess(); //To change body of generated methods, choose Tools | Templates.
+    }
 }

src/java/m/hydrotools/tr20/V2_0.json

@@ -1,8 +1,17 @@
 {
-    "metainfo": {
-        "tr20_version": "3.10 tag:May062014",
-        "attachments":  "TR20.fil input-output_test.inp" 
-    },
-    "parameter": []
-    
+    "metainfo": { },
+    "parameter": [
+       {
+        "name": "conv",
+        "value": "noaa" 
+       },
+       {
+        "name": "tr20_input",
+        "value": "inputfile.inp"
+       },
+       {
+        "name": "conv_input",
+        "value": "noaafile.csv"
+       }
+    ]
 }
\ No newline at end of file

test/HTTest.java

@@ -15,6 +15,6 @@
 
     @Test
     public void rz() throws Exception {
-        Assert.assertTrue(ServiceTest.run("test/json-tests").getFailed() == 0);
+        Assert.assertTrue(ServiceTest.run("test/json-tests/tr20").getFailed() == 0);
     }
 }

test/config.json

@@ -1,12 +1,9 @@
 {
-//    "redis.session.server":"172.1.6.29",
-//    "redis.archive.server":"172.1.6.29",
-//    "redis.cache.server":  "172.1.6.29",
-    "lamps.output" : "output/results",
-    "lamps.data": "/mnt/csip-lamps/data",
-     "m.bin.dir": "/mnt/csip/bin",
-     "m.csip.dir": "/mnt/csip",
-     "m.work.dir": "/mnt/csip/work",
-     "m.results.dir": "/mnt/csip/results",
-     "m.cache.dir": "/mnt/csip/cache"
+ "lamps.output": "output/results",
+ "lamps.data": "/mnt/csip-lamps/data",
+ "m.bin.dir": "/mnt/csip/bin",
+ "m.csip.dir": "/mnt/csip",
+ "m.work.dir": "/mnt/csip/work",
+ "m.results.dir": "/mnt/csip/results",
+ "m.cache.dir": "/mnt/csip/cache"
 }

test/json-tests/tr20/service.properties

@@ -3,7 +3,8 @@
 # and open the template in the editor.
 
 # service endpoint, required
-url=http://csip.engr.colostate.edu:8087/csip-hydrotools/m/tr20/1.0
+#url=http://csip.engr.colostate.edu:8087/csip-hydrotools/m/tr20/1.0
+url=http://locahost:8080/csip-hydrotools/m/tr20/1.0
 
 # number of concurrent tests, optional, defaults to 1
 concurrency=1