@@ -1,1467 +1,1453 @@ |
-<?xml version="1.0" encoding="UTF-8"?> |
-<!-- |
- *** GENERATED FROM project.xml - DO NOT EDIT *** |
- *** EDIT ../build.xml INSTEAD *** |
- |
- For the purpose of easier reading the script |
- is divided into following sections: |
- - initialization |
- - compilation |
- - dist |
- - execution |
- - debugging |
- - javadoc |
- - test compilation |
- - test execution |
- - test debugging |
- - cleanup |
- |
- --> |
-<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="csip-r2-impl"> |
- <import file="rest-build.xml"/> |
- <import file="ant-deploy.xml"/> |
- <fail message="Please build using Ant 1.7.1 or higher."> |
- <condition> |
- <not> |
- <antversion atleast="1.7.1"/> |
- </not> |
- </condition> |
- </fail> |
- <target depends="dist,javadoc" description="Build whole project." name="default"/> |
- <!-- |
- INITIALIZATION SECTION |
- --> |
- <target name="-pre-init"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="-pre-init" name="-init-private"> |
- <property file="nbproject/private/private.properties"/> |
- </target> |
- <target depends="-pre-init,-init-private" name="-init-user"> |
- <property file="${user.properties.file}"/> |
- <!-- The two properties below are usually overridden --> |
- <!-- by the active platform. Just a fallback. --> |
- <property name="default.javac.source" value="1.4"/> |
- <property name="default.javac.target" value="1.4"/> |
- </target> |
- <target depends="-pre-init,-init-private,-init-user" name="-init-project"> |
- <property file="nbproject/project.properties"/> |
- </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"> |
- <condition property="have.tests"> |
- <or> |
- <available file="${test.src.dir}"/> |
- </or> |
- </condition> |
- <condition property="have.sources"> |
- <or> |
- <available file="${src.dir}"/> |
- </or> |
- </condition> |
- <condition property="netbeans.home+have.tests"> |
- <and> |
- <isset property="netbeans.home"/> |
- <isset property="have.tests"/> |
- </and> |
- </condition> |
- <condition property="no.javadoc.preview"> |
- <isfalse value="${javadoc.preview}"/> |
- </condition> |
- <property name="javac.compilerargs" value=""/> |
- <condition property="no.deps"> |
- <and> |
- <istrue value="${no.dependencies}"/> |
- </and> |
- </condition> |
- <condition property="no.dist.ear.dir"> |
- <not> |
- <isset property="dist.ear.dir"/> |
- </not> |
- </condition> |
- <property name="build.web.excludes" value="${build.classes.excludes}"/> |
- <condition property="do.compile.jsps"> |
- <istrue value="${compile.jsps}"/> |
- </condition> |
- <condition property="do.debug.server"> |
- <or> |
- <not> |
- <isset property="debug.server"/> |
- </not> |
- <istrue value="${debug.server}"/> |
- <and> |
- <not> |
- <istrue value="${debug.server}"/> |
- </not> |
- <not> |
- <istrue value="${debug.client}"/> |
- </not> |
- </and> |
- </or> |
- </condition> |
- <condition property="do.debug.client"> |
- <istrue value="${debug.client}"/> |
- </condition> |
- <condition property="do.display.browser"> |
- <istrue value="${display.browser}"/> |
- </condition> |
- <condition property="do.display.browser.debug.old"> |
- <and> |
- <isset property="do.display.browser"/> |
- <not> |
- <isset property="do.debug.client"/> |
- </not> |
- <not> |
- <isset property="browser.context"/> |
- </not> |
- </and> |
- </condition> |
- <condition property="do.display.browser.debug"> |
- <and> |
- <isset property="do.display.browser"/> |
- <not> |
- <isset property="do.debug.client"/> |
- </not> |
- <isset property="browser.context"/> |
- </and> |
- </condition> |
- <available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/> |
- <available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/> |
- <condition property="do.war.package.with.custom.manifest"> |
- <isset property="has.custom.manifest"/> |
- </condition> |
- <condition property="do.war.package.without.custom.manifest"> |
- <not> |
- <isset property="has.custom.manifest"/> |
- </not> |
- </condition> |
- <condition property="do.tmp.war.package.with.custom.manifest"> |
- <and> |
- <isset property="has.custom.manifest"/> |
- <or> |
- <isfalse value="${directory.deployment.supported}"/> |
- <isset property="dist.ear.dir"/> |
- </or> |
- </and> |
- </condition> |
- <condition property="do.tmp.war.package.without.custom.manifest"> |
- <and> |
- <not> |
- <isset property="has.custom.manifest"/> |
- </not> |
- <or> |
- <isfalse value="${directory.deployment.supported}"/> |
- <isset property="dist.ear.dir"/> |
- </or> |
- </and> |
- </condition> |
- <condition property="do.tmp.war.package"> |
- <or> |
- <isfalse value="${directory.deployment.supported}"/> |
- <isset property="dist.ear.dir"/> |
- </or> |
- </condition> |
- <property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/> |
- <condition else="" property="application.args.param" value="${application.args}"> |
- <and> |
- <isset property="application.args"/> |
- <not> |
- <equals arg1="${application.args}" arg2="" trim="true"/> |
- </not> |
- </and> |
- </condition> |
- <property name="source.encoding" value="${file.encoding}"/> |
- <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> |
- <and> |
- <isset property="javadoc.encoding"/> |
- <not> |
- <equals arg1="${javadoc.encoding}" arg2=""/> |
- </not> |
- </and> |
- </condition> |
- <property name="javadoc.encoding.used" value="${source.encoding}"/> |
- <property name="includes" value="**"/> |
- <property name="excludes" value=""/> |
- <property name="runmain.jvmargs" value=""/> |
- <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> |
- <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> |
- <and> |
- <isset property="endorsed.classpath"/> |
- <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}"/> |
- <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> |
- </or> |
- </condition> |
- <condition property="testng.available"> |
- <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> |
- </condition> |
- <condition property="junit+testng.available"> |
- <and> |
- <istrue value="${junit.available}"/> |
- <istrue value="${testng.available}"/> |
- </and> |
- </condition> |
- <condition else="testng" property="testng.mode" value="mixed"> |
- <istrue value="${junit+testng.available}"/> |
- </condition> |
- <condition else="" property="testng.debug.mode" value="-mixed"> |
- <istrue value="${junit+testng.available}"/> |
- </condition> |
- </target> |
- <target depends="init" name="-init-cos" unless="deploy.on.save"> |
- <condition property="deploy.on.save" value="true"> |
- <or> |
- <istrue value="${j2ee.deploy.on.save}"/> |
- <istrue value="${j2ee.compile.on.save}"/> |
- </or> |
- </condition> |
- </target> |
- <target name="-post-init"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> |
- <fail unless="src.dir">Must set src.dir</fail> |
- <fail unless="test.src.dir">Must set test.src.dir</fail> |
- <fail unless="build.dir">Must set build.dir</fail> |
- <fail unless="build.web.dir">Must set build.web.dir</fail> |
- <fail unless="build.generated.dir">Must set build.generated.dir</fail> |
- <fail unless="dist.dir">Must set dist.dir</fail> |
- <fail unless="build.classes.dir">Must set build.classes.dir</fail> |
- <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> |
- <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> |
- <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> |
- <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> |
- <fail unless="dist.war">Must set dist.war</fail> |
- <condition property="missing.j2ee.server.home"> |
- <and> |
- <matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/> |
- <not> |
- <isset property="j2ee.server.home"/> |
- </not> |
- </and> |
- </condition> |
- <fail if="missing.j2ee.server.home"> |
-The Java EE server classpath is not correctly set up - server home directory is missing. |
-Either open the project in the IDE and assign the server or setup the server classpath manually. |
-For example like this: |
- ant -Dj2ee.server.home=<app_server_installation_directory> |
- </fail> |
- <fail unless="j2ee.platform.classpath"> |
-The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. |
-Either open the project in the IDE and assign the server or setup the server classpath manually. |
-For example like this: |
- ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) |
-or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) |
- </fail> |
- </target> |
- <target name="-init-macrodef-property"> |
- <macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute name="name"/> |
- <attribute name="value"/> |
- <sequential> |
- <property name="@{name}" value="${@{value}}"/> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> |
- <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${src.dir}" name="srcdir"/> |
- <attribute default="${build.classes.dir}" name="destdir"/> |
- <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
- <attribute default="${javac.processorpath}" name="processorpath"/> |
- <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="${javac.debug}" name="debug"/> |
- <attribute default="${empty.dir}" name="gensrcdir"/> |
- <element name="customize" optional="true"/> |
- <sequential> |
- <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}"> |
- <src> |
- <dirset dir="@{gensrcdir}" erroronmissingdir="false"> |
- <include name="*"/> |
- </dirset> |
- </src> |
- <classpath> |
- <path path="@{classpath}"/> |
- </classpath> |
- <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <compilerarg line="${javac.compilerargs}"/> |
- <compilerarg value="-processorpath"/> |
- <compilerarg path="@{processorpath}:${empty.dir}"/> |
- <compilerarg line="${ap.processors.internal}"/> |
- <compilerarg value="-s"/> |
- <compilerarg path="@{apgeneratedsrcdir}"/> |
- <compilerarg line="${ap.proc.none.internal}"/> |
- <customize/> |
- </javac> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> |
- <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${src.dir}" name="srcdir"/> |
- <attribute default="${build.classes.dir}" name="destdir"/> |
- <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
- <attribute default="${javac.processorpath}" name="processorpath"/> |
- <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="${javac.debug}" name="debug"/> |
- <attribute default="${empty.dir}" name="gensrcdir"/> |
- <element name="customize" optional="true"/> |
- <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}"> |
- <src> |
- <dirset dir="@{gensrcdir}" erroronmissingdir="false"> |
- <include name="*"/> |
- </dirset> |
- </src> |
- <classpath> |
- <path path="@{classpath}"/> |
- </classpath> |
- <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <compilerarg line="${javac.compilerargs}"/> |
- <customize/> |
- </javac> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> |
- <macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${src.dir}" name="srcdir"/> |
- <attribute default="${build.classes.dir}" name="destdir"/> |
- <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
- <sequential> |
- <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> |
- <classpath> |
- <path path="@{classpath}"/> |
- </classpath> |
- </depend> |
- </sequential> |
- </macrodef> |
- <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${build.classes.dir}" name="destdir"/> |
- <sequential> |
- <fail unless="javac.includes">Must set javac.includes</fail> |
- <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> |
- <path> |
- <filelist dir="@{destdir}" files="${javac.includes}"/> |
- </path> |
- <globmapper from="*.java" to="*.class"/> |
- </pathconvert> |
- <tempfile deleteonexit="true" property="javac.includesfile.binary"/> |
- <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> |
- <delete> |
- <files includesfile="${javac.includesfile.binary}"/> |
- </delete> |
- <delete file="${javac.includesfile.binary}"/> |
- </sequential> |
- </macrodef> |
- </target> |
- <target if="${junit.available}" name="-init-macrodef-junit-init"> |
- <condition else="false" property="nb.junit.batch" value="true"> |
- <and> |
- <istrue value="${junit.available}"/> |
- <not> |
- <isset property="test.method"/> |
- </not> |
- </and> |
- </condition> |
- <condition else="false" property="nb.junit.single" value="true"> |
- <and> |
- <istrue value="${junit.available}"/> |
- <isset property="test.method"/> |
- </and> |
- </condition> |
- </target> |
- <target name="-init-test-properties"> |
- <property name="test.binaryincludes" value="<nothing>"/> |
- <property name="test.binarytestincludes" value=""/> |
- <property name="test.binaryexcludes" value=""/> |
- </target> |
- <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> |
- <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <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}"> |
- <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <formatter type="brief" usefile="false"/> |
- <formatter type="xml"/> |
- <jvmarg value="-ea"/> |
- <customize/> |
- </junit> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> |
- <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <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}"> |
- <batchtest todir="${build.test.results.dir}"> |
- <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> |
- <filename name="@{testincludes}"/> |
- </fileset> |
- <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> |
- <filename name="${test.binarytestincludes}"/> |
- </fileset> |
- </batchtest> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <formatter type="brief" usefile="false"/> |
- <formatter type="xml"/> |
- <jvmarg value="-ea"/> |
- <jvmarg line="${run.jvmargs.ide}"/> |
- <customize/> |
- </junit> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> |
- <target if="${testng.available}" name="-init-macrodef-testng"> |
- <macrodef name="testng" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <element name="customize" optional="true"/> |
- <sequential> |
- <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> |
- <isset property="test.method"/> |
- </condition> |
- <union id="test.set"> |
- <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> |
- <filename name="@{testincludes}"/> |
- </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-r2" testname="TestNG tests" workingDir="${basedir}"> |
- <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> |
- <propertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </propertyset> |
- <customize/> |
- </testng> |
- </sequential> |
- </macrodef> |
- </target> |
- <target name="-init-macrodef-test-impl"> |
- <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <element implicit="true" name="customize" optional="true"/> |
- <sequential> |
- <echo>No tests executed.</echo> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> |
- <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <element implicit="true" name="customize" optional="true"/> |
- <sequential> |
- <webproject2:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
- <customize/> |
- </webproject2:junit> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> |
- <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <element implicit="true" name="customize" optional="true"/> |
- <sequential> |
- <webproject2:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
- <customize/> |
- </webproject2:testng> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> |
- <macrodef name="test" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <sequential> |
- <webproject2:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
- <customize> |
- <classpath> |
- <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> |
- </classpath> |
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <jvmarg line="${runmain.jvmargs}"/> |
- </customize> |
- </webproject2:test-impl> |
- </sequential> |
- </macrodef> |
- </target> |
- <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> |
- <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <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}"> |
- <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <formatter type="brief" usefile="false"/> |
- <formatter type="xml"/> |
- <jvmarg value="-ea"/> |
- <jvmarg line="${debug-args-line}"/> |
- <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> |
- <customize/> |
- </junit> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> |
- <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <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}"> |
- <batchtest todir="${build.test.results.dir}"> |
- <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> |
- <filename name="@{testincludes}"/> |
- </fileset> |
- <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> |
- <filename name="${test.binarytestincludes}"/> |
- </fileset> |
- </batchtest> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <formatter type="brief" usefile="false"/> |
- <formatter type="xml"/> |
- <jvmarg value="-ea"/> |
- <jvmarg line="${run.jvmargs.ide}"/> |
- <jvmarg line="${debug-args-line}"/> |
- <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> |
- <customize/> |
- </junit> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> |
- <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <element implicit="true" name="customize" optional="true"/> |
- <sequential> |
- <webproject2:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
- <customize/> |
- </webproject2:junit-debug> |
- </sequential> |
- </macrodef> |
- </target> |
- <target if="${testng.available}" name="-init-macrodef-testng-debug"> |
- <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${main.class}" name="testClass"/> |
- <attribute default="" name="testMethod"/> |
- <element name="customize2" optional="true"/> |
- <sequential> |
- <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> |
- <isset property="test.method"/> |
- </condition> |
- <condition else="-suitename csip-r2 -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> |
- <matches pattern=".*\.xml" string="@{testClass}"/> |
- </condition> |
- <delete dir="${build.test.results.dir}" quiet="true"/> |
- <mkdir dir="${build.test.results.dir}"/> |
- <webproject1:debug args="${testng.cmd.args}" classname="org.testng.TestNG" classpath="${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}"> |
- <customize> |
- <customize2/> |
- <jvmarg value="-ea"/> |
- <arg line="${testng.debug.mode}"/> |
- <arg line="-d ${build.test.results.dir}"/> |
- <arg line="-listener org.testng.reporters.VerboseReporter"/> |
- </customize> |
- </webproject1:debug> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> |
- <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${main.class}" name="testClass"/> |
- <attribute default="" name="testMethod"/> |
- <element implicit="true" name="customize2" optional="true"/> |
- <sequential> |
- <webproject2:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> |
- <customize2/> |
- </webproject2:testng-debug> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> |
- <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <attribute default="${main.class}" name="testClass"/> |
- <attribute default="" name="testMethod"/> |
- <sequential> |
- <webproject2:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
- <customize> |
- <classpath> |
- <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> |
- </classpath> |
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <jvmarg line="${runmain.jvmargs}"/> |
- </customize> |
- </webproject2:test-debug-impl> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> |
- <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
- <attribute default="${includes}" name="includes"/> |
- <attribute default="${excludes}" name="excludes"/> |
- <attribute default="**" name="testincludes"/> |
- <attribute default="" name="testmethods"/> |
- <attribute default="${main.class}" name="testClass"/> |
- <attribute default="" name="testMethod"/> |
- <sequential> |
- <webproject2:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> |
- <customize2> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- </customize2> |
- </webproject2:testng-debug-impl> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> |
- <target name="-init-macrodef-java"> |
- <macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute default="${main.class}" name="classname"/> |
- <attribute default="${debug.classpath}" name="classpath"/> |
- <element name="customize" optional="true"/> |
- <sequential> |
- <java classname="@{classname}" fork="true"> |
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <jvmarg line="${runmain.jvmargs}"/> |
- <classpath> |
- <path path="@{classpath}:${j2ee.platform.classpath}"/> |
- </classpath> |
- <syspropertyset> |
- <propertyref prefix="run-sys-prop."/> |
- <mapper from="run-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <customize/> |
- </java> |
- </sequential> |
- </macrodef> |
- </target> |
- <target name="-init-macrodef-nbjsdebug"> |
- <macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute default="${client.url}" name="webUrl"/> |
- <sequential> |
- <nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/> |
- </sequential> |
- </macrodef> |
- </target> |
- <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> |
- <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute default="${main.class}" name="name"/> |
- <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
- <sequential> |
- <nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}"> |
- <classpath> |
- <path path="@{classpath}"/> |
- </classpath> |
- </nbjpdastart> |
- </sequential> |
- </macrodef> |
- <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute default="${build.classes.dir}" name="dir"/> |
- <sequential> |
- <nbjpdareload> |
- <fileset dir="@{dir}" includes="${fix.classes}"> |
- <include name="${fix.includes}*.class"/> |
- </fileset> |
- </nbjpdareload> |
- </sequential> |
- </macrodef> |
- <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1"> |
- <sequential> |
- <nbjpdaappreloaded/> |
- </sequential> |
- </macrodef> |
- </target> |
- <target name="-init-debug-args"> |
- <property name="version-output" value="java version "${ant.java.version}"/> |
- <condition property="have-jdk-older-than-1.4"> |
- <or> |
- <contains string="${version-output}" substring="java version "1.0"/> |
- <contains string="${version-output}" substring="java version "1.1"/> |
- <contains string="${version-output}" substring="java version "1.2"/> |
- <contains string="${version-output}" substring="java version "1.3"/> |
- </or> |
- </condition> |
- <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> |
- <istrue value="${have-jdk-older-than-1.4}"/> |
- </condition> |
- <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> |
- <os family="windows"/> |
- </condition> |
- <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> |
- <isset property="debug.transport"/> |
- </condition> |
- </target> |
- <target depends="-init-debug-args" name="-init-macrodef-debug"> |
- <macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1"> |
- <attribute default="${main.class}" name="classname"/> |
- <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
- <attribute default="${application.args.param}" name="args"/> |
- <element name="customize" optional="true"/> |
- <sequential> |
- <java classname="@{classname}" fork="true"> |
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
- <jvmarg line="${debug-args-line}"/> |
- <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> |
- <jvmarg line="${runmain.jvmargs}"/> |
- <classpath> |
- <path path="@{classpath}"/> |
- </classpath> |
- <syspropertyset> |
- <propertyref prefix="run-sys-prop."/> |
- <mapper from="run-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <arg line="@{args}"/> |
- <customize/> |
- </java> |
- </sequential> |
- </macrodef> |
- </target> |
- <target name="-init-taskdefs"> |
- <fail unless="libs.CopyLibs.classpath"> |
-The libs.CopyLibs.classpath property is not set up. |
-This property must point to |
-org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part |
-of NetBeans IDE installation and is usually located at |
-<netbeans_installation>/java<version>/ant/extra folder. |
-Either open the project in the IDE and make sure CopyLibs library |
-exists or setup the property manually. For example like this: |
- ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar |
- </fail> |
- <taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/> |
- </target> |
- <target name="-init-ap-cmdline-properties"> |
- <property name="annotation.processing.enabled" value="true"/> |
- <property name="annotation.processing.processors.list" value=""/> |
- <property name="annotation.processing.run.all.processors" value="true"/> |
- <property name="javac.processorpath" value="${javac.classpath}"/> |
- <property name="javac.test.processorpath" value="${javac.test.classpath}"/> |
- <condition property="ap.supported.internal" value="true"> |
- <not> |
- <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> |
- </not> |
- </condition> |
- </target> |
- <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> |
- <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> |
- <isfalse value="${annotation.processing.run.all.processors}"/> |
- </condition> |
- <condition else="" property="ap.proc.none.internal" value="-proc:none"> |
- <isfalse value="${annotation.processing.enabled}"/> |
- </condition> |
- </target> |
- <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> |
- <property name="ap.cmd.line.internal" value=""/> |
- </target> |
- <!-- |
- pre NB7.2 profiling section; consider it deprecated |
- --> |
- <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> |
- <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="-profile-pre-init, init, -profile-post-init" if="profiler.info.jvmargs.agent" name="-profile-init-check"> |
- <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> |
- <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> |
- </target> |
- <!-- |
- end of pre NB7.2 profiling section |
- --> |
- <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/> |
- <!-- |
- COMPILATION SECTION |
- --> |
- <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"> |
- <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="jar"> |
- <property name="deploy.on.save" value="false"/> |
- </ant> |
- </target> |
- <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"> |
- <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="jar"> |
- <property name="deploy.on.save" value="false"/> |
- </ant> |
- </target> |
- <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/> |
- <target depends="init,deps-jar,generate-rest-config" name="-pre-pre-compile"> |
- <mkdir dir="${build.classes.dir}"/> |
- </target> |
- <target name="-pre-compile"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target name="-copy-webdir"> |
- <copy todir="${build.web.dir}"> |
- <fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/> |
- </copy> |
- <copy todir="${build.web.dir}/WEB-INF"> |
- <fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/> |
- </copy> |
- </target> |
- <target depends="init, deps-jar, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-persistence-xml, -copy-webdir, library-inclusion-in-archive,library-inclusion-in-manifest" if="have.sources" name="-do-compile"> |
- <webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/> |
- <copy todir="${build.classes.dir}"> |
- <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
- </copy> |
- </target> |
- <target if="has.custom.manifest" name="-copy-manifest"> |
- <mkdir dir="${build.meta.inf.dir}"/> |
- <copy todir="${build.meta.inf.dir}"> |
- <fileset dir="${conf.dir}" includes="MANIFEST.MF"/> |
- </copy> |
- </target> |
- <target if="has.persistence.xml" name="-copy-persistence-xml"> |
- <mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/> |
- <copy todir="${build.web.dir}/WEB-INF/classes/META-INF"> |
- <fileset dir="${persistence.xml.dir}" includes="persistence.xml orm.xml"/> |
- </copy> |
- </target> |
- <target name="-post-compile"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> |
- <target name="-pre-compile-single"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> |
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> |
- <webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/> |
- <copy todir="${build.classes.dir}"> |
- <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
- </copy> |
- </target> |
- <target name="-post-compile-single"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> |
- <property name="jspc.schemas" value="/resources/schemas/"/> |
- <property name="jspc.dtds" value="/resources/dtds/"/> |
- <target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps"> |
- <mkdir dir="${build.generated.dir}/src"/> |
- <java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true"> |
- <arg value="-uriroot"/> |
- <arg file="${basedir}/${build.web.dir}"/> |
- <arg value="-d"/> |
- <arg file="${basedir}/${build.generated.dir}/src"/> |
- <arg value="-die1"/> |
- <arg value="-schemas ${jspc.schemas}"/> |
- <arg value="-dtds ${jspc.dtds}"/> |
- <arg value="-compilerSourceVM ${javac.source}"/> |
- <arg value="-compilerTargetVM ${javac.target}"/> |
- <arg value="-javaEncoding ${source.encoding}"/> |
- <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> |
- <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> |
- </java> |
- <mkdir dir="${build.generated.dir}/classes"/> |
- <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/> |
- </target> |
- <target depends="compile" if="jsp.includes" name="-do-compile-single-jsp"> |
- <fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail> |
- <mkdir dir="${build.generated.dir}/src"/> |
- <java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true"> |
- <arg value="-uriroot"/> |
- <arg file="${basedir}/${build.web.dir}"/> |
- <arg value="-d"/> |
- <arg file="${basedir}/${build.generated.dir}/src"/> |
- <arg value="-die1"/> |
- <arg value="-schemas ${jspc.schemas}"/> |
- <arg value="-dtds ${jspc.dtds}"/> |
- <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> |
- <arg value="-jspc.files"/> |
- <arg path="${jsp.includes}"/> |
- <arg value="-compilerSourceVM ${javac.source}"/> |
- <arg value="-compilerTargetVM ${javac.target}"/> |
- <arg value="-javaEncoding ${source.encoding}"/> |
- <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> |
- </java> |
- <mkdir dir="${build.generated.dir}/classes"/> |
- <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"> |
- <customize> |
- <patternset includes="${javac.jsp.includes}"/> |
- </customize> |
- </webproject2:javac> |
- </target> |
- <target name="compile-single-jsp"> |
- <fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail> |
- <antcall target="-do-compile-single-jsp"/> |
- </target> |
- <!-- |
- DIST BUILDING SECTION |
- --> |
- <target name="-pre-dist"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest"> |
- <dirname file="${dist.war}" property="dist.jar.dir"/> |
- <mkdir dir="${dist.jar.dir}"/> |
- <jar compress="${jar.compress}" jarfile="${dist.war}"> |
- <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
- </jar> |
- </target> |
- <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest"> |
- <dirname file="${dist.war}" property="dist.jar.dir"/> |
- <mkdir dir="${dist.jar.dir}"/> |
- <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> |
- <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
- </jar> |
- </target> |
- <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest"> |
- <dirname file="${dist.war}" property="dist.jar.dir"/> |
- <mkdir dir="${dist.jar.dir}"/> |
- <jar compress="${jar.compress}" jarfile="${dist.war}"> |
- <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
- </jar> |
- </target> |
- <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest"> |
- <dirname file="${dist.war}" property="dist.jar.dir"/> |
- <mkdir dir="${dist.jar.dir}"/> |
- <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> |
- <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
- </jar> |
- </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="${reference.csip-core.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"/> |
- <copyfiles files="${file.reference.Lmod2Rusle2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
- <copyfiles files="${file.reference.calcmanstir.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
- <copyfiles files="${file.reference.SDMDriver-1.0.7.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
- <copyfiles files="${file.reference.csip-gis-objects-2.0.40.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
- <copyfiles files="${file.reference.csip-soilsdb-3.5.109.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> |
- <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"> |
- <copyfiles files="${reference.csip-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${file.reference.Lmod2Rusle2.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${file.reference.calcmanstir.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${file.reference.SDMDriver-1.0.7.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${file.reference.csip-gis-objects-2.0.40.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
- <copyfiles files="${file.reference.csip-soilsdb-3.5.109.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"/> |
- </target> |
- <target depends="init,-clean-webinf-lib,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist"> |
- <dirname file="${dist.ear.war}" property="dist.jar.dir"/> |
- <mkdir dir="${dist.jar.dir}"/> |
- <jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF"> |
- <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
- </jar> |
- </target> |
- <target name="-post-dist"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/> |
- <target depends="init,-clean-webinf-lib,-init-cos,compile,-pre-dist,do-ear-dist,-post-dist" description="Build distribution (WAR) to be packaged into an EAR." name="dist-ear"/> |
- <!-- |
- EXECUTION SECTION |
- --> |
- <target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/> |
- <target name="-pre-run-deploy"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target name="-post-run-deploy"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target name="-pre-nbmodule-run-deploy"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. --> |
- </target> |
- <target name="-post-nbmodule-run-deploy"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. --> |
- </target> |
- <target name="-run-deploy-am"> |
- <!-- Task to deploy to the Access Manager runtime. --> |
- </target> |
- <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/> |
- <target if="netbeans.home" name="-run-deploy-nb"> |
- <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/> |
- </target> |
- <target name="-init-deploy-ant" unless="netbeans.home"> |
- <property name="deploy.ant.archive" value="${dist.war}"/> |
- <property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/> |
- <property name="deploy.ant.resource.dir" value="${resource.dir}"/> |
- <property name="deploy.ant.enabled" value="true"/> |
- </target> |
- <target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/> |
- <target if="netbeans.home" name="-run-undeploy-nb"> |
- <fail message="Undeploy is not supported from within the IDE"/> |
- </target> |
- <target depends="init,-pre-dist,dist,-post-dist" name="verify"> |
- <nbverify file="${dist.war}"/> |
- </target> |
- <target depends="run-deploy,-init-display-browser,-display-browser-nb-old,-display-browser-nb,-display-browser-cl" name="run-display-browser"/> |
- <target if="do.display.browser" name="-init-display-browser"> |
- <condition property="do.display.browser.nb.old"> |
- <and> |
- <isset property="netbeans.home"/> |
- <not> |
- <isset property="browser.context"/> |
- </not> |
- </and> |
- </condition> |
- <condition property="do.display.browser.nb"> |
- <and> |
- <isset property="netbeans.home"/> |
- <isset property="browser.context"/> |
- </and> |
- </condition> |
- <condition property="do.display.browser.cl"> |
- <isset property="deploy.ant.enabled"/> |
- </condition> |
- </target> |
- <target if="do.display.browser.nb.old" name="-display-browser-nb-old"> |
- <nbbrowse url="${client.url}"/> |
- </target> |
- <target if="do.display.browser.nb" name="-display-browser-nb"> |
- <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> |
- </target> |
- <target if="do.display.browser.cl" name="-get-browser" unless="browser"> |
- <condition property="browser" value="rundll32"> |
- <os family="windows"/> |
- </condition> |
- <condition else="" property="browser.args" value="url.dll,FileProtocolHandler"> |
- <os family="windows"/> |
- </condition> |
- <condition property="browser" value="/usr/bin/open"> |
- <os family="mac"/> |
- </condition> |
- <property environment="env"/> |
- <condition property="browser" value="${env.BROWSER}"> |
- <isset property="env.BROWSER"/> |
- </condition> |
- <condition property="browser" value="/usr/bin/firefox"> |
- <available file="/usr/bin/firefox"/> |
- </condition> |
- <condition property="browser" value="/usr/local/firefox/firefox"> |
- <available file="/usr/local/firefox/firefox"/> |
- </condition> |
- <condition property="browser" value="/usr/bin/mozilla"> |
- <available file="/usr/bin/mozilla"/> |
- </condition> |
- <condition property="browser" value="/usr/local/mozilla/mozilla"> |
- <available file="/usr/local/mozilla/mozilla"/> |
- </condition> |
- <condition property="browser" value="/usr/sfw/lib/firefox/firefox"> |
- <available file="/usr/sfw/lib/firefox/firefox"/> |
- </condition> |
- <condition property="browser" value="/opt/csw/bin/firefox"> |
- <available file="/opt/csw/bin/firefox"/> |
- </condition> |
- <condition property="browser" value="/usr/sfw/lib/mozilla/mozilla"> |
- <available file="/usr/sfw/lib/mozilla/mozilla"/> |
- </condition> |
- <condition property="browser" value="/opt/csw/bin/mozilla"> |
- <available file="/opt/csw/bin/mozilla"/> |
- </condition> |
- </target> |
- <target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl"> |
- <fail unless="browser"> |
- Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. |
- </fail> |
- <property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/> |
- <echo>Launching ${browse.url}</echo> |
- <exec executable="${browser}" spawn="true"> |
- <arg line="${browser.args} ${browse.url}"/> |
- </exec> |
- </target> |
- <target depends="init,-init-cos,compile-single" name="run-main"> |
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail> |
- <webproject1:java classname="${run.class}"/> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main"> |
- <fail unless="run.class">Must select one file in the IDE or set run.class</fail> |
- <webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> |
- </target> |
- <target depends="init" if="netbeans.home" name="-do-update-breakpoints"> |
- <webproject1:nbjpdaappreloaded/> |
- </target> |
- <!-- |
- DEBUGGING SECTION |
- --> |
- <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" description="Debug project in IDE." if="netbeans.home" name="debug"> |
- <nbstartserver debugmode="true"/> |
- <antcall target="connect-debugger"/> |
- <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/> |
- <antcall target="debug-display-browser-old"/> |
- <antcall target="debug-display-browser"/> |
- <antcall target="connect-client-debugger"/> |
- </target> |
- <target if="do.debug.server" name="connect-debugger" unless="is.debugged"> |
- <condition property="listeningcp" value="sourcepath"> |
- <istrue value="${j2ee.compile.on.save}"/> |
- </condition> |
- <nbjpdaconnect address="${jpda.address}" host="${jpda.host}" listeningcp="${listeningcp}" name="${name}" transport="${jpda.transport}"> |
- <classpath> |
- <path path="${debug.classpath}:${j2ee.platform.classpath}"/> |
- </classpath> |
- <sourcepath> |
- <path path="${web.docbase.dir}"/> |
- </sourcepath> |
- </nbjpdaconnect> |
- </target> |
- <target if="do.display.browser.debug.old" name="debug-display-browser-old"> |
- <nbbrowse url="${client.url}"/> |
- </target> |
- <target if="do.display.browser.debug" name="debug-display-browser"> |
- <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> |
- </target> |
- <target if="do.debug.client" name="connect-client-debugger"> |
- <webproject1:nbjsdebugstart webUrl="${client.url}"/> |
- </target> |
- <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> |
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> |
- <webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> |
- </target> |
- <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> |
- <target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/> |
- <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> |
- <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> |
- </target> |
- <target depends="init" if="netbeans.home" name="-debug-start-debugger"> |
- <webproject1:nbjpdastart name="${debug.class}"/> |
- </target> |
- <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> |
- <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> |
- <webproject1:debug classname="${debug.class}"/> |
- </target> |
- <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/> |
- <target depends="init" name="-pre-debug-fix"> |
- <fail unless="fix.includes">Must set fix.includes</fail> |
- <property name="javac.includes" value="${fix.includes}.java"/> |
- </target> |
- <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> |
- <webproject1:nbjpdareload/> |
- </target> |
- <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> |
- <!-- |
- ================= |
- PROFILING SECTION |
- ================= |
- --> |
- <!-- |
- pre NB7.2 profiling section; consider it deprecated |
- --> |
- <target description="Profile a J2EE project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> |
- <condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs"> |
- <isset property="profiler.info.jvmargs.extra"/> |
- </condition> |
- <antcall target="${profiler.startserver.target}"/> |
- <antcall target="run"/> |
- <antcall target="-profile-start-loadgen"/> |
- </target> |
- <target if="profiler.info.jvmargs.agent" name="start-profiled-server"> |
- <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> |
- <jvmarg value="${profiler.info.jvmargs.agent}"/> |
- <jvmarg value="${profiler.j2ee.agentID}"/> |
- </nbstartprofiledserver> |
- </target> |
- <target if="profiler.info.jvmargs.agent" name="start-profiled-server-extraargs"> |
- <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> |
- <jvmarg value="${profiler.info.jvmargs.extra}"/> |
- <jvmarg value="${profiler.info.jvmargs.agent}"/> |
- <jvmarg value="${profiler.j2ee.agentID}"/> |
- </nbstartprofiledserver> |
- </target> |
- <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> |
- <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> |
- <nbprofiledirect> |
- <classpath> |
- <path path="${run.test.classpath}"/> |
- <path path="${j2ee.platform.classpath}"/> |
- </classpath> |
- </nbprofiledirect> |
- <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> |
- <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> |
- <jvmarg value="${profiler.info.jvmargs.agent}"/> |
- <jvmarg line="${profiler.info.jvmargs}"/> |
- <test name="${profile.class}"/> |
- <classpath> |
- <path path="${run.test.classpath}"/> |
- <path path="${j2ee.platform.classpath}"/> |
- </classpath> |
- <syspropertyset> |
- <propertyref prefix="test-sys-prop."/> |
- <mapper from="test-sys-prop.*" to="*" type="glob"/> |
- </syspropertyset> |
- <formatter type="brief" usefile="false"/> |
- <formatter type="xml"/> |
- </junit> |
- </target> |
- <target if="netbeans.home" name="-profile-check"> |
- <condition property="profiler.configured"> |
- <or> |
- <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> |
- <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> |
- </or> |
- </condition> |
- </target> |
- <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" name="-do-profile"> |
- <startprofiler/> |
- <nbstartserver profilemode="true"/> |
- <nbdeploy clientUrlPart="${client.urlPart}" forceRedeploy="true" profilemode="true"/> |
- <antcall target="debug-display-browser-old"/> |
- <antcall target="debug-display-browser"/> |
- <antcall target="-profile-start-loadgen"/> |
- </target> |
- <target depends="-profile-check,-profile-pre72" description="Profile a J2EE project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> |
- <antcall target="-do-profile"/> |
- </target> |
- <target depends="-profile-test-single-pre72" name="profile-test-single"/> |
- <target depends="-profile-check" if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs.agent"> |
- <startprofiler/> |
- <antcall target="test-single"/> |
- </target> |
- <target if="profiler.loadgen.path" name="-profile-start-loadgen"> |
- <loadgenstart path="${profiler.loadgen.path}"/> |
- </target> |
- <!-- |
- JAVADOC SECTION |
- --> |
- <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}"> |
- <classpath> |
- <path path="${javac.classpath}:${j2ee.platform.classpath}"/> |
- </classpath> |
- <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> |
- <filename name="**/*.java"/> |
- </fileset> |
- <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> |
- <include name="**/*.java"/> |
- </fileset> |
- </javadoc> |
- <copy todir="${dist.javadoc.dir}"> |
- <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> |
- <filename name="**/doc-files/**"/> |
- </fileset> |
- <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> |
- <include name="**/doc-files/**"/> |
- </fileset> |
- </copy> |
- </target> |
- <target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview"> |
- <nbbrowse file="${dist.javadoc.dir}/index.html"/> |
- </target> |
- <target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/> |
- <!-- |
- |
- TEST COMPILATION SECTION |
- --> |
- <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> |
- <mkdir dir="${build.test.classes.dir}"/> |
- <property name="j2ee.platform.embeddableejb.classpath" value=""/> |
- </target> |
- <target name="-pre-compile-test"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test"> |
- <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> |
- <copy todir="${build.test.classes.dir}"> |
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
- </copy> |
- </target> |
- <target name="-post-compile-test"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> |
- <target name="-pre-compile-test-single"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> |
- <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> |
- <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/> |
- <copy todir="${build.test.classes.dir}"> |
- <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
- </copy> |
- </target> |
- <target name="-post-compile-test-single"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> |
- <!-- |
- |
- TEST EXECUTION SECTION |
- --> |
- <target depends="init" if="have.tests" name="-pre-test-run"> |
- <mkdir dir="${build.test.results.dir}"/> |
- </target> |
- <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> |
- <webproject2:test includes="${includes}" testincludes="**/*Test.java"/> |
- </target> |
- <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> |
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
- </target> |
- <target depends="init" if="have.tests" name="test-report"/> |
- <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> |
- <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> |
- <target depends="init" if="have.tests" name="-pre-test-run-single"> |
- <mkdir dir="${build.test.results.dir}"/> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> |
- <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> |
- <webproject2:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> |
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> |
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> |
- <fail unless="test.class">Must select some files in the IDE or set test.class</fail> |
- <fail unless="test.method">Must select some method in the IDE or set test.method</fail> |
- <webproject2:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> |
- <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> |
- <!-- |
- |
- TEST DEBUGGING SECTION |
- --> |
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> |
- <fail unless="test.class">Must select one file in the IDE or set test.class</fail> |
- <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> |
- </target> |
- <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> |
- <fail unless="test.class">Must select one file in the IDE or set test.class</fail> |
- <fail unless="test.method">Must select some method in the IDE or set test.method</fail> |
- <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> |
- </target> |
- <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> |
- <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> |
- </target> |
- <target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> |
- <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> |
- <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> |
- <webproject1:nbjpdareload dir="${build.test.classes.dir}"/> |
- </target> |
- <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> |
- <!-- |
- |
- CLEANUP SECTION |
- --> |
- <target depends="init" name="deps-clean" unless="no.deps"> |
- <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="clean"/> |
- </target> |
- <target depends="init" name="do-clean"> |
- <condition property="build.dir.to.clean" value="${build.web.dir}"> |
- <isset property="dist.ear.dir"/> |
- </condition> |
- <property name="build.dir.to.clean" value="${build.web.dir}"/> |
- <delete includeEmptyDirs="true" quiet="true"> |
- <fileset dir="${build.dir.to.clean}/WEB-INF/lib"/> |
- </delete> |
- <delete dir="${build.dir}"/> |
- <available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/> |
- <delete dir="${dist.dir}"/> |
- </target> |
- <target depends="do-clean" if="status.clean-failed" name="check-clean"> |
- <echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/> |
- <echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/> |
- </target> |
- <target depends="init" if="netbeans.home" name="undeploy-clean"> |
- <nbundeploy failOnError="false" startServer="false"/> |
- </target> |
- <target name="-post-clean"> |
- <!-- Empty placeholder for easier customization. --> |
- <!-- You can override this target in the ../build.xml file. --> |
- </target> |
- <target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/> |
- <target depends="clean" description="Clean build products." name="clean-ear"/> |
-</project> |
+<?xml version="1.0" encoding="UTF-8"?> |
+<!-- |
+ *** GENERATED FROM project.xml - DO NOT EDIT *** |
+ *** EDIT ../build.xml INSTEAD *** |
+ |
+ For the purpose of easier reading the script |
+ is divided into following sections: |
+ - initialization |
+ - compilation |
+ - dist |
+ - execution |
+ - debugging |
+ - javadoc |
+ - test compilation |
+ - test execution |
+ - test debugging |
+ - cleanup |
+ |
+ --> |
+<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="csip-r2-impl"> |
+ <import file="rest-build.xml"/> |
+ <import file="ant-deploy.xml"/> |
+ <fail message="Please build using Ant 1.7.1 or higher."> |
+ <condition> |
+ <not> |
+ <antversion atleast="1.7.1"/> |
+ </not> |
+ </condition> |
+ </fail> |
+ <target depends="dist,javadoc" description="Build whole project." name="default"/> |
+ <!-- |
+ INITIALIZATION SECTION |
+ --> |
+ <target name="-pre-init"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="-pre-init" name="-init-private"> |
+ <property file="nbproject/private/private.properties"/> |
+ </target> |
+ <target depends="-pre-init,-init-private" name="-init-user"> |
+ <property file="${user.properties.file}"/> |
+ <!-- The two properties below are usually overridden --> |
+ <!-- by the active platform. Just a fallback. --> |
+ <property name="default.javac.source" value="1.4"/> |
+ <property name="default.javac.target" value="1.4"/> |
+ </target> |
+ <target depends="-pre-init,-init-private,-init-user" name="-init-project"> |
+ <property file="nbproject/project.properties"/> |
+ </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"> |
+ <condition property="have.tests"> |
+ <or> |
+ <available file="${test.src.dir}"/> |
+ </or> |
+ </condition> |
+ <condition property="have.sources"> |
+ <or> |
+ <available file="${src.dir}"/> |
+ </or> |
+ </condition> |
+ <condition property="netbeans.home+have.tests"> |
+ <and> |
+ <isset property="netbeans.home"/> |
+ <isset property="have.tests"/> |
+ </and> |
+ </condition> |
+ <condition property="no.javadoc.preview"> |
+ <isfalse value="${javadoc.preview}"/> |
+ </condition> |
+ <property name="javac.compilerargs" value=""/> |
+ <condition property="no.deps"> |
+ <and> |
+ <istrue value="${no.dependencies}"/> |
+ </and> |
+ </condition> |
+ <condition property="no.dist.ear.dir"> |
+ <not> |
+ <isset property="dist.ear.dir"/> |
+ </not> |
+ </condition> |
+ <property name="build.web.excludes" value="${build.classes.excludes}"/> |
+ <condition property="do.compile.jsps"> |
+ <istrue value="${compile.jsps}"/> |
+ </condition> |
+ <condition property="do.debug.server"> |
+ <or> |
+ <not> |
+ <isset property="debug.server"/> |
+ </not> |
+ <istrue value="${debug.server}"/> |
+ <and> |
+ <not> |
+ <istrue value="${debug.server}"/> |
+ </not> |
+ <not> |
+ <istrue value="${debug.client}"/> |
+ </not> |
+ </and> |
+ </or> |
+ </condition> |
+ <condition property="do.debug.client"> |
+ <istrue value="${debug.client}"/> |
+ </condition> |
+ <condition property="do.display.browser"> |
+ <istrue value="${display.browser}"/> |
+ </condition> |
+ <condition property="do.display.browser.debug.old"> |
+ <and> |
+ <isset property="do.display.browser"/> |
+ <not> |
+ <isset property="do.debug.client"/> |
+ </not> |
+ <not> |
+ <isset property="browser.context"/> |
+ </not> |
+ </and> |
+ </condition> |
+ <condition property="do.display.browser.debug"> |
+ <and> |
+ <isset property="do.display.browser"/> |
+ <not> |
+ <isset property="do.debug.client"/> |
+ </not> |
+ <isset property="browser.context"/> |
+ </and> |
+ </condition> |
+ <available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/> |
+ <available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/> |
+ <condition property="do.war.package.with.custom.manifest"> |
+ <isset property="has.custom.manifest"/> |
+ </condition> |
+ <condition property="do.war.package.without.custom.manifest"> |
+ <not> |
+ <isset property="has.custom.manifest"/> |
+ </not> |
+ </condition> |
+ <condition property="do.tmp.war.package.with.custom.manifest"> |
+ <and> |
+ <isset property="has.custom.manifest"/> |
+ <or> |
+ <isfalse value="${directory.deployment.supported}"/> |
+ <isset property="dist.ear.dir"/> |
+ </or> |
+ </and> |
+ </condition> |
+ <condition property="do.tmp.war.package.without.custom.manifest"> |
+ <and> |
+ <not> |
+ <isset property="has.custom.manifest"/> |
+ </not> |
+ <or> |
+ <isfalse value="${directory.deployment.supported}"/> |
+ <isset property="dist.ear.dir"/> |
+ </or> |
+ </and> |
+ </condition> |
+ <condition property="do.tmp.war.package"> |
+ <or> |
+ <isfalse value="${directory.deployment.supported}"/> |
+ <isset property="dist.ear.dir"/> |
+ </or> |
+ </condition> |
+ <property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/> |
+ <condition else="" property="application.args.param" value="${application.args}"> |
+ <and> |
+ <isset property="application.args"/> |
+ <not> |
+ <equals arg1="${application.args}" arg2="" trim="true"/> |
+ </not> |
+ </and> |
+ </condition> |
+ <property name="source.encoding" value="${file.encoding}"/> |
+ <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> |
+ <and> |
+ <isset property="javadoc.encoding"/> |
+ <not> |
+ <equals arg1="${javadoc.encoding}" arg2=""/> |
+ </not> |
+ </and> |
+ </condition> |
+ <property name="javadoc.encoding.used" value="${source.encoding}"/> |
+ <property name="includes" value="**"/> |
+ <property name="excludes" value=""/> |
+ <property name="runmain.jvmargs" value=""/> |
+ <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> |
+ <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> |
+ <and> |
+ <isset property="endorsed.classpath"/> |
+ <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}"/> |
+ <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> |
+ </or> |
+ </condition> |
+ <condition property="testng.available"> |
+ <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> |
+ </condition> |
+ <condition property="junit+testng.available"> |
+ <and> |
+ <istrue value="${junit.available}"/> |
+ <istrue value="${testng.available}"/> |
+ </and> |
+ </condition> |
+ <condition else="testng" property="testng.mode" value="mixed"> |
+ <istrue value="${junit+testng.available}"/> |
+ </condition> |
+ <condition else="" property="testng.debug.mode" value="-mixed"> |
+ <istrue value="${junit+testng.available}"/> |
+ </condition> |
+ </target> |
+ <target depends="init" name="-init-cos" unless="deploy.on.save"> |
+ <condition property="deploy.on.save" value="true"> |
+ <or> |
+ <istrue value="${j2ee.deploy.on.save}"/> |
+ <istrue value="${j2ee.compile.on.save}"/> |
+ </or> |
+ </condition> |
+ </target> |
+ <target name="-post-init"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> |
+ <fail unless="src.dir">Must set src.dir</fail> |
+ <fail unless="test.src.dir">Must set test.src.dir</fail> |
+ <fail unless="build.dir">Must set build.dir</fail> |
+ <fail unless="build.web.dir">Must set build.web.dir</fail> |
+ <fail unless="build.generated.dir">Must set build.generated.dir</fail> |
+ <fail unless="dist.dir">Must set dist.dir</fail> |
+ <fail unless="build.classes.dir">Must set build.classes.dir</fail> |
+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> |
+ <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> |
+ <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> |
+ <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> |
+ <fail unless="dist.war">Must set dist.war</fail> |
+ <condition property="missing.j2ee.server.home"> |
+ <and> |
+ <matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/> |
+ <not> |
+ <isset property="j2ee.server.home"/> |
+ </not> |
+ </and> |
+ </condition> |
+ <fail if="missing.j2ee.server.home"> |
+The Java EE server classpath is not correctly set up - server home directory is missing. |
+Either open the project in the IDE and assign the server or setup the server classpath manually. |
+For example like this: |
+ ant -Dj2ee.server.home=<app_server_installation_directory> |
+ </fail> |
+ <fail unless="j2ee.platform.classpath"> |
+The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. |
+Either open the project in the IDE and assign the server or setup the server classpath manually. |
+For example like this: |
+ ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) |
+or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) |
+ </fail> |
+ </target> |
+ <target name="-init-macrodef-property"> |
+ <macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute name="name"/> |
+ <attribute name="value"/> |
+ <sequential> |
+ <property name="@{name}" value="${@{value}}"/> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> |
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${src.dir}" name="srcdir"/> |
+ <attribute default="${build.classes.dir}" name="destdir"/> |
+ <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
+ <attribute default="${javac.processorpath}" name="processorpath"/> |
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="${javac.debug}" name="debug"/> |
+ <attribute default="${empty.dir}" name="gensrcdir"/> |
+ <element name="customize" optional="true"/> |
+ <sequential> |
+ <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}"> |
+ <src> |
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false"> |
+ <include name="*"/> |
+ </dirset> |
+ </src> |
+ <classpath> |
+ <path path="@{classpath}"/> |
+ </classpath> |
+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <compilerarg line="${javac.compilerargs}"/> |
+ <compilerarg value="-processorpath"/> |
+ <compilerarg path="@{processorpath}:${empty.dir}"/> |
+ <compilerarg line="${ap.processors.internal}"/> |
+ <compilerarg value="-s"/> |
+ <compilerarg path="@{apgeneratedsrcdir}"/> |
+ <compilerarg line="${ap.proc.none.internal}"/> |
+ <customize/> |
+ </javac> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> |
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${src.dir}" name="srcdir"/> |
+ <attribute default="${build.classes.dir}" name="destdir"/> |
+ <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
+ <attribute default="${javac.processorpath}" name="processorpath"/> |
+ <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="${javac.debug}" name="debug"/> |
+ <attribute default="${empty.dir}" name="gensrcdir"/> |
+ <element name="customize" optional="true"/> |
+ <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}"> |
+ <src> |
+ <dirset dir="@{gensrcdir}" erroronmissingdir="false"> |
+ <include name="*"/> |
+ </dirset> |
+ </src> |
+ <classpath> |
+ <path path="@{classpath}"/> |
+ </classpath> |
+ <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <compilerarg line="${javac.compilerargs}"/> |
+ <customize/> |
+ </javac> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> |
+ <macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${src.dir}" name="srcdir"/> |
+ <attribute default="${build.classes.dir}" name="destdir"/> |
+ <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
+ <sequential> |
+ <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> |
+ <classpath> |
+ <path path="@{classpath}"/> |
+ </classpath> |
+ </depend> |
+ </sequential> |
+ </macrodef> |
+ <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${build.classes.dir}" name="destdir"/> |
+ <sequential> |
+ <fail unless="javac.includes">Must set javac.includes</fail> |
+ <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> |
+ <path> |
+ <filelist dir="@{destdir}" files="${javac.includes}"/> |
+ </path> |
+ <globmapper from="*.java" to="*.class"/> |
+ </pathconvert> |
+ <tempfile deleteonexit="true" property="javac.includesfile.binary"/> |
+ <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> |
+ <delete> |
+ <files includesfile="${javac.includesfile.binary}"/> |
+ </delete> |
+ <delete file="${javac.includesfile.binary}"/> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target if="${junit.available}" name="-init-macrodef-junit-init"> |
+ <condition else="false" property="nb.junit.batch" value="true"> |
+ <and> |
+ <istrue value="${junit.available}"/> |
+ <not> |
+ <isset property="test.method"/> |
+ </not> |
+ </and> |
+ </condition> |
+ <condition else="false" property="nb.junit.single" value="true"> |
+ <and> |
+ <istrue value="${junit.available}"/> |
+ <isset property="test.method"/> |
+ </and> |
+ </condition> |
+ </target> |
+ <target name="-init-test-properties"> |
+ <property name="test.binaryincludes" value="<nothing>"/> |
+ <property name="test.binarytestincludes" value=""/> |
+ <property name="test.binaryexcludes" value=""/> |
+ </target> |
+ <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> |
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <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}"> |
+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <formatter type="brief" usefile="false"/> |
+ <formatter type="xml"/> |
+ <jvmarg value="-ea"/> |
+ <customize/> |
+ </junit> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> |
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <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}"> |
+ <batchtest todir="${build.test.results.dir}"> |
+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> |
+ <filename name="@{testincludes}"/> |
+ </fileset> |
+ <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> |
+ <filename name="${test.binarytestincludes}"/> |
+ </fileset> |
+ </batchtest> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <formatter type="brief" usefile="false"/> |
+ <formatter type="xml"/> |
+ <jvmarg value="-ea"/> |
+ <jvmarg line="${run.jvmargs.ide}"/> |
+ <customize/> |
+ </junit> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> |
+ <target if="${testng.available}" name="-init-macrodef-testng"> |
+ <macrodef name="testng" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <element name="customize" optional="true"/> |
+ <sequential> |
+ <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> |
+ <isset property="test.method"/> |
+ </condition> |
+ <union id="test.set"> |
+ <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> |
+ <filename name="@{testincludes}"/> |
+ </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-r2" testname="TestNG tests" workingDir="${basedir}"> |
+ <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> |
+ <propertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </propertyset> |
+ <customize/> |
+ </testng> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target name="-init-macrodef-test-impl"> |
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <element implicit="true" name="customize" optional="true"/> |
+ <sequential> |
+ <echo>No tests executed.</echo> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> |
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <element implicit="true" name="customize" optional="true"/> |
+ <sequential> |
+ <webproject2:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
+ <customize/> |
+ </webproject2:junit> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> |
+ <macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <element implicit="true" name="customize" optional="true"/> |
+ <sequential> |
+ <webproject2:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
+ <customize/> |
+ </webproject2:testng> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> |
+ <macrodef name="test" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <sequential> |
+ <webproject2:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
+ <customize> |
+ <classpath> |
+ <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> |
+ </classpath> |
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <jvmarg line="${runmain.jvmargs}"/> |
+ </customize> |
+ </webproject2:test-impl> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> |
+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <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}"> |
+ <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <formatter type="brief" usefile="false"/> |
+ <formatter type="xml"/> |
+ <jvmarg value="-ea"/> |
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/> |
+ <customize/> |
+ </junit> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> |
+ <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <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}"> |
+ <batchtest todir="${build.test.results.dir}"> |
+ <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> |
+ <filename name="@{testincludes}"/> |
+ </fileset> |
+ <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> |
+ <filename name="${test.binarytestincludes}"/> |
+ </fileset> |
+ </batchtest> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <formatter type="brief" usefile="false"/> |
+ <formatter type="xml"/> |
+ <jvmarg value="-ea"/> |
+ <jvmarg line="${run.jvmargs.ide}"/> |
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/> |
+ <customize/> |
+ </junit> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> |
+ <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <element implicit="true" name="customize" optional="true"/> |
+ <sequential> |
+ <webproject2:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
+ <customize/> |
+ </webproject2:junit-debug> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target if="${testng.available}" name="-init-macrodef-testng-debug"> |
+ <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${main.class}" name="testClass"/> |
+ <attribute default="" name="testMethod"/> |
+ <element name="customize2" optional="true"/> |
+ <sequential> |
+ <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> |
+ <isset property="test.method"/> |
+ </condition> |
+ <condition else="-suitename csip-r2 -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> |
+ <matches pattern=".*\.xml" string="@{testClass}"/> |
+ </condition> |
+ <delete dir="${build.test.results.dir}" quiet="true"/> |
+ <mkdir dir="${build.test.results.dir}"/> |
+ <webproject1:debug args="${testng.cmd.args}" classname="org.testng.TestNG" classpath="${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}"> |
+ <customize> |
+ <customize2/> |
+ <jvmarg value="-ea"/> |
+ <arg line="${testng.debug.mode}"/> |
+ <arg line="-d ${build.test.results.dir}"/> |
+ <arg line="-listener org.testng.reporters.VerboseReporter"/> |
+ </customize> |
+ </webproject1:debug> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> |
+ <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${main.class}" name="testClass"/> |
+ <attribute default="" name="testMethod"/> |
+ <element implicit="true" name="customize2" optional="true"/> |
+ <sequential> |
+ <webproject2:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> |
+ <customize2/> |
+ </webproject2:testng-debug> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> |
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <attribute default="${main.class}" name="testClass"/> |
+ <attribute default="" name="testMethod"/> |
+ <sequential> |
+ <webproject2:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> |
+ <customize> |
+ <classpath> |
+ <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/> |
+ </classpath> |
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <jvmarg line="${runmain.jvmargs}"/> |
+ </customize> |
+ </webproject2:test-debug-impl> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> |
+ <macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2"> |
+ <attribute default="${includes}" name="includes"/> |
+ <attribute default="${excludes}" name="excludes"/> |
+ <attribute default="**" name="testincludes"/> |
+ <attribute default="" name="testmethods"/> |
+ <attribute default="${main.class}" name="testClass"/> |
+ <attribute default="" name="testMethod"/> |
+ <sequential> |
+ <webproject2:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> |
+ <customize2> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ </customize2> |
+ </webproject2:testng-debug-impl> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> |
+ <target name="-init-macrodef-java"> |
+ <macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute default="${main.class}" name="classname"/> |
+ <attribute default="${debug.classpath}" name="classpath"/> |
+ <element name="customize" optional="true"/> |
+ <sequential> |
+ <java classname="@{classname}" fork="true"> |
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <jvmarg line="${runmain.jvmargs}"/> |
+ <classpath> |
+ <path path="@{classpath}:${j2ee.platform.classpath}"/> |
+ </classpath> |
+ <syspropertyset> |
+ <propertyref prefix="run-sys-prop."/> |
+ <mapper from="run-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <customize/> |
+ </java> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target name="-init-macrodef-nbjsdebug"> |
+ <macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute default="${client.url}" name="webUrl"/> |
+ <sequential> |
+ <nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> |
+ <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute default="${main.class}" name="name"/> |
+ <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
+ <sequential> |
+ <nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}"> |
+ <classpath> |
+ <path path="@{classpath}"/> |
+ </classpath> |
+ </nbjpdastart> |
+ </sequential> |
+ </macrodef> |
+ <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute default="${build.classes.dir}" name="dir"/> |
+ <sequential> |
+ <nbjpdareload> |
+ <fileset dir="@{dir}" includes="${fix.classes}"> |
+ <include name="${fix.includes}*.class"/> |
+ </fileset> |
+ </nbjpdareload> |
+ </sequential> |
+ </macrodef> |
+ <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <sequential> |
+ <nbjpdaappreloaded/> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target name="-init-debug-args"> |
+ <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> |
+ <os family="windows"/> |
+ </condition> |
+ <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> |
+ <isset property="debug.transport"/> |
+ </condition> |
+ </target> |
+ <target depends="-init-debug-args" name="-init-macrodef-debug"> |
+ <macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1"> |
+ <attribute default="${main.class}" name="classname"/> |
+ <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/> |
+ <attribute default="${application.args.param}" name="args"/> |
+ <element name="customize" optional="true"/> |
+ <sequential> |
+ <java classname="@{classname}" fork="true"> |
+ <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> |
+ <jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/> |
+ <jvmarg line="${runmain.jvmargs}"/> |
+ <classpath> |
+ <path path="@{classpath}"/> |
+ </classpath> |
+ <syspropertyset> |
+ <propertyref prefix="run-sys-prop."/> |
+ <mapper from="run-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <arg line="@{args}"/> |
+ <customize/> |
+ </java> |
+ </sequential> |
+ </macrodef> |
+ </target> |
+ <target name="-init-taskdefs"> |
+ <fail unless="libs.CopyLibs.classpath"> |
+The libs.CopyLibs.classpath property is not set up. |
+This property must point to |
+org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part |
+of NetBeans IDE installation and is usually located at |
+<netbeans_installation>/java<version>/ant/extra folder. |
+Either open the project in the IDE and make sure CopyLibs library |
+exists or setup the property manually. For example like this: |
+ ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar |
+ </fail> |
+ <taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/> |
+ </target> |
+ <target name="-init-ap-cmdline-properties"> |
+ <property name="annotation.processing.enabled" value="true"/> |
+ <property name="annotation.processing.processors.list" value=""/> |
+ <property name="annotation.processing.run.all.processors" value="true"/> |
+ <property name="javac.processorpath" value="${javac.classpath}"/> |
+ <property name="javac.test.processorpath" value="${javac.test.classpath}"/> |
+ <condition property="ap.supported.internal" value="true"> |
+ <not> |
+ <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> |
+ </not> |
+ </condition> |
+ </target> |
+ <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> |
+ <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> |
+ <isfalse value="${annotation.processing.run.all.processors}"/> |
+ </condition> |
+ <condition else="" property="ap.proc.none.internal" value="-proc:none"> |
+ <isfalse value="${annotation.processing.enabled}"/> |
+ </condition> |
+ </target> |
+ <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> |
+ <property name="ap.cmd.line.internal" value=""/> |
+ </target> |
+ <!-- |
+ pre NB7.2 profiling section; consider it deprecated |
+ --> |
+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> |
+ <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="-profile-pre-init, init, -profile-post-init" if="profiler.info.jvmargs.agent" name="-profile-init-check"> |
+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> |
+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> |
+ </target> |
+ <!-- |
+ end of pre NB7.2 profiling section |
+ --> |
+ <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/> |
+ <!-- |
+ COMPILATION SECTION |
+ --> |
+ <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"> |
+ <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="jar"> |
+ <property name="deploy.on.save" value="false"/> |
+ </ant> |
+ </target> |
+ <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"> |
+ <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="jar"> |
+ <property name="deploy.on.save" value="false"/> |
+ </ant> |
+ </target> |
+ <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/> |
+ <target depends="init,deps-jar,generate-rest-config" name="-pre-pre-compile"> |
+ <mkdir dir="${build.classes.dir}"/> |
+ </target> |
+ <target name="-pre-compile"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target name="-copy-webdir"> |
+ <copy todir="${build.web.dir}"> |
+ <fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/> |
+ </copy> |
+ <copy todir="${build.web.dir}/WEB-INF"> |
+ <fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/> |
+ </copy> |
+ </target> |
+ <target depends="init, deps-jar, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-persistence-xml, -copy-webdir, library-inclusion-in-archive,library-inclusion-in-manifest" if="have.sources" name="-do-compile"> |
+ <webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/> |
+ <copy todir="${build.classes.dir}"> |
+ <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
+ </copy> |
+ </target> |
+ <target if="has.custom.manifest" name="-copy-manifest"> |
+ <mkdir dir="${build.meta.inf.dir}"/> |
+ <copy todir="${build.meta.inf.dir}"> |
+ <fileset dir="${conf.dir}" includes="MANIFEST.MF"/> |
+ </copy> |
+ </target> |
+ <target if="has.persistence.xml" name="-copy-persistence-xml"> |
+ <mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/> |
+ <copy todir="${build.web.dir}/WEB-INF/classes/META-INF"> |
+ <fileset dir="${persistence.xml.dir}" includes="persistence.xml orm.xml"/> |
+ </copy> |
+ </target> |
+ <target name="-post-compile"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> |
+ <target name="-pre-compile-single"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> |
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> |
+ <webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/> |
+ <copy todir="${build.classes.dir}"> |
+ <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
+ </copy> |
+ </target> |
+ <target name="-post-compile-single"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> |
+ <property name="jspc.schemas" value="/resources/schemas/"/> |
+ <property name="jspc.dtds" value="/resources/dtds/"/> |
+ <target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps"> |
+ <mkdir dir="${build.generated.dir}/src"/> |
+ <java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true"> |
+ <arg value="-uriroot"/> |
+ <arg file="${basedir}/${build.web.dir}"/> |
+ <arg value="-d"/> |
+ <arg file="${basedir}/${build.generated.dir}/src"/> |
+ <arg value="-die1"/> |
+ <arg value="-schemas ${jspc.schemas}"/> |
+ <arg value="-dtds ${jspc.dtds}"/> |
+ <arg value="-compilerSourceVM ${javac.source}"/> |
+ <arg value="-compilerTargetVM ${javac.target}"/> |
+ <arg value="-javaEncoding ${source.encoding}"/> |
+ <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> |
+ <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> |
+ </java> |
+ <mkdir dir="${build.generated.dir}/classes"/> |
+ <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/> |
+ </target> |
+ <target depends="compile" if="jsp.includes" name="-do-compile-single-jsp"> |
+ <fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail> |
+ <mkdir dir="${build.generated.dir}/src"/> |
+ <java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true"> |
+ <arg value="-uriroot"/> |
+ <arg file="${basedir}/${build.web.dir}"/> |
+ <arg value="-d"/> |
+ <arg file="${basedir}/${build.generated.dir}/src"/> |
+ <arg value="-die1"/> |
+ <arg value="-schemas ${jspc.schemas}"/> |
+ <arg value="-dtds ${jspc.dtds}"/> |
+ <arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/> |
+ <arg value="-jspc.files"/> |
+ <arg path="${jsp.includes}"/> |
+ <arg value="-compilerSourceVM ${javac.source}"/> |
+ <arg value="-compilerTargetVM ${javac.target}"/> |
+ <arg value="-javaEncoding ${source.encoding}"/> |
+ <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/> |
+ </java> |
+ <mkdir dir="${build.generated.dir}/classes"/> |
+ <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"> |
+ <customize> |
+ <patternset includes="${javac.jsp.includes}"/> |
+ </customize> |
+ </webproject2:javac> |
+ </target> |
+ <target name="compile-single-jsp"> |
+ <fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail> |
+ <antcall target="-do-compile-single-jsp"/> |
+ </target> |
+ <!-- |
+ DIST BUILDING SECTION |
+ --> |
+ <target name="-pre-dist"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest"> |
+ <dirname file="${dist.war}" property="dist.jar.dir"/> |
+ <mkdir dir="${dist.jar.dir}"/> |
+ <jar compress="${jar.compress}" jarfile="${dist.war}"> |
+ <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
+ </jar> |
+ </target> |
+ <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest"> |
+ <dirname file="${dist.war}" property="dist.jar.dir"/> |
+ <mkdir dir="${dist.jar.dir}"/> |
+ <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> |
+ <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
+ </jar> |
+ </target> |
+ <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest"> |
+ <dirname file="${dist.war}" property="dist.jar.dir"/> |
+ <mkdir dir="${dist.jar.dir}"/> |
+ <jar compress="${jar.compress}" jarfile="${dist.war}"> |
+ <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
+ </jar> |
+ </target> |
+ <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest"> |
+ <dirname file="${dist.war}" property="dist.jar.dir"/> |
+ <mkdir dir="${dist.jar.dir}"/> |
+ <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF"> |
+ <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
+ </jar> |
+ </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="${reference.csip-core.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"/> |
+ <copyfiles files="${file.reference.Lmod2Rusle2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
+ <copyfiles files="${file.reference.calcmanstir.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
+ <copyfiles files="${file.reference.SDMDriver-1.0.7.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
+ <copyfiles files="${file.reference.csip-gis-objects-2.0.40.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/> |
+ <copyfiles files="${file.reference.csip-soilsdb-3.5.109.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> |
+ <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"> |
+ <copyfiles files="${reference.csip-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${file.reference.Lmod2Rusle2.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${file.reference.calcmanstir.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${file.reference.SDMDriver-1.0.7.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${file.reference.csip-gis-objects-2.0.40.jar}" todir="${build.web.dir}/WEB-INF/lib"/> |
+ <copyfiles files="${file.reference.csip-soilsdb-3.5.109.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"/> |
+ </target> |
+ <target depends="init,-clean-webinf-lib,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist"> |
+ <dirname file="${dist.ear.war}" property="dist.jar.dir"/> |
+ <mkdir dir="${dist.jar.dir}"/> |
+ <jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF"> |
+ <fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/> |
+ </jar> |
+ </target> |
+ <target name="-post-dist"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/> |
+ <target depends="init,-clean-webinf-lib,-init-cos,compile,-pre-dist,do-ear-dist,-post-dist" description="Build distribution (WAR) to be packaged into an EAR." name="dist-ear"/> |
+ <!-- |
+ EXECUTION SECTION |
+ --> |
+ <target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/> |
+ <target name="-pre-run-deploy"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target name="-post-run-deploy"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target name="-pre-nbmodule-run-deploy"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. --> |
+ </target> |
+ <target name="-post-nbmodule-run-deploy"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. --> |
+ </target> |
+ <target name="-run-deploy-am"> |
+ <!-- Task to deploy to the Access Manager runtime. --> |
+ </target> |
+ <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/> |
+ <target if="netbeans.home" name="-run-deploy-nb"> |
+ <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/> |
+ </target> |
+ <target name="-init-deploy-ant" unless="netbeans.home"> |
+ <property name="deploy.ant.archive" value="${dist.war}"/> |
+ <property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/> |
+ <property name="deploy.ant.resource.dir" value="${resource.dir}"/> |
+ <property name="deploy.ant.enabled" value="true"/> |
+ </target> |
+ <target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/> |
+ <target if="netbeans.home" name="-run-undeploy-nb"> |
+ <fail message="Undeploy is not supported from within the IDE"/> |
+ </target> |
+ <target depends="init,-pre-dist,dist,-post-dist" name="verify"> |
+ <nbverify file="${dist.war}"/> |
+ </target> |
+ <target depends="run-deploy,-init-display-browser,-display-browser-nb-old,-display-browser-nb,-display-browser-cl" name="run-display-browser"/> |
+ <target if="do.display.browser" name="-init-display-browser"> |
+ <condition property="do.display.browser.nb.old"> |
+ <and> |
+ <isset property="netbeans.home"/> |
+ <not> |
+ <isset property="browser.context"/> |
+ </not> |
+ </and> |
+ </condition> |
+ <condition property="do.display.browser.nb"> |
+ <and> |
+ <isset property="netbeans.home"/> |
+ <isset property="browser.context"/> |
+ </and> |
+ </condition> |
+ <condition property="do.display.browser.cl"> |
+ <isset property="deploy.ant.enabled"/> |
+ </condition> |
+ </target> |
+ <target if="do.display.browser.nb.old" name="-display-browser-nb-old"> |
+ <nbbrowse url="${client.url}"/> |
+ </target> |
+ <target if="do.display.browser.nb" name="-display-browser-nb"> |
+ <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> |
+ </target> |
+ <target if="do.display.browser.cl" name="-get-browser" unless="browser"> |
+ <condition property="browser" value="rundll32"> |
+ <os family="windows"/> |
+ </condition> |
+ <condition else="" property="browser.args" value="url.dll,FileProtocolHandler"> |
+ <os family="windows"/> |
+ </condition> |
+ <condition property="browser" value="/usr/bin/open"> |
+ <os family="mac"/> |
+ </condition> |
+ <property environment="env"/> |
+ <condition property="browser" value="${env.BROWSER}"> |
+ <isset property="env.BROWSER"/> |
+ </condition> |
+ <condition property="browser" value="/usr/bin/firefox"> |
+ <available file="/usr/bin/firefox"/> |
+ </condition> |
+ <condition property="browser" value="/usr/local/firefox/firefox"> |
+ <available file="/usr/local/firefox/firefox"/> |
+ </condition> |
+ <condition property="browser" value="/usr/bin/mozilla"> |
+ <available file="/usr/bin/mozilla"/> |
+ </condition> |
+ <condition property="browser" value="/usr/local/mozilla/mozilla"> |
+ <available file="/usr/local/mozilla/mozilla"/> |
+ </condition> |
+ <condition property="browser" value="/usr/sfw/lib/firefox/firefox"> |
+ <available file="/usr/sfw/lib/firefox/firefox"/> |
+ </condition> |
+ <condition property="browser" value="/opt/csw/bin/firefox"> |
+ <available file="/opt/csw/bin/firefox"/> |
+ </condition> |
+ <condition property="browser" value="/usr/sfw/lib/mozilla/mozilla"> |
+ <available file="/usr/sfw/lib/mozilla/mozilla"/> |
+ </condition> |
+ <condition property="browser" value="/opt/csw/bin/mozilla"> |
+ <available file="/opt/csw/bin/mozilla"/> |
+ </condition> |
+ </target> |
+ <target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl"> |
+ <fail unless="browser"> |
+ Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. |
+ </fail> |
+ <property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/> |
+ <echo>Launching ${browse.url}</echo> |
+ <exec executable="${browser}" spawn="true"> |
+ <arg line="${browser.args} ${browse.url}"/> |
+ </exec> |
+ </target> |
+ <target depends="init,-init-cos,compile-single" name="run-main"> |
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail> |
+ <webproject1:java classname="${run.class}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main"> |
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail> |
+ <webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> |
+ </target> |
+ <target depends="init" if="netbeans.home" name="-do-update-breakpoints"> |
+ <webproject1:nbjpdaappreloaded/> |
+ </target> |
+ <!-- |
+ DEBUGGING SECTION |
+ --> |
+ <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" description="Debug project in IDE." if="netbeans.home" name="debug"> |
+ <nbstartserver debugmode="true"/> |
+ <antcall target="connect-debugger"/> |
+ <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/> |
+ <antcall target="debug-display-browser-old"/> |
+ <antcall target="debug-display-browser"/> |
+ <antcall target="connect-client-debugger"/> |
+ </target> |
+ <target if="do.debug.server" name="connect-debugger" unless="is.debugged"> |
+ <condition property="listeningcp" value="sourcepath"> |
+ <istrue value="${j2ee.compile.on.save}"/> |
+ </condition> |
+ <nbjpdaconnect address="${jpda.address}" host="${jpda.host}" listeningcp="${listeningcp}" name="${name}" transport="${jpda.transport}"> |
+ <classpath> |
+ <path path="${debug.classpath}:${j2ee.platform.classpath}"/> |
+ </classpath> |
+ <sourcepath> |
+ <path path="${web.docbase.dir}"/> |
+ </sourcepath> |
+ </nbjpdaconnect> |
+ </target> |
+ <target if="do.display.browser.debug.old" name="debug-display-browser-old"> |
+ <nbbrowse url="${client.url}"/> |
+ </target> |
+ <target if="do.display.browser.debug" name="debug-display-browser"> |
+ <nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/> |
+ </target> |
+ <target if="do.debug.client" name="connect-client-debugger"> |
+ <webproject1:nbjsdebugstart webUrl="${client.url}"/> |
+ </target> |
+ <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> |
+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> |
+ <webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> |
+ <target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/> |
+ <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> |
+ <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> |
+ </target> |
+ <target depends="init" if="netbeans.home" name="-debug-start-debugger"> |
+ <webproject1:nbjpdastart name="${debug.class}"/> |
+ </target> |
+ <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> |
+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> |
+ <webproject1:debug classname="${debug.class}"/> |
+ </target> |
+ <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/> |
+ <target depends="init" name="-pre-debug-fix"> |
+ <fail unless="fix.includes">Must set fix.includes</fail> |
+ <property name="javac.includes" value="${fix.includes}.java"/> |
+ </target> |
+ <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> |
+ <webproject1:nbjpdareload/> |
+ </target> |
+ <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> |
+ <!-- |
+ ================= |
+ PROFILING SECTION |
+ ================= |
+ --> |
+ <!-- |
+ pre NB7.2 profiling section; consider it deprecated |
+ --> |
+ <target description="Profile a J2EE project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> |
+ <condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs"> |
+ <isset property="profiler.info.jvmargs.extra"/> |
+ </condition> |
+ <antcall target="${profiler.startserver.target}"/> |
+ <antcall target="run"/> |
+ <antcall target="-profile-start-loadgen"/> |
+ </target> |
+ <target if="profiler.info.jvmargs.agent" name="start-profiled-server"> |
+ <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> |
+ <jvmarg value="${profiler.info.jvmargs.agent}"/> |
+ <jvmarg value="${profiler.j2ee.agentID}"/> |
+ </nbstartprofiledserver> |
+ </target> |
+ <target if="profiler.info.jvmargs.agent" name="start-profiled-server-extraargs"> |
+ <nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}"> |
+ <jvmarg value="${profiler.info.jvmargs.extra}"/> |
+ <jvmarg value="${profiler.info.jvmargs.agent}"/> |
+ <jvmarg value="${profiler.j2ee.agentID}"/> |
+ </nbstartprofiledserver> |
+ </target> |
+ <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> |
+ <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> |
+ <nbprofiledirect> |
+ <classpath> |
+ <path path="${run.test.classpath}"/> |
+ <path path="${j2ee.platform.classpath}"/> |
+ </classpath> |
+ </nbprofiledirect> |
+ <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> |
+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> |
+ <jvmarg value="${profiler.info.jvmargs.agent}"/> |
+ <jvmarg line="${profiler.info.jvmargs}"/> |
+ <test name="${profile.class}"/> |
+ <classpath> |
+ <path path="${run.test.classpath}"/> |
+ <path path="${j2ee.platform.classpath}"/> |
+ </classpath> |
+ <syspropertyset> |
+ <propertyref prefix="test-sys-prop."/> |
+ <mapper from="test-sys-prop.*" to="*" type="glob"/> |
+ </syspropertyset> |
+ <formatter type="brief" usefile="false"/> |
+ <formatter type="xml"/> |
+ </junit> |
+ </target> |
+ <target if="netbeans.home" name="-profile-check"> |
+ <condition property="profiler.configured"> |
+ <or> |
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> |
+ <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> |
+ </or> |
+ </condition> |
+ </target> |
+ <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" name="-do-profile"> |
+ <startprofiler/> |
+ <nbstartserver profilemode="true"/> |
+ <nbdeploy clientUrlPart="${client.urlPart}" forceRedeploy="true" profilemode="true"/> |
+ <antcall target="debug-display-browser-old"/> |
+ <antcall target="debug-display-browser"/> |
+ <antcall target="-profile-start-loadgen"/> |
+ </target> |
+ <target depends="-profile-check,-profile-pre72" description="Profile a J2EE project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> |
+ <antcall target="-do-profile"/> |
+ </target> |
+ <target depends="-profile-test-single-pre72" name="profile-test-single"/> |
+ <target depends="-profile-check" if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs.agent"> |
+ <startprofiler/> |
+ <antcall target="test-single"/> |
+ </target> |
+ <target if="profiler.loadgen.path" name="-profile-start-loadgen"> |
+ <loadgenstart path="${profiler.loadgen.path}"/> |
+ </target> |
+ <!-- |
+ JAVADOC SECTION |
+ --> |
+ <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}"> |
+ <classpath> |
+ <path path="${javac.classpath}:${j2ee.platform.classpath}"/> |
+ </classpath> |
+ <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> |
+ <filename name="**/*.java"/> |
+ </fileset> |
+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> |
+ <include name="**/*.java"/> |
+ </fileset> |
+ </javadoc> |
+ <copy todir="${dist.javadoc.dir}"> |
+ <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> |
+ <filename name="**/doc-files/**"/> |
+ </fileset> |
+ <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> |
+ <include name="**/doc-files/**"/> |
+ </fileset> |
+ </copy> |
+ </target> |
+ <target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview"> |
+ <nbbrowse file="${dist.javadoc.dir}/index.html"/> |
+ </target> |
+ <target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/> |
+ <!-- |
+ |
+ TEST COMPILATION SECTION |
+ --> |
+ <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> |
+ <mkdir dir="${build.test.classes.dir}"/> |
+ <property name="j2ee.platform.embeddableejb.classpath" value=""/> |
+ </target> |
+ <target name="-pre-compile-test"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test"> |
+ <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> |
+ <copy todir="${build.test.classes.dir}"> |
+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
+ </copy> |
+ </target> |
+ <target name="-post-compile-test"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> |
+ <target name="-pre-compile-test-single"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> |
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> |
+ <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/> |
+ <copy todir="${build.test.classes.dir}"> |
+ <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> |
+ </copy> |
+ </target> |
+ <target name="-post-compile-test-single"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> |
+ <!-- |
+ |
+ TEST EXECUTION SECTION |
+ --> |
+ <target depends="init" if="have.tests" name="-pre-test-run"> |
+ <mkdir dir="${build.test.results.dir}"/> |
+ </target> |
+ <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> |
+ <webproject2:test includes="${includes}" testincludes="**/*Test.java"/> |
+ </target> |
+ <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> |
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
+ </target> |
+ <target depends="init" if="have.tests" name="test-report"/> |
+ <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> |
+ <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> |
+ <target depends="init" if="have.tests" name="-pre-test-run-single"> |
+ <mkdir dir="${build.test.results.dir}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> |
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> |
+ <webproject2:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> |
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> |
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> |
+ <fail unless="test.class">Must select some files in the IDE or set test.class</fail> |
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail> |
+ <webproject2:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> |
+ <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> |
+ <!-- |
+ |
+ TEST DEBUGGING SECTION |
+ --> |
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> |
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail> |
+ <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> |
+ </target> |
+ <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> |
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail> |
+ <fail unless="test.method">Must select some method in the IDE or set test.method</fail> |
+ <webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> |
+ </target> |
+ <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> |
+ <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> |
+ </target> |
+ <target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> |
+ <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> |
+ <target depends="debug-test-method" name="debug-single-method"/> |
+ <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> |
+ <webproject1:nbjpdareload dir="${build.test.classes.dir}"/> |
+ </target> |
+ <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> |
+ <!-- |
+ |
+ CLEANUP SECTION |
+ --> |
+ <target depends="init" name="deps-clean" unless="no.deps"> |
+ <ant antfile="${project.csip-core}/build.xml" inheritall="false" target="clean"/> |
+ </target> |
+ <target depends="init" name="do-clean"> |
+ <condition property="build.dir.to.clean" value="${build.web.dir}"> |
+ <isset property="dist.ear.dir"/> |
+ </condition> |
+ <property name="build.dir.to.clean" value="${build.web.dir}"/> |
+ <delete includeEmptyDirs="true" quiet="true"> |
+ <fileset dir="${build.dir.to.clean}/WEB-INF/lib"/> |
+ </delete> |
+ <delete dir="${build.dir}"/> |
+ <available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/> |
+ <delete dir="${dist.dir}"/> |
+ </target> |
+ <target depends="do-clean" if="status.clean-failed" name="check-clean"> |
+ <echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/> |
+ <echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/> |
+ </target> |
+ <target depends="init" if="netbeans.home" name="undeploy-clean"> |
+ <nbundeploy failOnError="false" startServer="false"/> |
+ </target> |
+ <target name="-post-clean"> |
+ <!-- Empty placeholder for easier customization. --> |
+ <!-- You can override this target in the ../build.xml file. --> |
+ </target> |
+ <target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/> |
+ <target depends="clean" description="Clean build products." name="clean-ear"/> |
+</project> |
@@ -33,6 +33,7 @@ |
import javax.xml.parsers.ParserConfigurationException; |
import lmod2rusle2.Rusle2Translator; |
import static m.rusle2.V2_1.*; |
+import static m.rusle2.V3_0.ROMEDLL; |
import org.apache.commons.io.FileUtils; |
import org.apache.commons.lang3.StringEscapeUtils; |
import org.codehaus.jettison.json.JSONArray; |
@@ -48,448 +49,447 @@ |
* |
* @author wlloyd, od |
*/ |
-@Name( "Rusle2" ) |
-@Description( "IET / pyrome version of R2; RomeDLL 2.5.2.11; references NRCS Soil Data Mart" ) |
-@VersionInfo( "2.1" ) |
-@State( RELEASED ) |
-@Path( "m/rusle2/2.1" ) |
-@Polling( first = 1000, next = 1000 ) |
-@Resource( type = FILE, file = "/bin/win-x86/2.5.2.11/RomeDLL.dll", id = ROMEDLL ) |
-@Resource( type = FILE, file = "/bin/win-x86/2.5.2.11/pyrome.py", id = PYROMESRC ) |
-@Resource( type = FILE, file = "/bin/win-x86/2.5.2.11/_pyrome.pyd", id = PYROME ) |
-@Resource( type = ARCHIVE, file = "/bin/win-x86/Python34.zip" ) |
-@Resource( type = REFERENCE, file = "${csip.dir}/bin/win-x86/Python34/python.exe", wine = true, id = PYTHON ) |
-@Resource( type = FILE, file = "/bin/win-x86/rusle2_report.py", id = REPORT_PY_FILENAME ) |
-@Resource( type = FILE, file = "/bin/win-x86/Rusle2_Report.json", id = REPORT_JSON_TEMPLATE_FILENAME ) |
+@Name("Rusle2") |
+@Description("IET / pyrome version of R2; RomeDLL 2.5.2.11; references NRCS Soil Data Mart") |
+@VersionInfo("2.1") |
+@State(RELEASED) |
+@Path("m/rusle2/2.1") |
+@Polling(first = 1000, next = 1000) |
+@Resource(type = FILE, file = "/bin/win-x86/2.5.2.11/RomeDLL.dll", id = ROMEDLL) |
+@Resource(type = FILE, file = "/bin/win-x86/2.5.2.11/pyrome.py", id = PYROMESRC) |
+@Resource(type = FILE, file = "/bin/win-x86/2.5.2.11/_pyrome.pyd", id = PYROME) |
+@Resource(type = ARCHIVE, file = "/bin/win-x86/Python34.zip") |
+@Resource(type = REFERENCE, file = "${csip.dir}/bin/win-x86/Python34/python.exe", wine = true, id = PYTHON) |
+@Resource(type = FILE, file = "/bin/win-x86/rusle2_report.py", id = REPORT_PY_FILENAME) |
+@Resource(type = FILE, file = "/bin/win-x86/Rusle2_Report.json", id = REPORT_JSON_TEMPLATE_FILENAME) |
@Deprecated |
public class V2_1 extends ModelDataService { |
|
- static final String R2_TMP_FILENAME = "rusle2csip.py"; |
- static final String ROMEDLL = "RomeDLL.dll"; |
- static final String PYROMESRC = "pyrome.py"; |
- static final String PYROME = "_pyrome.pyd"; |
- static final String PYTHON = "python.exe"; |
- static final String REPORT_JSON_TEMPLATE_FILENAME = "Rusle2_Report.json"; |
- static final String REPORT_PY_FILENAME = "rusle2_report.py"; |
- static final String KEY_COKEY = "cokey"; |
+ static final String R2_TMP_FILENAME = "rusle2csip.py"; |
+ static final String ROMEDLL = "RomeDLL.dll"; |
+ static final String PYROMESRC = "pyrome.py"; |
+ static final String PYROME = "_pyrome.pyd"; |
+ static final String PYTHON = "python.exe"; |
+ static final String REPORT_JSON_TEMPLATE_FILENAME = "Rusle2_Report.json"; |
+ static final String REPORT_PY_FILENAME = "rusle2_report.py"; |
+ static final String KEY_COKEY = "cokey"; |
|
- /* |
+ /* |
* The R2 Run |
- */ |
- R2Run r2run = new R2Run(); |
- static final List<String> POT_RESULTS = Collections.unmodifiableList( Arrays.asList( |
- RES_SLOPE_DELIVERY, |
- RES_SLOPE_T_VALUE, |
- RES_SLOPE_DEGRAD, |
- RES_SLOPE_EQUIV_DIESEL_USE_PER_AREA, |
- RES_SOIL_COND_INDEX_STIR_VAL, |
- RES_SOIL_COND_INDEX_RESULT, |
- RES_SEG_SIM_DAY_LIVE_BIOMASS, |
- RES_SEG_SIM_DAY_COVER_MASS_SUM, |
- RES_SEG_SIM_DAY_STAND_MASS_SUM, |
- RES_SEG_SIM_DAY_CANOPY_COVER, |
- RES_SEG_SIM_DAY_PERENN_VEG_LIVE_HEIGHT, |
- RES_SLOPE_SIM_DAY_DEGRAD, |
- RES_SURF_RES_OUTPUTS_SURF_COV_AT_OP, |
- RES_SOIL_COND_INDEX_OM_SUBFACTOR, |
- RES_SOIL_COND_INDEX_FO_SUBFACTOR, |
- RES_SOIL_COND_INDEX_ER_SUBFACTOR ) ); |
- // |
- String climate; |
- String soil; |
- String mgmt; |
- List<String> operations; |
- List<String> vegetations; |
- List<String> residues; |
+ */ |
+ R2Run r2run = new R2Run(); |
+ static final List<String> POT_RESULTS = Collections.unmodifiableList(Arrays.asList( |
+ RES_SLOPE_DELIVERY, |
+ RES_SLOPE_T_VALUE, |
+ RES_SLOPE_DEGRAD, |
+ RES_SLOPE_EQUIV_DIESEL_USE_PER_AREA, |
+ RES_SOIL_COND_INDEX_STIR_VAL, |
+ RES_SOIL_COND_INDEX_RESULT, |
+ RES_SEG_SIM_DAY_LIVE_BIOMASS, |
+ RES_SEG_SIM_DAY_COVER_MASS_SUM, |
+ RES_SEG_SIM_DAY_STAND_MASS_SUM, |
+ RES_SEG_SIM_DAY_CANOPY_COVER, |
+ RES_SEG_SIM_DAY_PERENN_VEG_LIVE_HEIGHT, |
+ RES_SLOPE_SIM_DAY_DEGRAD, |
+ RES_SURF_RES_OUTPUTS_SURF_COV_AT_OP, |
+ RES_SOIL_COND_INDEX_OM_SUBFACTOR, |
+ RES_SOIL_COND_INDEX_FO_SUBFACTOR, |
+ RES_SOIL_COND_INDEX_ER_SUBFACTOR)); |
+ // |
+ String climate; |
+ String soil; |
+ String mgmt; |
+ List<String> operations; |
+ List<String> vegetations; |
+ List<String> residues; |
|
- String r2db = Config.getString( "r2.db", "http://oms-db.engr.colostate.edu/r2" ); |
+ String r2db = Config.getString("r2.db", "http://oms-db.engr.colostate.edu/r2"); |
|
- @Override |
- protected void preProcess () throws Exception { |
- // check for requested output. |
- r2run.setLogger( LOG ); |
- try { |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "\n\nMETAINFO:" ); |
- LOG.info( "\n" + metainfo().toString() ); |
- LOG.info( "\n\n\n" ); |
- } |
- V4_0.checkValidResultRequest( metainfo(), POT_RESULTS ); |
- } |
- catch ( ServiceException se ) { |
- LOG.severe( "\n\n\nERROR!!!\n\n\n" + se.toString() ); |
- LOG.warning( "No Rusle2 return parameters requested! Will use defaults: SLOPE_DELIVERY, SLOPE_T_VALUE, SLOPE_DEGRAD" ); |
- List<String> params = new LinkedList<>(); |
- params.add( RES_SLOPE_DELIVERY ); |
- params.add( RES_SLOPE_T_VALUE ); |
- params.add( RES_SLOPE_DEGRAD ); |
+ @Override |
+ protected void preProcess() throws Exception { |
+ // check for requested output. |
+ r2run.setLogger(LOG); |
+ try { |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("\n\nMETAINFO:"); |
+ LOG.info("\n" + metainfo().toString()); |
+ LOG.info("\n\n\n"); |
+ } |
+ V4_0.checkValidResultRequest(metainfo(), POT_RESULTS); |
+ } catch (ServiceException se) { |
+ LOG.severe("\n\n\nERROR!!!\n\n\n" + se.toString()); |
+ LOG.warning("No Rusle2 return parameters requested! Will use defaults: SLOPE_DELIVERY, SLOPE_T_VALUE, SLOPE_DEGRAD"); |
+ List<String> params = new LinkedList<>(); |
+ params.add(RES_SLOPE_DELIVERY); |
+ params.add(RES_SLOPE_T_VALUE); |
+ params.add(RES_SLOPE_DEGRAD); |
|
- // check if these are being set |
- if ( parameter().has( KEY_CONTOUR_SYSTEM_PTR ) ) { |
- params.add( "CONTOUR_SYSTEM_PTR" ); |
- } |
- if ( parameter().has( KEY_STRIP_BARRIER_SYSTEM_PTR ) ) { |
- params.add( "STRIP_BARRIER_SYSTEM_PTR" ); |
- } |
- if ( parameter().has( KEY_HYD_ELEM_SYSTEM_PTR ) ) { |
- params.add( "HYD_ELEM_SYSTEM_PTR" ); |
- } |
+ // check if these are being set |
+ if (parameter().has(KEY_CONTOUR_SYSTEM_PTR)) { |
+ params.add("CONTOUR_SYSTEM_PTR"); |
+ } |
+ if (parameter().has(KEY_STRIP_BARRIER_SYSTEM_PTR)) { |
+ params.add("STRIP_BARRIER_SYSTEM_PTR"); |
+ } |
+ if (parameter().has(KEY_HYD_ELEM_SYSTEM_PTR)) { |
+ params.add("HYD_ELEM_SYSTEM_PTR"); |
+ } |
// getMetainfo().put( KEY_REQUEST_RESULTS, params ); |
- } |
- |
- // check if sufficient input is there. |
- parameter().require( KEY_SOILS, KEY_LENGTH, KEY_STEEPNESS, KEY_MGMTS ); |
- |
- if ( !r2run.isUrlReachable( "" ) ) { |
- throw new ServiceException( "R2 file server unreachable at: " + r2db ); |
- } |
- |
- File r2script = workspace().getFile( R2_TMP_FILENAME ); |
- |
- String[] reqResults = metainfo().getStringArray(KEY_REQUEST_RESULTS); |
- createInputFile( r2script, reqResults, getParamMap() ); |
} |
|
- @Override |
- protected void doProcess () throws Exception { |
- r2run.executePyrome( workspace().getFile( R2_TMP_FILENAME ), resources().getExe( PYTHON ), getSUID()); |
+ // check if sufficient input is there. |
+ parameter().require(KEY_SOILS, KEY_LENGTH, KEY_STEEPNESS, KEY_MGMTS); |
+ |
+ if (!r2run.isUrlReachable("")) { |
+ throw new ServiceException("R2 file server unreachable at: " + r2db); |
} |
|
- @Override |
- protected void postProcess () throws Exception { |
- int errors = 0; |
- for ( int i = 0; i < operations.size(); i++ ) { |
- String op = operations.get( i ); |
- if ( r2run.isFileUrlReachable( op ) ) { |
- results().put( "OPERATION_" + ( i + 1 ), op, "operation is valid" ); |
- } else { |
- results().put( "OPERATION_INVALID_" + ( i + 1 ), op, "OPERATION IS MISSING!" ); |
- errors++; |
- } |
- } |
- for ( int i = 0; i < vegetations.size(); i++ ) { |
- String vege = vegetations.get( i ); |
- if ( r2run.isFileUrlReachable( vege ) ) { |
- results().put( "VEGETATION_" + ( i + 1 ), vege, "vegetation is valid" ); |
- } else { |
- results().put( "VEGETATION_INVALID_" + ( i + 1 ), vege, "VEGETATION IS MISSING" ); |
- errors++; |
- } |
- } |
- for ( int i = 0; i < residues.size(); i++ ) { |
- String res = residues.get( i ); |
- if ( r2run.isFileUrlReachable( res ) ) { |
- results().put( "RESIDUE_" + ( i + 1 ), res, "residue is valid" ); |
- } else { |
- results().put( "RESIDUE_INVALID_" + ( i + 1 ), res, "RESIDUE IS MISSING" ); |
- errors++; |
- } |
- } |
+ File r2script = workspace().getFile(R2_TMP_FILENAME); |
|
- String[] reqResults = metainfo().getStringArray(KEY_REQUEST_RESULTS); |
- for ( String r : reqResults ) { |
- if ( ( errors > 0 ) && ( r.equals( RES_SLOPE_DEGRAD ) ) ) { |
- results().put( r, r2run.getResultPyrome( r ), R2_MISSING_XML_FILES_WARNING_MSG ); |
- } else { |
- results().put( r, r2run.getResultPyrome( r ) ); |
- } |
- } |
+ String[] reqResults = metainfo().getStringArray(KEY_REQUEST_RESULTS); |
+ createInputFile(r2script, reqResults, getParamMap()); |
+ } |
|
- // Get erosion for segments |
- if ( parameter().has( KEY_TOPO_LENGTH ) ) { |
- JSONArray aTopoLength = JSONUtils.getJSONArrayParam( getParamMap(), KEY_TOPO_LENGTH ); |
- if ( aTopoLength.length() > 0 ) { |
- JSONArray aSoilLoss = new JSONArray( r2run.getResultPyromeArray( "SEG_SOIL_LOSS", false, false, true ) ); |
- results().put( "SEG_SOIL_LOSS", aSoilLoss ); |
- results().put( KEY_CLIMATES, climate ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "\n\n\n\n\n\nSEG SOIL OUTPUT=" + r2run.getResultPyromeArray( "SEG_SOIL", true, true, true ) + "\n\n\n\n" ); |
- LOG.info( "\n\n\n\n\n\nSEG SOIL OUTPUT=" + r2run.getResultPyromeArray( "SEG_MAN", true, true, true ) + "\n\n\n\n" ); |
- } |
- results().put( KEY_SOILS, new JSONArray( r2run.getResultPyromeArray( "SEG_SOIL", true, true, true ) ) ); |
- results().put( KEY_MANAGEMENTS, new JSONArray( r2run.getResultPyromeArray( "SEG_MAN", true, true, true ) ) ); |
- if ( parameter().has( KEY_DIVERSIONS ) ) { |
- results().put( KEY_DIVERSIONS, r2run.getResultPyromeArray( "HYD_ELEM_SYS", true, true, true ) ); |
- } |
- if ( parameter().has( KEY_STRIP_BARRIER_SYSTEMS ) ) { |
- results().put( KEY_STRIP_BARRIER_SYSTEMS, r2run.getResultPyromeArray( "STRIP_BARRIER_SYS", true, true, true ) ); |
- } |
- } |
- } else { |
- results().put( KEY_CLIMATES, climate ); |
- results().put( KEY_SOILS, new JSONArray( r2run.getResultPyromeArray( "SEG_SOIL", true, true, true ) ) ); |
- results().put( KEY_MANAGEMENTS, new JSONArray( r2run.getResultPyromeArray( "SEG_MAN", true, true, true ) ) ); |
- } |
+ @Override |
+ protected void doProcess() throws Exception { |
+ r2run.executePyrome(workspace().getFile(R2_TMP_FILENAME), resources().getExe(PYTHON), getSUID()); |
+ } |
+ |
+ @Override |
+ protected void postProcess() throws Exception { |
+ int errors = 0; |
+ for (int i = 0; i < operations.size(); i++) { |
+ String op = operations.get(i); |
+ if (r2run.isFileUrlReachable(op)) { |
+ results().put("OPERATION_" + (i + 1), op, "operation is valid"); |
+ } else { |
+ results().put("OPERATION_INVALID_" + (i + 1), op, "OPERATION IS MISSING!"); |
+ errors++; |
+ } |
+ } |
+ for (int i = 0; i < vegetations.size(); i++) { |
+ String vege = vegetations.get(i); |
+ if (r2run.isFileUrlReachable(vege)) { |
+ results().put("VEGETATION_" + (i + 1), vege, "vegetation is valid"); |
+ } else { |
+ results().put("VEGETATION_INVALID_" + (i + 1), vege, "VEGETATION IS MISSING"); |
+ errors++; |
+ } |
+ } |
+ for (int i = 0; i < residues.size(); i++) { |
+ String res = residues.get(i); |
+ if (r2run.isFileUrlReachable(res)) { |
+ results().put("RESIDUE_" + (i + 1), res, "residue is valid"); |
+ } else { |
+ results().put("RESIDUE_INVALID_" + (i + 1), res, "RESIDUE IS MISSING"); |
+ errors++; |
+ } |
} |
|
- private void createInputFile ( File file, String[] reqResults, Map<String, JSONObject> param ) |
- throws Exception { |
+ String[] reqResults = metainfo().getStringArray(KEY_REQUEST_RESULTS); |
+ for (String r : reqResults) { |
+ if ((errors > 0) && (r.equals(RES_SLOPE_DEGRAD))) { |
+ results().put(r, r2run.getResultPyrome(r), R2_MISSING_XML_FILES_WARNING_MSG); |
+ } else { |
+ results().put(r, r2run.getResultPyrome(r)); |
+ } |
+ } |
|
- double steepness = parameter().getDouble( KEY_STEEPNESS, 0.0 ); |
- double length = parameter().getDouble( KEY_LENGTH, 0.0 ); |
- boolean resolveLoc = parameter().getBoolean( KEY_RESOLVE_LOCATION, false ); |
- double latitude = parameter().getDouble( KEY_LATITUDE, 0.0 ); |
- double longitude = parameter().getDouble( KEY_LONGITUDE, 0.0 ); |
- double simpleRockCoverPercent = 0.0; |
+ // Get erosion for segments |
+ if (parameter().has(KEY_TOPO_LENGTH)) { |
+ JSONArray aTopoLength = JSONUtils.getJSONArrayParam(getParamMap(), KEY_TOPO_LENGTH); |
+ if (aTopoLength.length() > 0) { |
+ JSONArray aSoilLoss = new JSONArray(r2run.getResultPyromeArray("SEG_SOIL_LOSS", false, false, true)); |
+ results().put("SEG_SOIL_LOSS", aSoilLoss); |
+ results().put(KEY_CLIMATES, climate); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("\n\n\n\n\n\nSEG SOIL OUTPUT=" + r2run.getResultPyromeArray("SEG_SOIL", true, true, true) + "\n\n\n\n"); |
+ LOG.info("\n\n\n\n\n\nSEG SOIL OUTPUT=" + r2run.getResultPyromeArray("SEG_MAN", true, true, true) + "\n\n\n\n"); |
+ } |
+ results().put(KEY_SOILS, new JSONArray(r2run.getResultPyromeArray("SEG_SOIL", true, true, true))); |
+ results().put(KEY_MANAGEMENTS, new JSONArray(r2run.getResultPyromeArray("SEG_MAN", true, true, true))); |
+ if (parameter().has(KEY_DIVERSIONS)) { |
+ results().put(KEY_DIVERSIONS, r2run.getResultPyromeArray("HYD_ELEM_SYS", true, true, true)); |
+ } |
+ if (parameter().has(KEY_STRIP_BARRIER_SYSTEMS)) { |
+ results().put(KEY_STRIP_BARRIER_SYSTEMS, r2run.getResultPyromeArray("STRIP_BARRIER_SYS", true, true, true)); |
+ } |
+ } |
+ } else { |
+ results().put(KEY_CLIMATES, climate); |
+ results().put(KEY_SOILS, new JSONArray(r2run.getResultPyromeArray("SEG_SOIL", true, true, true))); |
+ results().put(KEY_MANAGEMENTS, new JSONArray(r2run.getResultPyromeArray("SEG_MAN", true, true, true))); |
+ } |
+ } |
|
- LOG.info( "Rock cover read by service is=" + simpleRockCoverPercent ); |
+ private void createInputFile(File file, String[] reqResults, Map<String, JSONObject> param) |
+ throws Exception { |
|
- JSONArray aRockCover = JSONUtils.getJSONArrayParam( param, KEY_SIMPLE_ROCK_COVER ); |
- for ( int i = 0; i < aRockCover.length(); i++ ) { |
- LOG.info( "Rock cover [" + i + "]=" + aRockCover.getDouble( i ) ); |
- // this is temporary, since R2 will be using slope segments soon |
- if ( i == 0 ) { |
- simpleRockCoverPercent = aRockCover.getDouble( i ); |
- } |
+ double steepness = parameter().getDouble(KEY_STEEPNESS, 0.0); |
+ double length = parameter().getDouble(KEY_LENGTH, 0.0); |
+ boolean resolveLoc = parameter().getBoolean(KEY_RESOLVE_LOCATION, false); |
+ double latitude = parameter().getDouble(KEY_LATITUDE, 0.0); |
+ double longitude = parameter().getDouble(KEY_LONGITUDE, 0.0); |
+ double simpleRockCoverPercent = 0.0; |
+ |
+ LOG.info("Rock cover read by service is=" + simpleRockCoverPercent); |
+ |
+ JSONArray aRockCover = JSONUtils.getJSONArrayParam(param, KEY_SIMPLE_ROCK_COVER); |
+ for (int i = 0; i < aRockCover.length(); i++) { |
+ LOG.info("Rock cover [" + i + "]=" + aRockCover.getDouble(i)); |
+ // this is temporary, since R2 will be using slope segments soon |
+ if (i == 0) { |
+ simpleRockCoverPercent = aRockCover.getDouble(i); |
+ } |
+ } |
+ |
+ JSONArray aSoils = JSONUtils.getJSONArrayParam(param, KEY_SOILS); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ for (int i = 0; i < aSoils.length(); i++) { |
+ LOG.info("soil [" + i + "]=" + aSoils.getInt(i)); |
+ } |
+ } |
+ |
+ // scalar variables for non-segmented runs |
+ String contourSystem = ""; |
+ String stripBarrierSystem = ""; |
+ String hydElemSystem = ""; |
+ |
+ // Get the Contour System if not default |
+ if (parameter().has(KEY_CONTOUR_SYSTEM_PTR)) { |
+ contourSystem = parameter().getString(KEY_CONTOUR_SYSTEM_PTR, ""); |
+ } |
+ |
+ // Get the Strip Barrier System |
+ if (parameter().has(KEY_STRIP_BARRIER_SYSTEM_PTR)) { |
+ stripBarrierSystem = parameter().getString(KEY_STRIP_BARRIER_SYSTEM_PTR, ""); |
+ } |
+ |
+ // Get the Hydraylic Element System Pointer |
+ if (parameter().has(KEY_HYD_ELEM_SYSTEM_PTR)) { |
+ hydElemSystem = parameter().getString(KEY_HYD_ELEM_SYSTEM_PTR, ""); |
+ } |
+ |
+ JSONArray aTopoLength = new JSONArray(); |
+ JSONArray aTopoSteepness = new JSONArray(); |
+ JSONArray aSoilIdx = new JSONArray(); |
+ JSONArray aManIdx = new JSONArray(); |
+ JSONArray aManLength = new JSONArray(); |
+ |
+ if (parameter().has(KEY_TOPO_LENGTH)) { |
+ aTopoLength = JSONUtils.getJSONArrayParam(param, KEY_TOPO_LENGTH); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ for (int i = 0; i < aTopoLength.length(); i++) { |
+ LOG.info("Topo Length [" + i + "]=" + aTopoLength.getDouble(i)); |
} |
+ } |
+ } |
|
- JSONArray aSoils = JSONUtils.getJSONArrayParam( param, KEY_SOILS ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- for ( int i = 0; i < aSoils.length(); i++ ) { |
- LOG.info( "soil [" + i + "]=" + aSoils.getInt( i ) ); |
- } |
+ if (parameter().has(KEY_TOPO_STEEPNESS)) { |
+ aTopoSteepness = JSONUtils.getJSONArrayParam(param, KEY_TOPO_STEEPNESS); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ for (int i = 0; i < aTopoSteepness.length(); i++) { |
+ LOG.info("Topo Steepness [" + i + "]=" + aTopoSteepness.getDouble(i)); |
} |
+ } |
+ } |
|
- // scalar variables for non-segmented runs |
- String contourSystem = ""; |
- String stripBarrierSystem = ""; |
- String hydElemSystem = ""; |
+ if (parameter().has(KEY_SOIL_INDEX)) { |
+ aSoilIdx = JSONUtils.getJSONArrayParam(param, KEY_SOIL_INDEX); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ for (int i = 0; i < aSoilIdx.length(); i++) { |
+ LOG.info("Soil Index [" + i + "]=" + aSoilIdx.getInt(i)); |
+ } |
+ } |
+ } |
|
- // Get the Contour System if not default |
- if ( parameter().has( KEY_CONTOUR_SYSTEM_PTR ) ) { |
- contourSystem = parameter().getString( KEY_CONTOUR_SYSTEM_PTR, "" ); |
+ if (parameter().has(KEY_MAN_INDEX)) { |
+ aManIdx = JSONUtils.getJSONArrayParam(param, KEY_MAN_INDEX); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ for (int i = 0; i < aManIdx.length(); i++) { |
+ LOG.info("Man Index [" + i + "]=" + aManIdx.getInt(i)); |
} |
+ } |
+ } |
|
- // Get the Strip Barrier System |
- if ( parameter().has( KEY_STRIP_BARRIER_SYSTEM_PTR ) ) { |
- stripBarrierSystem = parameter().getString( KEY_STRIP_BARRIER_SYSTEM_PTR, "" ); |
+ if (parameter().has(KEY_MAN_LENGTH)) { |
+ aManLength = JSONUtils.getJSONArrayParam(param, KEY_MAN_LENGTH); |
+ for (int i = 0; i < aManLength.length(); i++) { |
+ LOG.info("Man Length [" + i + "]=" + aManLength.getInt(i)); |
+ } |
+ } |
+ |
+ if (parameter().has(KEY_TOPO_LENGTH)) { |
+ if (aTopoLength.length() != aTopoSteepness.length()) { |
+ throw new ServiceException("RUSLE2 SEGMENT RUN ERROR! SEGMENT ARRAYS FOR TOPO LENGTH AND TOPO STEEPNESS MUST BE OF EQUAL SIZE!"); |
+ } |
+ } |
+ |
+ if (parameter().has(KEY_MAN_INDEX)) { |
+ if (aManLength.length() != aManIdx.length()) { |
+ throw new ServiceException("RUSLE2 SEGMENT RUN ERROR! SEGMENT ARRAYS FOR MGMT LENGTH AND MGMT INDEX MUST BE OF EQUAL SIZE!"); |
+ } |
+ } |
+ |
+ // management conversion |
+ // Make file line separator unix compatible. ???? not sure if needed. |
+ System.setProperty("line.separator", "\n"); |
+ |
+ JSONArray managements = JSONUtils.getJSONArrayParam(param, KEY_MGMTS); |
+ |
+ LOG.info("managements array=" + managements.toString()); |
+ String[] managementFormalName = new String[managements.length()]; |
+ |
+ for (int i = 0; i < managements.length(); i++) { |
+ LOG.info("management #" + i); |
+ |
+ JSONObject lmod = (JSONObject) managements.get(i); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info(lmod.toString()); |
+ } |
+ |
+ Rusle2Translator translator = new Rusle2Translator(); |
+ translator.readJsonString(lmod.toString()); |
+ |
+ boolean success = translator.Translate(); |
+ LOG.info("translation successful =" + success); |
+ |
+ Document r2_xml = translator.getDocument(); |
+ |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("R2 XML FILE from translator:\n\n" + translator.getRusle2Xml()); |
+ } |
+ |
+ if ((r2_xml != null) && (r2_xml.getElementsByTagName("Filename") != null)) { |
+ NodeList nl = r2_xml.getElementsByTagName("Filename"); |
+ for (int ii = 0; ii < nl.getLength(); ii++) { |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("filename node=" + nl.item(ii).getTextContent()); |
+ } |
+ managementFormalName[i] = nl.item(ii).getTextContent(); |
} |
+ } |
|
- // Get the Hydraylic Element System Pointer |
- if ( parameter().has( KEY_HYD_ELEM_SYSTEM_PTR ) ) { |
- hydElemSystem = parameter().getString( KEY_HYD_ELEM_SYSTEM_PTR, "" ); |
+ translator.writeRusle2Xml(workspace().getDir().toString(), "lmod_file" + i + ".xml"); |
+ operations = translator.getOperationFiles(); |
+ vegetations = translator.getVegetationFiles(); |
+ residues = translator.getResidueFiles(); |
+ |
+ if (LOG.isLoggable(Level.INFO)) { |
+ operations.forEach((operation) -> { |
+ LOG.info("operation=" + operation); |
+ }); |
+ vegetations.forEach((vege) -> { |
+ LOG.info("vegetation=" + vege); |
+ }); |
+ residues.forEach((residue) -> { |
+ LOG.info("residue=" + residue); |
+ }); |
+ } |
+ } |
+ |
+ // If this is a Lat/Lng request, then we need to make a DB lookup |
+ // to obtain the Climate and Soil information and ignore whatever |
+ // may have been passed in |
+ LOG.info("Rulse 2 model request resolveLocation=" + resolveLoc); |
+ |
+ // Sub-service calls. |
+ String climatePtr = getClimateFilePath(latitude, longitude); |
+ String[] soilPtr = getSoilFiles(aSoils); |
+ |
+ PrintWriter pw = new PrintWriter(file); |
+ pw.append("import sys\n" |
+ // could rewrite this line based on the OS, but python is interpretting it ok on windows |
+ + "sys.path.append('" + resources().getFile(PYROMESRC).getParent().replace('\\', '/') + "')\n" |
+ + "from pyrome import *\n" |
+ + "\n" |
+ + "def linearTest(save = False, openFlags = RX_FILESOPEN_TEMP):\n" |
+ + " romeDLL = RomeInit('')\n" |
+ + " files = RomeGetFiles(romeDLL)\n" |
+ + " engine = RomeGetEngine(romeDLL)\n" |
+ + " RomeEngineSetAutorun(engine,RX_FALSE)\n" |
+ + " #Inputs\n"); |
+ |
+ if (aTopoLength.length() > 1) { |
+ String text = " slopes=["; |
+ for (int i = 0; i < aTopoSteepness.length(); i++) { |
+ text += "'" + aTopoSteepness.getInt(i) + "'"; |
+ text += (i == aTopoSteepness.length() - 1) ? "]\n" : ","; |
+ } |
+ pw.append(text); |
+ text = " lengths=["; |
+ for (int i = 0; i < aTopoLength.length(); i++) { |
+ text += "'" + aTopoLength.getInt(i) + "'"; |
+ text += (i == aTopoLength.length() - 1) ? "]\n" : ","; |
+ } |
+ pw.append(text); |
+ if ((aSoilIdx != null) && (aSoilIdx.length() > 0)) { |
+ text = " soilIndex=["; |
+ for (int i = 0; i < aSoilIdx.length(); i++) { |
+ text += aSoilIdx.getInt(i) + ""; |
+ text += (i == aSoilIdx.length() - 1) ? "]\n" : ","; |
} |
+ pw.append(text); |
+ } |
+ text = " manIndex=["; |
+ for (int i = 0; i < aManIdx.length(); i++) { |
+ text += aManIdx.getInt(i) + ""; |
+ text += (i == aManIdx.length() - 1) ? "]\n" : ","; |
+ } |
+ pw.append(text); |
+ } else { |
+ pw.append(" slopes=['" + steepness + "']\n" |
+ + " lengths=['" + length + "']\n" |
+ + " soilIndex=[0]\n" |
+ + " manIndex=[0]\n"); |
+ } |
|
- JSONArray aTopoLength = new JSONArray(); |
- JSONArray aTopoSteepness = new JSONArray(); |
- JSONArray aSoilIdx = new JSONArray(); |
- JSONArray aManIdx = new JSONArray(); |
- JSONArray aManLength = new JSONArray(); |
+ pw.append(" results = list()\n" |
+ + " #Run a simple profile\n" |
+ + " profile = RomeFilesOpen(files,'profiles\\\\csippyrome',openFlags)\n"); |
|
- if ( parameter().has( KEY_TOPO_LENGTH ) ) { |
- aTopoLength = JSONUtils.getJSONArrayParam( param, KEY_TOPO_LENGTH ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- for ( int i = 0; i < aTopoLength.length(); i++ ) { |
- LOG.info( "Topo Length [" + i + "]=" + aTopoLength.getDouble( i ) ); |
- } |
- } |
- } |
+ // Open all of the mgmt files... |
+ for (int i = 0; i < managements.length(); i++) { |
+ pw.append(" mgmt = RomeFilesOpen(files, '#XML:lmod_file" + i + ".xml',0)\n"); |
+ } |
+ pw.append(" cli = RomeFilesOpen(files, '#XML:cli_file0.xml',0)\n"); |
+ for (int i = 0; i < aSoils.length(); i++) { |
+ pw.append(" soil" + i + " = RomeFilesOpen(files, '#XML:soils_file" + i + ".xml',0)\n"); |
+ } |
+ pw.append(" # SET SLOPE\n" |
+ + " RomeFileSetAttrValue(profile, 'SLOPE_HORIZ', '" + length + "', 0)\n" |
+ + " RomeFileSetAttrValue(profile, 'SLOPE_STEEP', '" + steepness + "', 0)\n" |
+ + " # SET CLIMATE_PTR\n" |
+ + " RomeFileSetAttrValue(profile, 'CLIMATE_PTR','climates\\\\aaa',0)\n" |
+ + " print('CLIMATE_PTR=%s' % RomeFileGetAttrValue(profile, 'CLIMATE_PTR', 0))\n"); |
|
- if ( parameter().has( KEY_TOPO_STEEPNESS ) ) { |
- aTopoSteepness = JSONUtils.getJSONArrayParam( param, KEY_TOPO_STEEPNESS ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- for ( int i = 0; i < aTopoSteepness.length(); i++ ) { |
- LOG.info( "Topo Steepness [" + i + "]=" + aTopoSteepness.getDouble( i ) ); |
- } |
- } |
- } |
+ pw.append(" # SET TOPO LAYER\n"); |
+ if (aTopoLength.length() > 0) { |
+ pw.append(" RomeFileSetAttrSize(profile, 'TOPO_LAYER', " + aTopoLength.length() + ")\n"); |
+ for (int i = 0; i < aTopoLength.length(); i++) { |
+ pw.append(" RomeFileSetAttrValue(profile, 'TOPO_HORIZ', '" + aTopoLength.getString(i) + "', " + i + ")\n" |
+ + " RomeFileSetAttrValue(profile, 'TOPO_STEEP', '" + aTopoSteepness.getString(i) + "', " + i + ")\n"); |
+ } |
+ } |
|
- if ( parameter().has( KEY_SOIL_INDEX ) ) { |
- aSoilIdx = JSONUtils.getJSONArrayParam( param, KEY_SOIL_INDEX ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- for ( int i = 0; i < aSoilIdx.length(); i++ ) { |
- LOG.info( "Soil Index [" + i + "]=" + aSoilIdx.getInt( i ) ); |
- } |
- } |
- } |
+ // Presently we do not support multiple soils |
+ pw.append(" # SET SOIL LAYER\n"); |
+ if (aSoils.length() > 0) { |
+ pw.append(" RomeFileSetAttrSize(profile, 'SOIL_LAYER', " + aSoils.length() + ")\n" |
+ + " RomeFileSetAttrValue(profile, 'SOIL_HORIZ', '" + length + "', 0)\n" |
+ + " RomeFileSetAttrValue(profile, 'SOIL_PTR', '" + StringEscapeUtils.escapeJava(soilPtr[0]) + "', " + 0 + ")\n"); |
+ } |
|
- if ( parameter().has( KEY_MAN_INDEX ) ) { |
- aManIdx = JSONUtils.getJSONArrayParam( param, KEY_MAN_INDEX ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- for ( int i = 0; i < aManIdx.length(); i++ ) { |
- LOG.info( "Man Index [" + i + "]=" + aManIdx.getInt( i ) ); |
- } |
- } |
- } |
- |
- if ( parameter().has( KEY_MAN_LENGTH ) ) { |
- aManLength = JSONUtils.getJSONArrayParam( param, KEY_MAN_LENGTH ); |
- for ( int i = 0; i < aManLength.length(); i++ ) { |
- LOG.info( "Man Length [" + i + "]=" + aManLength.getInt( i ) ); |
- } |
- } |
- |
- if ( parameter().has( KEY_TOPO_LENGTH ) ) { |
- if ( aTopoLength.length() != aTopoSteepness.length() ) { |
- throw new ServiceException( "RUSLE2 SEGMENT RUN ERROR! SEGMENT ARRAYS FOR TOPO LENGTH AND TOPO STEEPNESS MUST BE OF EQUAL SIZE!" ); |
- } |
- } |
- |
- if ( parameter().has( KEY_MAN_INDEX ) ) { |
- if ( aManLength.length() != aManIdx.length() ) { |
- throw new ServiceException( "RUSLE2 SEGMENT RUN ERROR! SEGMENT ARRAYS FOR MGMT LENGTH AND MGMT INDEX MUST BE OF EQUAL SIZE!" ); |
- } |
- } |
- |
- // management conversion |
- // Make file line separator unix compatible. ???? not sure if needed. |
- System.setProperty( "line.separator", "\n" ); |
- |
- JSONArray managements = JSONUtils.getJSONArrayParam( param, KEY_MGMTS ); |
- |
- LOG.info( "managements array=" + managements.toString() ); |
- String[] managementFormalName = new String[managements.length()]; |
- |
- for ( int i = 0; i < managements.length(); i++ ) { |
- LOG.info( "management #" + i ); |
- |
- JSONObject lmod = ( JSONObject ) managements.get( i ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( lmod.toString() ); |
- } |
- |
- Rusle2Translator translator = new Rusle2Translator(); |
- translator.readJsonString( lmod.toString() ); |
- |
- boolean success = translator.Translate(); |
- LOG.info( "translation successful =" + success ); |
- |
- Document r2_xml = translator.getDocument(); |
- |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "R2 XML FILE from translator:\n\n" + translator.getRusle2Xml() ); |
- } |
- |
- if ( ( r2_xml != null ) && ( r2_xml.getElementsByTagName( "Filename" ) != null ) ) { |
- NodeList nl = r2_xml.getElementsByTagName( "Filename" ); |
- for ( int ii = 0; ii < nl.getLength(); ii++ ) { |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "filename node=" + nl.item( ii ).getTextContent() ); |
- } |
- managementFormalName[i] = nl.item( ii ).getTextContent(); |
- } |
- } |
- |
- translator.writeRusle2Xml( workspace().getDir().toString(), "lmod_file" + i + ".xml" ); |
- operations = translator.getOperationFiles(); |
- vegetations = translator.getVegetationFiles(); |
- residues = translator.getResidueFiles(); |
- |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- operations.forEach( (operation) -> { |
- LOG.info( "operation=" + operation ); |
- } ); |
- vegetations.forEach( (vege) -> { |
- LOG.info( "vegetation=" + vege ); |
- } ); |
- residues.forEach( (residue) -> { |
- LOG.info( "residue=" + residue ); |
- } ); |
- } |
- } |
- |
- // If this is a Lat/Lng request, then we need to make a DB lookup |
- // to obtain the Climate and Soil information and ignore whatever |
- // may have been passed in |
- LOG.info( "Rulse 2 model request resolveLocation=" + resolveLoc ); |
- |
- // Sub-service calls. |
- String climatePtr = getClimateFilePath( latitude, longitude ); |
- String[] soilPtr = getSoilFiles( aSoils ); |
- |
- PrintWriter pw = new PrintWriter( file ); |
- pw.append( "import sys\n" |
- // could rewrite this line based on the OS, but python is interpretting it ok on windows |
- + "sys.path.append('" + resources().getFile( PYROMESRC ).getParent().replace( '\\', '/' ) + "')\n" |
- + "from pyrome import *\n" |
- + "\n" |
- + "def linearTest(save = False, openFlags = RX_FILESOPEN_TEMP):\n" |
- + " romeDLL = RomeInit('')\n" |
- + " files = RomeGetFiles(romeDLL)\n" |
- + " engine = RomeGetEngine(romeDLL)\n" |
- + " RomeEngineSetAutorun(engine,RX_FALSE)\n" |
- + " #Inputs\n" ); |
- |
- if ( aTopoLength.length() > 1 ) { |
- String text = " slopes=["; |
- for ( int i = 0; i < aTopoSteepness.length(); i++ ) { |
- text += "'" + aTopoSteepness.getInt( i ) + "'"; |
- text += ( i == aTopoSteepness.length() - 1 ) ? "]\n" : ","; |
- } |
- pw.append( text ); |
- text = " lengths=["; |
- for ( int i = 0; i < aTopoLength.length(); i++ ) { |
- text += "'" + aTopoLength.getInt( i ) + "'"; |
- text += ( i == aTopoLength.length() - 1 ) ? "]\n" : ","; |
- } |
- pw.append( text ); |
- if ( ( aSoilIdx != null ) && ( aSoilIdx.length() > 0 ) ) { |
- text = " soilIndex=["; |
- for ( int i = 0; i < aSoilIdx.length(); i++ ) { |
- text += aSoilIdx.getInt( i ) + ""; |
- text += ( i == aSoilIdx.length() - 1 ) ? "]\n" : ","; |
- } |
- pw.append( text ); |
- } |
- text = " manIndex=["; |
- for ( int i = 0; i < aManIdx.length(); i++ ) { |
- text += aManIdx.getInt( i ) + ""; |
- text += ( i == aManIdx.length() - 1 ) ? "]\n" : ","; |
- } |
- pw.append( text ); |
- } else { |
- pw.append( " slopes=['" + steepness + "']\n" |
- + " lengths=['" + length + "']\n" |
- + " soilIndex=[0]\n" |
- + " manIndex=[0]\n" ); |
- } |
- |
- pw.append( " results = list()\n" |
- + " #Run a simple profile\n" |
- + " profile = RomeFilesOpen(files,'profiles\\\\csippyrome',openFlags)\n" ); |
- |
- // Open all of the mgmt files... |
- for ( int i = 0; i < managements.length(); i++ ) { |
- pw.append( " mgmt = RomeFilesOpen(files, '#XML:lmod_file" + i + ".xml',0)\n" ); |
- } |
- pw.append( " cli = RomeFilesOpen(files, '#XML:cli_file0.xml',0)\n" ); |
- for ( int i = 0; i < aSoils.length(); i++ ) { |
- pw.append( " soil" + i + " = RomeFilesOpen(files, '#XML:soils_file" + i + ".xml',0)\n" ); |
- } |
- pw.append( " # SET SLOPE\n" |
- + " RomeFileSetAttrValue(profile, 'SLOPE_HORIZ', '" + length + "', 0)\n" |
- + " RomeFileSetAttrValue(profile, 'SLOPE_STEEP', '" + steepness + "', 0)\n" |
- + " # SET CLIMATE_PTR\n" |
- + " RomeFileSetAttrValue(profile, 'CLIMATE_PTR','climates\\\\aaa',0)\n" |
- + " print('CLIMATE_PTR=%s' % RomeFileGetAttrValue(profile, 'CLIMATE_PTR', 0))\n" ); |
- |
- pw.append( " # SET TOPO LAYER\n" ); |
- if ( aTopoLength.length() > 0 ) { |
- pw.append( " RomeFileSetAttrSize(profile, 'TOPO_LAYER', " + aTopoLength.length() + ")\n" ); |
- for ( int i = 0; i < aTopoLength.length(); i++ ) { |
- pw.append( " RomeFileSetAttrValue(profile, 'TOPO_HORIZ', '" + aTopoLength.getString( i ) + "', " + i + ")\n" |
- + " RomeFileSetAttrValue(profile, 'TOPO_STEEP', '" + aTopoSteepness.getString( i ) + "', " + i + ")\n" ); |
- } |
- } |
- |
- // Presently we do not support multiple soils |
- pw.append( " # SET SOIL LAYER\n" ); |
- if ( aSoils.length() > 0 ) { |
- pw.append( " RomeFileSetAttrSize(profile, 'SOIL_LAYER', " + aSoils.length() + ")\n" |
- + " RomeFileSetAttrValue(profile, 'SOIL_HORIZ', '" + length + "', 0)\n" |
- + " RomeFileSetAttrValue(profile, 'SOIL_PTR', '" + StringEscapeUtils.escapeJava( soilPtr[0] ) + "', " + 0 + ")\n" ); |
- } |
- |
- // Must be after set soils or the soils code resets it...sometimes |
- if ( parameter().has( KEY_SIMPLE_ROCK_COVER ) ) { |
- pw.append( " RomeFileSetAttrValue(profile, 'SIMPLE_ROCK_COVER', '" + simpleRockCoverPercent + "' ,0)\n" ); |
- } |
- pw.append( " # SET MAN LAYER\n" ); |
- if ( aManIdx.length() > 0 ) { |
- pw.append( " RomeFileSetAttrSize(profile, 'MAN_LAYER', " + aManIdx.length() + ")\n" ); |
- for ( int i = 0; i < aManIdx.length(); i++ ) { |
- pw.append( " RomeFileSetAttrValue(profile, 'MAN_HORIZ', '" + aManLength.getString( i ) + "', " + i + ")\n" ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
+ // Must be after set soils or the soils code resets it...sometimes |
+ if (parameter().has(KEY_SIMPLE_ROCK_COVER)) { |
+ pw.append(" RomeFileSetAttrValue(profile, 'SIMPLE_ROCK_COVER', '" + simpleRockCoverPercent + "' ,0)\n"); |
+ } |
+ pw.append(" # SET MAN LAYER\n"); |
+ if (aManIdx.length() > 0) { |
+ pw.append(" RomeFileSetAttrSize(profile, 'MAN_LAYER', " + aManIdx.length() + ")\n"); |
+ for (int i = 0; i < aManIdx.length(); i++) { |
+ pw.append(" RomeFileSetAttrValue(profile, 'MAN_HORIZ', '" + aManLength.getString(i) + "', " + i + ")\n"); |
+ if (LOG.isLoggable(Level.INFO)) { |
// LOG.info( "escapeJava test=" + StringEscapeUtils.escapeJava( "simple / test" ) ); |
// LOG.info( "escapeJava test=" + StringEscapeUtils.escapeJavaScript( "simple / test" ) ); |
// LOG.info( "\n\n\n********************--- escapeJava man name=" + StringEscapeUtils.escapeJava( managementFormalName[aManIdx.getInt( i )] ) ); |
@@ -497,16 +497,16 @@ |
// LOG.info( "********************--- escapeHtml man name=" + StringEscapeUtils.escapeHtml( managementFormalName[aManIdx.getInt( i )] ) ); |
// LOG.info( "********************--- escapeSql man name=" + StringEscapeUtils.escapeSql( managementFormalName[aManIdx.getInt( i )] ) ); |
// LOG.info( "********************--- escapeXml man name=" + StringEscapeUtils.escapeXml( managementFormalName[aManIdx.getInt( i )] ) ); |
- LOG.info( "********************--- raw Value is=" + managementFormalName[aManIdx.getInt( i )] ); |
- } |
- pw.append( " RomeFileSetAttrValue(profile, 'MAN_PTR', '" + R2Run.escapeJavaNoFwdSlash( managementFormalName[aManIdx.getInt( i )] ) + "', " + i + ")\n" ); |
- } |
- } else { |
- // IF no max_idx array provided, defaulting to single mgmt |
- pw.append( " RomeFileSetAttrSize(profile, 'MAN_LAYER', 1)\n" |
- + " RomeFileSetAttrValue(profile, 'MAN_HORIZ', '" + length + "', 0)\n" ); |
+ LOG.info("********************--- raw Value is=" + managementFormalName[aManIdx.getInt(i)]); |
+ } |
+ pw.append(" RomeFileSetAttrValue(profile, 'MAN_PTR', '" + R2Run.escapeJavaNoFwdSlash(managementFormalName[aManIdx.getInt(i)]) + "', " + i + ")\n"); |
+ } |
+ } else { |
+ // IF no max_idx array provided, defaulting to single mgmt |
+ pw.append(" RomeFileSetAttrSize(profile, 'MAN_LAYER', 1)\n" |
+ + " RomeFileSetAttrValue(profile, 'MAN_HORIZ', '" + length + "', 0)\n"); |
|
- if ( LOG.isLoggable( Level.INFO ) ) { |
+ if (LOG.isLoggable(Level.INFO)) { |
// LOG.info( "escapeJava test=" + StringEscapeUtils.escapeJava( "simple / test" ) ); |
// LOG.info( "escapeJava test=" + StringEscapeUtils.escapeJavaScript( "simple / test" ) ); |
// LOG.info( "\n\n\n********************--- escapeJava man name=" + StringEscapeUtils.escapeJava( managementFormalName[0] ) ); |
@@ -514,367 +514,374 @@ |
// LOG.info( "********************--- escapeHtml man name=" + StringEscapeUtils.escapeHtml( managementFormalName[0] ) ); |
// LOG.info( "********************--- escapeSql man name=" + StringEscapeUtils.escapeSql( managementFormalName[0] ) ); |
// LOG.info( "********************--- escapeXml man name=" + StringEscapeUtils.escapeXml( managementFormalName[0] ) ); |
- LOG.info( "********************--- raw Value is=" + managementFormalName[0] ); |
- } |
- pw.append( " RomeFileSetAttrValue(profile, 'MAN_PTR', '" + R2Run.escapeJavaNoFwdSlash( managementFormalName[0] ) + "', 0)\n" ); |
- } |
- pw.append( " print('SOIL_PTR=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', 0))\n" ); |
+ LOG.info("********************--- raw Value is=" + managementFormalName[0]); |
+ } |
+ pw.append(" RomeFileSetAttrValue(profile, 'MAN_PTR', '" + R2Run.escapeJavaNoFwdSlash(managementFormalName[0]) + "', 0)\n"); |
+ } |
+ pw.append(" print('SOIL_PTR=%s' % RomeFileGetAttrValue(profile, 'SOIL_PTR', 0))\n"); |
|
- if ( ( contourSystem != null ) && ( contourSystem.length() > 1 ) ) { |
- // Contour Systems can simply point to the nginx XML file - no need to prefetch because of no special |
- // characters in the file name |
- pw.append( " RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', '" + StringEscapeUtils.escapeJava( contourSystem ) + "', 0)\n" ); |
- } |
- |
- // To prevent issues with pyrome converting special chars in filenames to invalid chars for web server retrieval, |
- // we prefetch the file, insert a dummy name, and point to it here |
- if ( ( stripBarrierSystem != null ) && ( stripBarrierSystem.length() > 1 ) ) { |
- // for some reason, must reset SLOPE_HORIZ & SLOPE_STEEP immediately before setting a strip and barrier !!! R2 BUG |
- // This is required for the internal Rusle2 wizard to calculate proper slope segment lengths |
- pw.append( " stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file0.xml',0)\n" |
- + " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa', 0)\n" ); |
- } |
- |
- // Runs with a Hydraulic Element System, use a hydraulic element flow path |
- if ( ( hydElemSystem != null ) && ( hydElemSystem.length() > 1 ) ) { |
- // Load the hyd elem flow path into the workspace |
- pw.append( " hydelem = RomeFilesOpen(files, '#XML:hydelemflowpath_file.xml',0)\n" ); |
- int numFlowPaths = r2run.determineNumberOfFlowPaths( hydElemSystem ); |
- pw.append( " RomeFileSetAttrSize(profile, 'NUM_FLOW_PATHS', " + numFlowPaths + ")\n" ); |
- double offsets[] = r2run.determineFlowPathDistribution( hydElemSystem ); |
- for ( int i = 0; i < numFlowPaths; i++ ) { |
- pw.append( " RomeFileSetAttrValue(profile, 'FLOW_PATH_HORIZ', '" + length * offsets[i] + "', " + i + ")\n" ); |
- if ( i < ( numFlowPaths - 1 ) ) { |
- pw.append( " RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\hydelemflowpath1', " + i + ")\n" ); |
- } else { |
- // last flow path is always the default |
- pw.append( " RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\default', " + i + ")\n" ); |
- } |
- } |
- } |
- |
- pw.append( " RomeFileSave(profile)\n" |
- + " RomeEngineRun(engine)\n" ); |
- |
- // Request specific outputs from Rusle2 |
- for ( String r : reqResults ) { |
- pw.append( " paramsize = RomeFileGetAttrSize(profile,'" + r + "')\n" |
- + " if paramsize > 1:\n" |
- + " text = '['\n" |
- + " for x in range (paramsize):\n" |
- + " text += RomeFileGetAttrValue(profile,'" + r + "',x)\n" |
- + " if x < (paramsize-1):\n" |
- + " text += ', '\n" |
- + " text += ']'\n" |
- + " else:\n" |
- + " text = RomeFileGetAttrValue(profile, '" + r + "', 0)\n" |
- + " results.append(RomeFileGetAttrValue(profile, '" + r + "', 0))\n" |
- + " print('" + r + "=%s' % text)\n" ); |
- } |
- |
- // Request output for segments (seg 0 for non segmented runs) |
- pw.append( " numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
- + " for xx in range (numflowpaths):\n" |
- + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
- + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
- + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
- + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
- + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
- + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
- + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
- + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
- + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
- + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
- + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
- + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
- + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
- + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" ); |
- |
- pw.append( " numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
- + " for xx in range (numflowpaths):\n" |
- + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
- + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
- + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
- + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
- + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
- + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
- + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
- + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
- + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
- + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
- + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
- + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
- + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
- + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" ); |
- |
- pw.append( " numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
- + " for xx in range (numflowpaths):\n" |
- + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
- + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
- + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
- + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
- + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
- + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
- + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
- + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
- + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
- + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
- + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
- + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
- + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
- + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'SOIL_LAYER')\n" |
- + " print('NUMBER OF SOIL SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('SOIL_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_LAYER', x)))\n" |
- + " print('SOIL_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_HORIZ', x)))\n" |
- + " print('SOIL_PTR:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'MAN_LAYER')\n" |
- + " print('NUMBER OF MAN SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('MAN_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_LAYER', x)))\n" |
- + " print('MAN_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_HORIZ', x)))\n" |
- + " print('MAN_PTR:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " numsegs = RomeFileGetAttrSize(profile, 'TOPO_LAYER')\n" |
- + " print('NUMBER OF TOPO SEGMENTS=%d' % numsegs)\n" |
- + " for x in range (numsegs):\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " print('TOPO_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_LAYER', x)))\n" |
- + " print('TOPO_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_HORIZ', x)))\n" |
- + " print('TOPO_HORIZ_COMPOSITE:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_HORIZ_COMPOSITE', x)))\n" |
- + " print('TOPO_STEEP:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_STEEP', x)))\n" |
- + " print('TOPO_STEEP_COMPOSITE:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_STEEP_COMPOSITE', x)))\n" |
- + " print('------------------------------------------------------------------------------')\n" |
- + " exec(open(\"" + REPORT_PY_FILENAME + "\").read())\n" |
- + " RomeFileClose(profile)\n" |
- + " return results\n\n" |
- + "if __name__ == \"__main__\":\n" |
- + " #inputs\n" |
- + " save = False\n" |
- + " #Run simulation\n" |
- + " romeDLL = RomeInit('pyrome /DirRoot=" + resources().getFile( ROMEDLL ).getParent().replace( '\\', '/' ) + "/')\n" |
- + " database = RomeGetDatabase(romeDLL)\n" ); |
- |
- // prints all outputs in single array |
- // Specify the nginx server |
- if ( !parameter().has( KEY_ALT_R2DB ) ) { |
- pw.append( " RomeDatabaseOpen(database,'" + r2db + "')\n" ); |
- } else { |
- String altr2db = r2db.substring( 0, r2db.lastIndexOf( "/" ) ) + "/model-data/" + parameter().getString( KEY_ALT_R2DB ); |
- pw.append( " RomeDatabaseOpen(database,'" + altr2db + "')\n" ); |
- } |
- |
- pw.append( " results = linearTest(save)\n" |
- + " RomeDatabaseClose(database)\n" |
- + " RomeExit(romeDLL)\n" |
- + " exit()\n" |
- ); |
- pw.close(); |
- |
- // prepare individual contour system, strip barrier system, hyd elem sys, if not provided in an array |
- if ( parameter().has( KEY_CONTOUR_SYSTEM_PTR ) ) { |
- String contourHttpPtr = r2db + "/" + contourSystem.replace( "\\", "/" ) + ".xml"; |
- r2run.prepareFileJ( contourHttpPtr, workspace().getFile( "contour_file0.xml" ), "", "contour-systems", "", true ); |
- } |
- if ( parameter().has( KEY_STRIP_BARRIER_SYSTEM_PTR ) ) { |
- String stripbarrHttpPtr = r2db + "/" + stripBarrierSystem.replace( "\\", "/" ) + ".xml"; |
- r2run.prepareFileJ( stripbarrHttpPtr, workspace().getFile( "stripbarr_file0.xml" ), "", "strip-barrier-systems", "", true ); |
- } |
- if ( parameter().has( KEY_HYD_ELEM_SYSTEM_PTR ) ) { |
- String hydelemHttpPtr = r2db + "/" + hydElemSystem.replace( "\\", "/" ) + ".xml"; |
- r2run.prepareHydraulicElementFlowPathJ( hydelemHttpPtr, r2db, workspace().getFile( "hydelemflowpath_file.xml" ) ); |
- } |
- |
- // prepare climate file |
- r2run.prepareFileJ( climatePtr, workspace().getFile( "cli_file0.xml" ), "CLIMATE", "climates", "", true ); |
- |
- // Unpack the report rsh file in the work space dir |
- FileUtils.copyFileToDirectory( resources().getFile( REPORT_PY_FILENAME ), workspace().getDir() ); |
- |
- climate = climatePtr; |
- soil = soilPtr[0]; |
- mgmt = managementFormalName[0]; |
+ if ((contourSystem != null) && (contourSystem.length() > 1)) { |
+ // Contour Systems can simply point to the nginx XML file - no need to prefetch because of no special |
+ // characters in the file name |
+ pw.append(" RomeFileSetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', '" + StringEscapeUtils.escapeJava(contourSystem) + "', 0)\n"); |
} |
|
- private String[] getSoilFiles ( JSONArray cokeys ) throws JSONException, Exception { |
- String soilPtr[] = new String[( cokeys.length() )]; |
- JSONObject soilsRequest = new JSONObject(); |
- JSONObject meta = new JSONObject(); |
- JSONArray paramObj = new JSONArray(); |
- JSONObject cokeyObj = new JSONObject(); |
- |
- soilsRequest.put( KEY_METAINFO, meta ); |
- soilsRequest.put( KEY_PARAMETER, paramObj ); |
- paramObj.put( cokeyObj ); |
- |
- for ( int i = 0; i < cokeys.length(); i++ ) { |
- String cokey = cokeys.getString( i ); |
- paramObj.put( 0, cokeyObj ); |
- cokeyObj.put( KEY_NAME, KEY_COKEY ); |
- cokeyObj.put( KEY_VALUE, cokey ); |
- JSONObject soilsResponse = new Client().doPOST( Config.getString( "r2.soils", "http://csip.engr.colostate.edu:8092/csip-soils/d/soilsXML/1.0" ), soilsRequest ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "SOILS Response: " + soilsResponse.toString() ); |
- } |
- JSONObject responseMeta = soilsResponse.getJSONObject( KEY_METAINFO ); |
- if ( !responseMeta.getString( KEY_STATUS ).equalsIgnoreCase( "Failed" ) ) { |
- JSONArray resultArr = soilsResponse.getJSONArray( KEY_RESULT ); |
- JSONObject soilObj = resultArr.getJSONObject( 0 ); |
- String soilFilePath = soilObj.getString( KEY_VALUE ); |
- |
- new Client().doGET( soilFilePath, workspace().getFile( "soils_file" + i + ".xml" ) ); |
- |
- soilPtr[i] = getSoilFilePath( workspace().getFile( "soils_file" + i + ".xml" ) ).replace( "/", "\\" ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "THE SOIL IS =" + soilPtr[i] + "\n\n\n\n" ); |
- } |
- } else { |
- String error = responseMeta.getString( ERROR ); |
- throw new ServiceException( "Soil service error: " + error ); |
- } |
- } |
- return soilPtr; |
+ // To prevent issues with pyrome converting special chars in filenames to invalid chars for web server retrieval, |
+ // we prefetch the file, insert a dummy name, and point to it here |
+ if ((stripBarrierSystem != null) && (stripBarrierSystem.length() > 1)) { |
+ // for some reason, must reset SLOPE_HORIZ & SLOPE_STEEP immediately before setting a strip and barrier !!! R2 BUG |
+ // This is required for the internal Rusle2 wizard to calculate proper slope segment lengths |
+ pw.append(" stripbarr = RomeFilesOpen(files, '#XML:stripbarr_file0.xml',0)\n" |
+ + " RomeFileSetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', 'strip-barrier-systems\\\\aaa', 0)\n"); |
} |
|
- private String getSoilFilePath ( File soilFile ) throws ParserConfigurationException, SAXException, IOException { |
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); |
- DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); |
- Document document = documentBuilder.parse( soilFile ); |
- String path = document.getElementsByTagName( "Filename" ).item( 0 ).getTextContent(); |
- return path; |
+ // Runs with a Hydraulic Element System, use a hydraulic element flow path |
+ if ((hydElemSystem != null) && (hydElemSystem.length() > 1)) { |
+ // Load the hyd elem flow path into the workspace |
+ pw.append(" hydelem = RomeFilesOpen(files, '#XML:hydelemflowpath_file.xml',0)\n"); |
+ int numFlowPaths = r2run.determineNumberOfFlowPaths(hydElemSystem); |
+ pw.append(" RomeFileSetAttrSize(profile, 'NUM_FLOW_PATHS', " + numFlowPaths + ")\n"); |
+ double offsets[] = r2run.determineFlowPathDistribution(hydElemSystem); |
+ for (int i = 0; i < numFlowPaths; i++) { |
+ pw.append(" RomeFileSetAttrValue(profile, 'FLOW_PATH_HORIZ', '" + length * offsets[i] + "', " + i + ")\n"); |
+ if (i < (numFlowPaths - 1)) { |
+ pw.append(" RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\hydelemflowpath1', " + i + ")\n"); |
+ } else { |
+ // last flow path is always the default |
+ pw.append(" RomeFileSetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', 'hydraulic-element-flow-paths\\default', " + i + ")\n"); |
+ } |
+ } |
} |
|
- private String getClimateFilePath ( double lat, double lon ) throws JSONException, Exception { |
- JSONObject climateReq = new JSONObject(); |
- JSONObject meta = new JSONObject(); |
- JSONArray param = new JSONArray(); |
- JSONObject jlat = new JSONObject(); |
- JSONObject jlong = new JSONObject(); |
- String climatePath = ""; |
+ pw.append(" RomeFileSave(profile)\n" |
+ + " RomeEngineRun(engine)\n"); |
|
- climateReq.put( KEY_METAINFO, meta ); |
- climateReq.put( KEY_PARAMETER, param ); |
- |
- param.put( jlat ); |
- param.put( jlong ); |
- |
- jlat.put( KEY_NAME, KEY_LATITUDE ); |
- jlat.put( KEY_VALUE, lat ); |
- |
- jlong.put( KEY_NAME, KEY_LONGITUDE ); |
- jlong.put( KEY_VALUE, lon ); |
- |
- JSONObject climateResponse = new Client().doPOST( Config.getString( "r2.climate", "http://csip.engr.colostate.edu:8092/csip-misc/d/r2climate/2.0" ), climateReq ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "CLIMATE Response: " + climateResponse.toString() ); |
- } |
- JSONObject responseMeta = climateResponse.getJSONObject( KEY_METAINFO ); |
- if ( !responseMeta.getString( KEY_STATUS ).equalsIgnoreCase( "Failed" ) ) { |
- JSONArray resultArr = climateResponse.getJSONArray( KEY_RESULT ); |
- JSONObject cliObj = JSONUtils.preprocess( resultArr ).get( KEY_CLIMATE_URL ); |
- climatePath = cliObj.getString( KEY_VALUE ); |
- } |
- return climatePath; |
+ // Request specific outputs from Rusle2 |
+ for (String r : reqResults) { |
+ pw.append(" paramsize = RomeFileGetAttrSize(profile,'" + r + "')\n" |
+ + " if paramsize > 1:\n" |
+ + " text = '['\n" |
+ + " for x in range (paramsize):\n" |
+ + " text += RomeFileGetAttrValue(profile,'" + r + "',x)\n" |
+ + " if x < (paramsize-1):\n" |
+ + " text += ', '\n" |
+ + " text += ']'\n" |
+ + " else:\n" |
+ + " text = RomeFileGetAttrValue(profile, '" + r + "', 0)\n" |
+ + " results.append(RomeFileGetAttrValue(profile, '" + r + "', 0))\n" |
+ + " print('" + r + "=%s' % text)\n"); |
} |
|
- @Override |
- protected void doReport () throws Exception { |
- String sReportJSON = FileUtils.readFileToString( resources().getFile( REPORT_JSON_TEMPLATE_FILENAME ) ); |
- JSONArray reportItemsFromTemplate = new JSONArray( sReportJSON ); |
- for ( int i = 0; i < reportItemsFromTemplate.length(); i++ ) { |
- JSONObject obj = ( JSONObject ) reportItemsFromTemplate.get( i ); |
- String itemName = obj.getString( REPORT_NAME ); |
- String dimension = JSONUtils.getJSONString( obj, REPORT_DIM, null ); |
- String type = JSONUtils.getJSONString( obj, REPORT_TYPE, "" ); |
- String units = JSONUtils.getJSONString( obj, REPORT_UNITS, null ); |
- String desc = JSONUtils.getJSONString( obj, REPORT_DESC, null ); |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "--------------------PROCESSING ELEMENT:" ); |
- LOG.info( "VAR NAME:" + itemName ); |
- LOG.info( "---------------------------------------" ); |
- } |
+ // Request output for segments (seg 0 for non segmented runs) |
+ pw.append(" numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
+ + " for xx in range (numflowpaths):\n" |
+ + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
+ + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
+ + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
+ + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
+ + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
+ + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
+ + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
+ + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
+ + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
+ + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
+ + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
+ + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
+ + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
+ + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n"); |
|
- //String value = r2run.getResultPyrome(itemName); |
- String value = r2run.getResult( "\"" + itemName + "\"" ); |
- LOG.info( "the value='" + value + "'" ); |
- if ( ( value != null ) && ( value.equals( "null" ) ) ) { |
- report().put( itemName, ( String ) null, desc, units ); |
- // if there is no value, then item should be removed from the array |
- } else { |
- if ( ( dimension != null ) && ( dimension.length() > 0 ) && ( value != null ) && ( !value.equals( "null" ) ) ) { |
- try { |
- report().put( itemName, new JSONArray( value ), desc, units ); |
- } |
- catch ( JSONException je ) { |
- processReportElement( itemName, dimension, units, desc, type, value ); |
- } |
- } else { |
- processReportElement( itemName, dimension, units, desc, type, value ); |
- } |
- } |
- if ( dimension != null ) { |
- report().putMetaInfo( itemName, REPORT_DIM, new JSONArray( dimension ) ); |
- } |
- } |
+ pw.append(" numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
+ + " for xx in range (numflowpaths):\n" |
+ + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
+ + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
+ + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
+ + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
+ + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
+ + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
+ + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
+ + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
+ + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
+ + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
+ + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
+ + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
+ + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
+ + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n"); |
+ |
+ pw.append(" numflowpaths = RomeFileGetAttrSize(profile, 'NUM_FLOW_PATHS')\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('NUMBER OF FLOWPATHS=%d' % numflowpaths)\n" |
+ + " for xx in range (numflowpaths):\n" |
+ + " print('FLOW_PATH_HORIZ:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'FLOW_PATH_HORIZ', xx)))\n" |
+ + " print('HYD_ELEM_FLOW_PATH_PTR:%d=%s' % (xx, RomeFileGetAttrValue(profile, 'HYD_ELEM_FLOW_PATH_PTR', xx)))\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'SEGMENT')\n" |
+ + " print('NUMBER OF SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEGMENT', x)))\n" |
+ + " print('SEG_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_HORIZ', x)))\n" |
+ + " print('SEG_STEEP:%d=%s' % (x,RomeFileGetAttrValue(profile, 'SEG_STEEP', x)))\n" |
+ + " print('SEG_MAN:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
+ + " print('SEG_SOIL:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
+ + " results.append(RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x))\n" |
+ + " print('SEG_SOIL_LOSS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LOSS', x)))\n" |
+ + " print('SEG_SOIL_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_SOIL_LAYER', x)))\n" |
+ + " print('SEG_MAN_LAYER %d=%s' % (x, RomeFileGetAttrValue(profile, 'SEG_MAN_LAYER', x)))\n" |
+ + " print('HYD_ELEM_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'HYD_ELEM_SYSTEM_PTR', x)))\n" |
+ + " print('STRIP_BARRIER_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'STRIP_BARRIER_SYSTEM_PTR', x)))\n" |
+ + " print('CONTOUR_SYS:%d=%s' % (x, RomeFileGetAttrValue(profile, 'CONTOUR_SYSTEM_PTR', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'SOIL_LAYER')\n" |
+ + " print('NUMBER OF SOIL SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('SOIL_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_LAYER', x)))\n" |
+ + " print('SOIL_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_HORIZ', x)))\n" |
+ + " print('SOIL_PTR:%d=%s' % (x, RomeFileGetAttrValue(profile, 'SOIL_PTR', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'MAN_LAYER')\n" |
+ + " print('NUMBER OF MAN SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('MAN_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_LAYER', x)))\n" |
+ + " print('MAN_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_HORIZ', x)))\n" |
+ + " print('MAN_PTR:%d=%s' % (x, RomeFileGetAttrValue(profile, 'MAN_PTR', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " numsegs = RomeFileGetAttrSize(profile, 'TOPO_LAYER')\n" |
+ + " print('NUMBER OF TOPO SEGMENTS=%d' % numsegs)\n" |
+ + " for x in range (numsegs):\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " print('TOPO_SEGMENT:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_LAYER', x)))\n" |
+ + " print('TOPO_HORIZ:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_HORIZ', x)))\n" |
+ + " print('TOPO_HORIZ_COMPOSITE:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_HORIZ_COMPOSITE', x)))\n" |
+ + " print('TOPO_STEEP:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_STEEP', x)))\n" |
+ + " print('TOPO_STEEP_COMPOSITE:%d=%s' % (x, RomeFileGetAttrValue(profile, 'TOPO_STEEP_COMPOSITE', x)))\n" |
+ + " print('------------------------------------------------------------------------------')\n" |
+ + " exec(open(\"" + REPORT_PY_FILENAME + "\").read())\n" |
+ + " RomeFileClose(profile)\n" |
+ + " return results\n\n" |
+ + "if __name__ == \"__main__\":\n" |
+ + " #inputs\n" |
+ + " save = False\n" |
+ + " #Run simulation\n" |
+ + " romeDLL = RomeInit('pyrome /DirRoot=" + resources().getFile(ROMEDLL).getParent().replace('\\', '/') + "/')\n" |
+ + " database = RomeGetDatabase(romeDLL)\n"); |
+ |
+ // prints all outputs in single array |
+ // Specify the nginx server |
+ if (!parameter().has(KEY_ALT_R2DB)) { |
+ pw.append(" RomeDatabaseOpen(database,'" + r2db + "')\n"); |
+ } else { |
+ String altr2db = r2db.substring(0, r2db.lastIndexOf("/")) + "/model-data/" + parameter().getString(KEY_ALT_R2DB); |
+ pw.append(" RomeDatabaseOpen(database,'" + altr2db + "')\n"); |
} |
|
- // This is a gross signiture but due to csip report changes this is the easiest way to change it without losing Wes's logic. |
- private void processReportElement ( String itemName, String dim, String units, String desc, String type, String value ) throws Exception { |
- if ( LOG.isLoggable( Level.INFO ) ) { |
- LOG.info( "------------------------------------PROCESSING ELEMENT:\n\n" ); |
- LOG.info( "TYPE:" + type ); |
- LOG.info( "VALUE:" + value ); |
- LOG.info( "------------------------------------\n\n" ); |
+ pw.append(" results = linearTest(save)\n" |
+ + " RomeDatabaseClose(database)\n" |
+ + " RomeExit(romeDLL)\n" |
+ + " exit()\n" |
+ ); |
+ pw.close(); |
+ |
+ // prepare individual contour system, strip barrier system, hyd elem sys, if not provided in an array |
+ if (parameter().has(KEY_CONTOUR_SYSTEM_PTR)) { |
+ String contourHttpPtr = r2db + "/" + contourSystem.replace("\\", "/") + ".xml"; |
+ r2run.prepareFileJ(contourHttpPtr, workspace().getFile("contour_file0.xml"), "", "contour-systems", "", true); |
+ } |
+ if (parameter().has(KEY_STRIP_BARRIER_SYSTEM_PTR)) { |
+ String stripbarrHttpPtr = r2db + "/" + stripBarrierSystem.replace("\\", "/") + ".xml"; |
+ r2run.prepareFileJ(stripbarrHttpPtr, workspace().getFile("stripbarr_file0.xml"), "", "strip-barrier-systems", "", true); |
+ } |
+ if (parameter().has(KEY_HYD_ELEM_SYSTEM_PTR)) { |
+ String hydelemHttpPtr = r2db + "/" + hydElemSystem.replace("\\", "/") + ".xml"; |
+ r2run.prepareHydraulicElementFlowPathJ(hydelemHttpPtr, r2db, workspace().getFile("hydelemflowpath_file.xml")); |
+ } |
+ |
+ // prepare climate file |
+ r2run.prepareFileJ(climatePtr, workspace().getFile("cli_file0.xml"), "CLIMATE", "climates", "", true); |
+ |
+ // Unpack the report rsh file in the work space dir |
+ FileUtils.copyFileToDirectory(resources().getFile(REPORT_PY_FILENAME), workspace().getDir()); |
+ |
+ climate = climatePtr; |
+ soil = soilPtr[0]; |
+ mgmt = managementFormalName[0]; |
+ } |
+ |
+ private String[] getSoilFiles(JSONArray cokeys) throws JSONException, Exception { |
+ String soilPtr[] = new String[(cokeys.length())]; |
+ JSONObject soilsRequest = new JSONObject(); |
+ JSONObject meta = new JSONObject(); |
+ JSONArray paramObj = new JSONArray(); |
+ JSONObject cokeyObj = new JSONObject(); |
+ |
+ soilsRequest.put(KEY_METAINFO, meta); |
+ soilsRequest.put(KEY_PARAMETER, paramObj); |
+ paramObj.put(cokeyObj); |
+ |
+ for (int i = 0; i < cokeys.length(); i++) { |
+ String cokey = cokeys.getString(i); |
+ paramObj.put(0, cokeyObj); |
+ cokeyObj.put(KEY_NAME, KEY_COKEY); |
+ cokeyObj.put(KEY_VALUE, cokey); |
+ JSONObject soilsResponse = new Client().doPOST(Config.getString("r2.soils", "http://csip.engr.colostate.edu:8092/csip-soils/d/soilsXML/1.0"), soilsRequest); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("SOILS Response: " + soilsResponse.toString()); |
+ } |
+ JSONObject responseMeta = soilsResponse.getJSONObject(KEY_METAINFO); |
+ if (!responseMeta.getString(KEY_STATUS).equalsIgnoreCase("Failed")) { |
+ JSONArray resultArr = soilsResponse.getJSONArray(KEY_RESULT); |
+ JSONObject soilObj = resultArr.getJSONObject(0); |
+ String soilFilePath = soilObj.getString(KEY_VALUE); |
+ |
+ new Client().doGET(soilFilePath, workspace().getFile("soils_file" + i + ".xml")); |
+ |
+ soilPtr[i] = getSoilFilePath(workspace().getFile("soils_file" + i + ".xml")).replace("/", "\\"); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("THE SOIL IS =" + soilPtr[i] + "\n\n\n\n"); |
} |
- if ( ( type.equals( "TEXT" ) ) || ( type.equals( "FILENAME" ) ) || ( type.equals( "DATE" ) ) ) { |
- // because the RomeShell returns escaped strings, and the JSONObject in Java re-escapes them |
- // we have to remove one level of "escaping" !!! |
- String newString = StringEscapeUtils.unescapeJava( value ); |
- //String newString=value; |
- report().put( itemName, removeFirstLastChar( newString ), desc, units ); |
+ } else { |
+ String error = responseMeta.getString(ERROR); |
+ throw new ServiceException("Soil service error: " + error); |
+ } |
+ } |
+ return soilPtr; |
+ } |
+ |
+ private String getSoilFilePath(File soilFile) throws ParserConfigurationException, SAXException, IOException { |
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); |
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); |
+ Document document = documentBuilder.parse(soilFile); |
+ String path = document.getElementsByTagName("Filename").item(0).getTextContent(); |
+ return path; |
+ } |
+ |
+ private String getClimateFilePath(double lat, double lon) throws JSONException, Exception { |
+ JSONObject climateReq = new JSONObject(); |
+ JSONObject meta = new JSONObject(); |
+ JSONArray param = new JSONArray(); |
+ JSONObject jlat = new JSONObject(); |
+ JSONObject jlong = new JSONObject(); |
+ String climatePath = ""; |
+ |
+ climateReq.put(KEY_METAINFO, meta); |
+ climateReq.put(KEY_PARAMETER, param); |
+ |
+ param.put(jlat); |
+ param.put(jlong); |
+ |
+ jlat.put(KEY_NAME, KEY_LATITUDE); |
+ jlat.put(KEY_VALUE, lat); |
+ |
+ jlong.put(KEY_NAME, KEY_LONGITUDE); |
+ jlong.put(KEY_VALUE, lon); |
+ |
+ JSONObject climateResponse = new Client().doPOST(Config.getString("r2.climate", "http://csip.engr.colostate.edu:8092/csip-misc/d/r2climate/2.0"), climateReq); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("CLIMATE Response: " + climateResponse.toString()); |
+ } |
+ JSONObject responseMeta = climateResponse.getJSONObject(KEY_METAINFO); |
+ if (!responseMeta.getString(KEY_STATUS).equalsIgnoreCase("Failed")) { |
+ JSONArray resultArr = climateResponse.getJSONArray(KEY_RESULT); |
+ JSONObject cliObj = JSONUtils.preprocess(resultArr).get(KEY_CLIMATE_URL); |
+ climatePath = cliObj.getString(KEY_VALUE); |
+ } |
+ return climatePath; |
+ } |
+ |
+ @Override |
+ protected void doReport() throws Exception { |
+ String sReportJSON = FileUtils.readFileToString(resources().getFile(REPORT_JSON_TEMPLATE_FILENAME)); |
+ JSONArray reportItemsFromTemplate = new JSONArray(sReportJSON); |
+ for (int i = 0; i < reportItemsFromTemplate.length(); i++) { |
+ JSONObject obj = (JSONObject) reportItemsFromTemplate.get(i); |
+ String itemName = obj.getString(REPORT_NAME); |
+ String dimension = JSONUtils.getJSONString(obj, REPORT_DIM, null); |
+ String type = JSONUtils.getJSONString(obj, REPORT_TYPE, ""); |
+ String units = JSONUtils.getJSONString(obj, REPORT_UNITS, null); |
+ String desc = JSONUtils.getJSONString(obj, REPORT_DESC, null); |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("--------------------PROCESSING ELEMENT:"); |
+ LOG.info("VAR NAME:" + itemName); |
+ LOG.info("---------------------------------------"); |
+ } |
+ |
+ //String value = r2run.getResultPyrome(itemName); |
+ String value = r2run.getResult("\"" + itemName + "\""); |
+ LOG.info("the value='" + value + "'"); |
+ if ((value != null) && (value.equals("null"))) { |
+ report().put(itemName, (String) null, desc, units); |
+ // if there is no value, then item should be removed from the array |
+ } else { |
+ if ((dimension != null) && (dimension.length() > 0) && (value != null) && (!value.equals("null"))) { |
+ try { |
+ report().put(itemName, new JSONArray(value), desc, units); |
+ } catch (JSONException je) { |
+ processReportElement(itemName, dimension, units, desc, type, value); |
+ } |
+ } else { |
+ processReportElement(itemName, dimension, units, desc, type, value); |
} |
- if ( type.equals( "INTEGER" ) && ( value != null ) && ( !value.equals( "null" ) ) && ( !value.equals( "\"\"" ) ) ) { |
- // trim off quotes |
- value = removeFirstLastChar( value ); |
- report().put( itemName, new Double( value ).intValue(), desc, units ); |
- } |
- if ( type.equals( "REAL" ) && ( value != null ) ) { |
- if ( ( !value.equals( "null" ) ) && ( !value.equals( "\"\"" ) ) ) { |
- // trim off quotes |
- value = removeFirstLastChar( value ); |
- report().put( itemName, Double.parseDouble( value ), desc, units ); |
- } |
- if ( value.equals( "\"\"" ) ) { |
- report().put( itemName, new Double( 0 ), desc, units ); |
- } |
- } |
- if ( type.equals( "" ) ) { |
- report().put( itemName, value, desc, units ); |
- } |
+ } |
+ if (dimension != null) { |
+ report().putMetaInfo(itemName, REPORT_DIM, new JSONArray(dimension)); |
+ } |
} |
+ } |
+ |
+ // This is a gross signiture but due to csip report changes this is the easiest way to change it without losing Wes's logic. |
+ private void processReportElement(String itemName, String dim, String units, String desc, String type, String value) throws Exception { |
+ if (LOG.isLoggable(Level.INFO)) { |
+ LOG.info("------------------------------------PROCESSING ELEMENT:\n\n"); |
+ LOG.info("TYPE:" + type); |
+ LOG.info("VALUE:" + value); |
+ LOG.info("------------------------------------\n\n"); |
+ } |
+ if ((type.equals("TEXT")) || (type.equals("FILENAME")) || (type.equals("DATE"))) { |
+ // because the RomeShell returns escaped strings, and the JSONObject in Java re-escapes them |
+ // we have to remove one level of "escaping" !!! |
+ String newString = StringEscapeUtils.unescapeJava(value); |
+ //String newString=value; |
+ report().put(itemName, removeFirstLastChar(newString), desc, units); |
+ } |
+ if (type.equals("INTEGER") && (value != null) && (!value.equals("null")) && (!value.equals("\"\""))) { |
+ // trim off quotes |
+ value = removeFirstLastChar(value); |
+ report().put(itemName, new Double(value).intValue(), desc, units); |
+ } |
+ if (type.equals("REAL") && (value != null)) { |
+ if ((!value.equals("null")) && (!value.equals("\"\""))) { |
+ // trim off quotes |
+ value = removeFirstLastChar(value); |
+ report().put(itemName, Double.parseDouble(value), desc, units); |
+ } |
+ if (value.equals("\"\"")) { |
+ report().put(itemName, new Double(0), desc, units); |
+ } |
+ } |
+ if (type.equals("")) { |
+ report().put(itemName, value, desc, units); |
+ } |
+ } |
+ |
+ protected Map<String, Object> getConfigInfo() { |
+ return new LinkedHashMap<String, Object>() { |
+ { |
+ put(ROMEDLL, resources().getResolved(ROMEDLL)); |
+ } |
+ }; |
+ } |
} |