@@ -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=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) |
+ or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> 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 "${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 "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> |
@@ -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 |
@@ -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> |
@@ -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()); |
} |
} |
@@ -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); |
- } |
} |
@@ -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. |
+ } |
} |