|
From: <da...@us...> - 2012-11-05 09:15:01
|
Revision: 273
http://advance-project.svn.sourceforge.net/advance-project/?rev=273&view=rev
Author: dalmaso
Date: 2012-11-05 09:14:51 +0000 (Mon, 05 Nov 2012)
Log Message:
-----------
updated to latest deliverable specification
Modified Paths:
--------------
advance-et/trunk/nbproject/build-impl.xml
advance-et/trunk/nbproject/genfiles.properties
advance-et/trunk/nbproject/project.properties
advance-et/trunk/nbproject/project.xml
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileFilter.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DeleteXmlServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DownloadXmlServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetXmlServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/LoginServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/SaveXmlServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/UploadXmlServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/UserBean.java
advance-et/trunk/web/WEB-INF/web.xml
advance-et/trunk/web/css/editFile.css
advance-et/trunk/web/css/fileList.css
advance-et/trunk/web/css/viewFile.css
advance-et/trunk/web/doc/AdvanceElicitationTool_QuickGuide.pdf
advance-et/trunk/web/filerep/ST_1.xml
advance-et/trunk/web/index.jsp
advance-et/trunk/web/js/editFile.js
advance-et/trunk/web/js/fileList.js
advance-et/trunk/web/js/viewFile.js
advance-et/trunk/web/pages/editFile.jsp
advance-et/trunk/web/pages/fileList.jsp
advance-et/trunk/web/pages/viewFile.jsp
advance-et/trunk/web/users/users.xml
Added Paths:
-----------
advance-et/trunk/lib/gson-2.2.2.jar
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileItem.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileManager.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileViewData.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetFileListServlet.java
advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/UnsetUserBeanServlet.java
advance-et/trunk/web/WEB-INF/jspf/
advance-et/trunk/web/WEB-INF/jspf/footer.jspf
advance-et/trunk/web/css/images/ui-bg_flat_0_aaaaaa_40x100.png
advance-et/trunk/web/css/images/ui-bg_flat_100_388d3c_40x100.png
advance-et/trunk/web/css/images/ui-bg_flat_55_388d3c_40x100.png
advance-et/trunk/web/css/images/ui-bg_flat_75_388d3c_40x100.png
advance-et/trunk/web/css/images/ui-bg_flat_75_ffffff_40x100.png
advance-et/trunk/web/css/images/ui-bg_glass_65_ffffff_1x400.png
advance-et/trunk/web/css/images/ui-bg_glass_95_fef1ec_1x400.png
advance-et/trunk/web/css/images/ui-icons_222222_256x240.png
advance-et/trunk/web/css/images/ui-icons_388d3c_256x240.png
advance-et/trunk/web/css/jquery-ui-1.9.0.custom.min.css
advance-et/trunk/web/images/locked.png
advance-et/trunk/web/js/d3.v2.js
Removed Paths:
-------------
advance-et/trunk/web/css/images/ui-bg_glass_55_fcf0ba_1x400.png
advance-et/trunk/web/css/images/ui-bg_gloss-wave_100_ece8da_500x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-hard_100_fafaf4_1x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-hard_15_459e00_1x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-hard_95_cccccc_1x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-soft_25_67b021_1x100.png
advance-et/trunk/web/css/images/ui-bg_highlight-soft_95_ffedad_1x100.png
advance-et/trunk/web/css/images/ui-bg_inset-soft_15_2b2922_1x100.png
advance-et/trunk/web/css/images/ui-icons_808080_256x240.png
advance-et/trunk/web/css/images/ui-icons_847e71_256x240.png
advance-et/trunk/web/css/images/ui-icons_8dc262_256x240.png
advance-et/trunk/web/css/images/ui-icons_eeeeee_256x240.png
advance-et/trunk/web/css/jquery-ui-1.8.18.custom.css
advance-et/trunk/web/filerep/ST.xml
advance-et/trunk/web/js/jquery.jsPlumb-1.3.8-all-min.js
Added: advance-et/trunk/lib/gson-2.2.2.jar
===================================================================
(Binary files differ)
Property changes on: advance-et/trunk/lib/gson-2.2.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: advance-et/trunk/nbproject/build-impl.xml
===================================================================
--- advance-et/trunk/nbproject/build-impl.xml 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/nbproject/build-impl.xml 2012-11-05 09:14:51 UTC (rev 273)
@@ -11,9 +11,9 @@
- execution
- debugging
- javadoc
- - junit compilation
- - junit execution
- - junit debugging
+ - test compilation
+ - test execution
+ - test debugging
- cleanup
-->
@@ -212,6 +212,27 @@
</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">
@@ -370,34 +391,308 @@
</sequential>
</macrodef>
</target>
- <target name="-init-macrodef-junit">
+ <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 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 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>
</batchtest>
- <classpath>
- <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.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"/>
- <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg value="-ea"/>
- <jvmarg line="${runmain.jvmargs}"/>
+ <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" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="ElicitationTool" 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 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>
+ </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 ElicitationTool -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"/>
@@ -536,7 +831,10 @@
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
- <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" name="profile-init"/>
+ <!--
+ 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 name="-profile-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
@@ -545,12 +843,15 @@
<!-- 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" name="-profile-init-check">
+ <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>
- <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/>
<!--
+ end of pre NB7.2 profiling section
+ -->
+ <target depends="-pre-init,-init-private,-init-libraries,-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"/>
@@ -703,6 +1004,7 @@
<copyfiles files="${file.reference.xalan-2.7.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.commons-fileupload-1.2.2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.commons-io-2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.gson-2.2.2.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>
@@ -712,6 +1014,7 @@
<copyfiles files="${file.reference.xalan-2.7.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-fileupload-1.2.2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-io-2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.gson-2.2.2.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"/>
@@ -852,7 +1155,10 @@
<antcall target="connect-client-debugger"/>
</target>
<target if="do.debug.server" name="connect-debugger" unless="is.debugged">
- <nbjpdaconnect address="${jpda.address}" host="${jpda.host}" name="${name}" transport="${jpda.transport}">
+ <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>
@@ -897,28 +1203,79 @@
PROFILING SECTION
=================
-->
- <target description="Profile a J2EE project in the IDE." name="profile">
+ <!--
+ 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="start-loadgen"/>
+ <antcall target="-profile-start-loadgen"/>
</target>
- <target name="start-profiled-server">
+ <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 name="start-profiled-server-extraargs">
+ <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 if="profiler.loadgen.path" name="start-loadgen">
+ <target 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"/>
+ <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>
<!--
@@ -952,7 +1309,7 @@
<target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
- JUNIT COMPILATION SECTION
+ TEST COMPILATION SECTION
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
@@ -991,13 +1348,13 @@
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
- JUNIT EXECUTION SECTION
+ 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:junit testincludes="**/*Test.java"/>
+ <webproject2:test 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>
@@ -1010,68 +1367,44 @@
</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:junit excludes="" includes="${test.includes}"/>
+ <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"/>
<!--
- JUNIT DEBUGGING SECTION
+ TEST DEBUGGING SECTION
-->
- <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+ <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>
- <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
- <delete file="${test.report.file}"/>
- <!-- must exist, otherwise the XML formatter would fail -->
- <mkdir dir="${build.test.results.dir}"/>
- <webproject1:debug args="${test.class}" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}">
- <customize>
- <arg value="showoutput=true"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
- <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
- </customize>
- </webproject1:debug>
+ <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"/>
<!--
- =========================
- TESTS PROFILING SECTION
- =========================
- -->
- <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
- <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>
- <!--
CLEANUP SECTION
-->
Modified: advance-et/trunk/nbproject/genfiles.properties
===================================================================
--- advance-et/trunk/nbproject/genfiles.properties 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/nbproject/genfiles.properties 2012-11-05 09:14:51 UTC (rev 273)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=b7814196
+build.xml.data.CRC32=363c97b5
build.xml.script.CRC32=604dc0e7
build.xml.stylesheet.CRC32=651128d4@1.36.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=b7814196
-nbproject/build-impl.xml.script.CRC32=32b8c097
+nbproject/build-impl.xml.data.CRC32=363c97b5
+nbproject/build-impl.xml.script.CRC32=1c824f86
nbproject/build-impl.xml.stylesheet.CRC32=b7883b1f@1.36.1.1
Modified: advance-et/trunk/nbproject/project.properties
===================================================================
--- advance-et/trunk/nbproject/project.properties 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/nbproject/project.properties 2012-11-05 09:14:51 UTC (rev 273)
@@ -27,10 +27,12 @@
excludes=
file.reference.commons-fileupload-1.2.2.jar=lib\\commons-fileupload-1.2.2.jar
file.reference.commons-io-2.1.jar=lib\\commons-io-2.1.jar
+file.reference.gson-2.2.2.jar=lib/gson-2.2.2.jar
file.reference.jdom-1.1.3.jar=lib\\jdom-1.1.3.jar
file.reference.xalan-2.7.1.jar=lib\\xalan-2.7.1.jar
includes=**
j2ee.compile.on.save=true
+j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.5
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-3.7.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/mysql-connector-java-5.1.16-bin.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar
@@ -41,7 +43,8 @@
${file.reference.jdom-1.1.3.jar}:\
${file.reference.xalan-2.7.1.jar}:\
${file.reference.commons-fileupload-1.2.2.jar}:\
- ${file.reference.commons-io-2.1.jar}
+ ${file.reference.commons-io-2.1.jar}:\
+ ${file.reference.gson-2.2.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.debug=true
Modified: advance-et/trunk/nbproject/project.xml
===================================================================
--- advance-et/trunk/nbproject/project.xml 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/nbproject/project.xml 2012-11-05 09:14:51 UTC (rev 273)
@@ -26,6 +26,10 @@
<file>${file.reference.commons-io-2.1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${file.reference.gson-2.2.2.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileFilter.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileFilter.java 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileFilter.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -33,8 +33,8 @@
FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
- File file = new File(filterConfig.getServletContext().getInitParameter("XmlFilesRep")
- + "/" + request.getParameter("fileName"));
+ File file = new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"));
if (file.exists()) {
// System.out.println("File exists!");
// System.out.println("Page: " + req.getRequestURL());
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileServlet.java 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/CheckFileServlet.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -23,8 +23,8 @@
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- File selectedFile = new File(getServletContext().getInitParameter("XmlFilesRep")
- + "/" + request.getParameter("fileName"));
+ File selectedFile = new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"));
String action = request.getParameter("action");
String resultPage = getServletConfig().getInitParameter("resultPage");
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DeleteXmlServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DeleteXmlServlet.java 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DeleteXmlServlet.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -27,8 +27,8 @@
throws ServletException, IOException {
boolean errorOccured = true;
String errorMessage = null;
- File xmlFile = new File(getServletContext().getInitParameter("XmlFilesRep")
- + "\\" + request.getParameter("fileName"));
+ File xmlFile = new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"));
System.out.println(xmlFile);
if (((UserBean) request.getSession().getAttribute("userBean")).isAllowToDelete()) {
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DownloadXmlServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DownloadXmlServlet.java 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/DownloadXmlServlet.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -30,8 +30,8 @@
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- File newXml = new File(getServletContext().getInitParameter("XmlFilesRep")
- + "/" + request.getParameter("fileName"));
+ File newXml = new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"));
FileInputStream in = new FileInputStream(newXml);
ServletOutputStream out = response.getOutputStream();
response.setContentType("application/xml");
Added: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileItem.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileItem.java (rev 0)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileItem.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -0,0 +1,33 @@
+package com.ttsnetwork.elicitationtool;
+
+import java.io.File;
+
+/**
+ *
+ * @author TTS
+ */
+public class FileItem {
+ private File file;
+ private String user;
+
+ public FileItem(File file) {
+ this.file = file;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getFilename() {
+ return file.getName();
+ }
+
+}
Property changes on: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileItem.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileManager.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileManager.java (rev 0)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileManager.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -0,0 +1,45 @@
+package com.ttsnetwork.elicitationtool;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * @author TTS
+ */
+public class FileManager {
+
+ private Map<String,FileItem> files = new HashMap<String,FileItem>();
+ private static FileManager instance = new FileManager();
+
+ public static FileManager getInstance() {
+ return instance;
+ }
+
+ public Collection<FileItem> getFiles() {
+ if (files.isEmpty()) {
+ for (File f : FileViewData.getXmlFileRepository().listFiles()) {
+ if (f.isFile()) {
+ files.put(f.getName(), new FileItem(f));
+ }
+ }
+ }
+ return files.values();
+ }
+
+ public FileItem getItem(String filename) {
+ return files.get(filename);
+ }
+
+ void add(File f) {
+ files.put(f.getName(), new FileItem(f));
+ }
+
+ void remove(File f) {
+ files.remove(f.getName());
+ }
+
+
+}
Property changes on: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileManager.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileViewData.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileViewData.java (rev 0)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileViewData.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -0,0 +1,147 @@
+package com.ttsnetwork.elicitationtool;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+
+/**
+ *
+ * @author dalmaso
+ */
+public class FileViewData extends HttpServlet {
+
+ public static File getXmlFileRepository() {
+ try {
+ Context initCtx = new InitialContext();
+ Context envCtx = (Context) initCtx.lookup("java:comp/env");
+ String dirname = (String) envCtx.lookup("advanceet.filerep");
+ if (dirname != null) {
+ return new File(dirname);
+ }
+ } catch (NamingException ex) {
+ ex.printStackTrace();
+ }
+ return new File("C:\\AdvanceET\\Files");
+ }
+
+ /**
+ * Processes requests for both HTTP
+ * <code>GET</code> and
+ * <code>POST</code> methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("application/json");
+ PrintWriter out = response.getWriter();
+ try {
+ FileInputStream fos = new FileInputStream(
+ new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"))); //Apro lo stream sul file
+
+ SAXBuilder builder = new SAXBuilder();
+ Document doc = builder.build(fos);
+ fos.close();
+
+ JsonElement je = adapt(doc.getRootElement());
+ if (je == null) {
+ JsonObject root = new JsonObject();
+ root.addProperty("name", "(none)");
+ je = root;
+ }
+ Gson gson = new Gson();
+ out.print(gson.toJson(je));
+ } catch (Exception ex) {
+ throw new ServletException(ex);
+ } finally {
+ out.close();
+ }
+ }
+
+ private JsonElement adapt(Element e) {
+ String name = e.getAttributeValue("label");
+ if (name == null) {
+ return null;
+ }
+ JsonObject jobject = new JsonObject();
+ jobject.addProperty("name", name);
+ jobject.addProperty("rectId", "");
+ jobject.addProperty("linkToParent", "");
+ List children = e.getChildren("node");
+ if (!children.isEmpty()) {
+ JsonArray jchildren = new JsonArray();
+ for (Object child : children) {
+ JsonElement jchild = adapt((Element) child);
+ if (jchild != null) {
+ jchildren.add(jchild);
+ }
+ }
+ if (jchildren.size() != 0) {
+ jobject.add("children", jchildren);
+ }
+ }
+
+ return jobject;
+ }
+
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+ /**
+ * Handles the HTTP
+ * <code>GET</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP
+ * <code>POST</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ *
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }// </editor-fold>
+}
Property changes on: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/FileViewData.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetFileListServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetFileListServlet.java (rev 0)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetFileListServlet.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -0,0 +1,72 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.ttsnetwork.elicitationtool;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.XMLOutputter;
+
+/**
+ *
+ * @author farago
+ */
+public class GetFileListServlet extends HttpServlet {
+
+ /**
+ * Processes requests for both HTTP
+ * <code>GET</code> and
+ * <code>POST</code> methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("text/xml;charset=UTF-8");
+ PrintWriter out = response.getWriter();
+ try {
+ Collection<FileItem> files = FileManager.getInstance().getFiles();
+
+ Element el = new Element("root");
+ Document doc = new Document(el);
+ Element fileEl;
+
+ for (FileItem file : files) {
+ fileEl = new Element("file");
+ fileEl.setAttribute("filename", file.getFilename() == null ? "" : file.getFilename());
+ fileEl.setAttribute("user", file.getUser() == null ? "" : file.getUser());
+ el.addContent(fileEl);
+ }
+
+ new XMLOutputter().output(doc, out);
+ } finally {
+ out.close();
+ }
+ }
+
+ /**
+ * Handles the HTTP
+ * <code>POST</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+}
Property changes on: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetFileListServlet.java
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetXmlServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetXmlServlet.java 2012-10-31 14:05:56 UTC (rev 272)
+++ advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/GetXmlServlet.java 2012-11-05 09:14:51 UTC (rev 273)
@@ -31,8 +31,8 @@
OutputStream out = response.getOutputStream(); //Prendo lo stream di uscita
try {
FileInputStream fos = new FileInputStream(
- new File(getServletContext().getInitParameter("XmlFilesRep")
- + "\\" + request.getParameter("fileName"))); //Apro lo stream sul file
+ new File(FileViewData.getXmlFileRepository(),
+ request.getParameter("fileName"))); //Apro lo stream sul file
byte[] buff = new byte[1024]; //Faccio un buffer
int read; //Un int che terrà i byte letti
while ((read = fos.read(buff)) != -1) { //Legge il file a gruppi di buff.length byte fino a che ce ne sono
Modified: advance-et/trunk/src/java/com/ttsnetwork/elicitationtool/LoginServlet.java
===================================================================
--- advance-et/trunk/src/java/com/ttsnet...
[truncated message content] |