changeset 23:73a60617e1a7

Moved the src and classes folders to the root of the workspace; renamed the classes folder to build
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 06 Dec 2013 12:51:59 +0000
parents 41bc856ceaea
children 97711e9cc433
files build.xml build/log4j.properties build/myapp.properties src/HumanEchoServlet.java src/TestEchoClass.java webapp/WEB-INF/classes/log4j.properties webapp/WEB-INF/classes/myapp.properties webapp/WEB-INF/src/HumanEchoServlet.java webapp/WEB-INF/src/TestEchoClass.java
diffstat 9 files changed, 193 insertions(+), 193 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Fri Dec 06 12:27:19 2013 +0000
+++ b/build.xml	Fri Dec 06 12:51:59 2013 +0000
@@ -7,8 +7,8 @@
   <property name="matlab-src" location="mcode/human-echolocation"/>
   <property name="matlab-build" location="scratch"/>
   <property name="lib" location="webapp/WEB-INF/lib"/>
-  <property name="src" location="webapp/WEB-INF/src"/>
-  <property name="classes" location="webapp/WEB-INF/classes"/>
+  <property name="src" location="src"/>
+  <property name="classes" location="build"/>
   <property name="web.dir" location="webapp"/>
   <property name="war.file"  location="echoapp.war"/>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/log4j.properties	Fri Dec 06 12:51:59 2013 +0000
@@ -0,0 +1,10 @@
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=${appRootPath}WEB-INF/logs/EchoWebApp.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1} - %m%n
+log4j.appender.file.append=true
+
+# log levels
+log4j.rootCategory=ALL, file
+log4j.logger.com.saral=debug
+log4j.logger.org.eclipse=debug
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/myapp.properties	Fri Dec 06 12:51:59 2013 +0000
@@ -0,0 +1,2 @@
+tmpdir=/tmp
+outdir=/tmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/HumanEchoServlet.java	Fri Dec 06 12:51:59 2013 +0000
@@ -0,0 +1,137 @@
+/*
+ * Classname
+ *
+ * Version information
+ *
+ * 3 December 2013
+ *
+ * Copyright notice
+ */
+
+import java.util.Properties;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletConfig;
+import javax.servlet.RequestDispatcher;
+
+import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
+import com.mathworks.toolbox.javabuilder.MWNumericArray;
+import com.mathworks.toolbox.javabuilder.MWStructArray;
+import com.mathworks.toolbox.javabuilder.MWException;
+import com.mathworks.toolbox.javabuilder.internal.MCRConfiguration;
+
+import uk.ac.soton.isvr.*;
+
+public class HumanEchoServlet extends HttpServlet {
+    private HumanEcho echo;
+
+    private static Logger logger = Logger.getLogger(HumanEchoServlet.class);
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+
+        // reading properties file
+        try {
+            Properties properties = new Properties();
+            properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("myapp.properties"));
+
+            //get the property value and print it out
+            System.out.println(properties.getProperty("tmpdir"));
+            System.out.println(properties.getProperty("outdir"));
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            echo = new HumanEcho();
+        }
+        catch(MWException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void destroy() {
+        super.destroy();
+
+        if(echo!=null) {
+            echo.dispose();
+        }
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+        // todo: validate/normalise distance
+        int dist = Integer.parseInt(request.getParameter("dist"));
+        MWStructArray Input = null;
+        HumanEcho echo;
+
+        try {
+            echo = new HumanEcho();
+
+            logger.error("We are logging!");
+
+            // Matlab structure:
+            // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')
+
+            String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};
+            Input = new MWStructArray(1, 1, InputStructFields);
+            Input.set("dist", 1, Double.valueOf(dist));
+            Input.set("azim", 1, Double.valueOf(0));
+            Input.set("orient", 1, "horz");
+            Input.set("dirweight", 1, Double.valueOf(0.2));
+
+            // the ofname should depend on the parameters
+            StringBuilder sb = new StringBuilder();
+            sb.append("e_d");
+            sb.append(dist);
+            sb.append(".wav");
+            String outputfname = sb.toString();
+
+            Input.set("outputfname", 1, outputfname);
+
+            // todo: before calling should test if wav already exists..
+            Object[] result = echo.simulateBinauralSignals(Input);
+        }
+        catch(MWException e) {
+            e.printStackTrace();
+        }
+
+        System.out.println("MCRROOT: " + System.getenv("MCRROOT"));
+        System.out.println("PATH: " + System.getenv("PATH"));
+        System.out.println(MCRConfiguration.isInstalledMCR());
+
+
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append("<BR>");
+        buffer.append("<BR>");
+
+        buffer.append("worked, ?");
+
+        buffer.append("<BR>");
+        buffer.append("<BR>");
+
+/*
+        buffer.append("<TABLE >");
+        for (double[] row : square)
+        {
+            buffer.append("<TR>");
+            for (double value : row)
+            {
+                buffer.append("<TH>");
+                buffer.append(new Double(value).intValue());
+            }
+        }
+        buffer.append("</TABLE>");
+        buffer.append("<BR>");
+        response.getOutputStream().print(buffer.toString());
+*/
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/TestEchoClass.java	Fri Dec 06 12:51:59 2013 +0000
@@ -0,0 +1,42 @@
+import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
+import com.mathworks.toolbox.javabuilder.MWNumericArray;
+import com.mathworks.toolbox.javabuilder.MWStructArray;
+import com.mathworks.toolbox.javabuilder.MWException;
+
+import uk.ac.soton.isvr.*;
+
+public class TestEchoClass {
+    public static void main(String[] args) {
+        //Instantiate Objects to null
+        MWStructArray Input = null;
+
+        HumanEcho echo;
+
+        try {
+            echo = new HumanEcho();
+
+            // Matlab structure:
+            // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')
+
+            String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};
+            Input = new MWStructArray(1, 1, InputStructFields);
+            Input.set("dist", 1, Double.valueOf(0.9));
+            Input.set("azim", 1, Double.valueOf(0));
+            Input.set("orient", 1, "horz");
+            Input.set("dirweight", 1, Double.valueOf(0.2));
+            Input.set("outputfname", 1, "yeah.wav");
+
+
+            Object[] result = echo.simulateBinauralSignals(Input);
+
+            // MWNumericArray array = (MWNumericArray)result[0];
+            // square = (double[][])array.toArray();
+
+        }
+        catch(MWException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+}
--- a/webapp/WEB-INF/classes/log4j.properties	Fri Dec 06 12:27:19 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=${appRootPath}WEB-INF/logs/EchoWebApp.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1} - %m%n
-log4j.appender.file.append=true
-
-# log levels
-log4j.rootCategory=ALL, file
-log4j.logger.com.saral=debug
-log4j.logger.org.eclipse=debug
\ No newline at end of file
--- a/webapp/WEB-INF/classes/myapp.properties	Fri Dec 06 12:27:19 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-tmpdir=/tmp
-outdir=/tmp
\ No newline at end of file
--- a/webapp/WEB-INF/src/HumanEchoServlet.java	Fri Dec 06 12:27:19 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Classname
- *
- * Version information
- *
- * 3 December 2013
- *
- * Copyright notice
- */
-
-import java.util.Properties;
-import java.io.IOException;
-
-import org.apache.log4j.Logger;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.servlet.ServletConfig;
-import javax.servlet.RequestDispatcher;
-
-import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
-import com.mathworks.toolbox.javabuilder.MWNumericArray;
-import com.mathworks.toolbox.javabuilder.MWStructArray;
-import com.mathworks.toolbox.javabuilder.MWException;
-import com.mathworks.toolbox.javabuilder.internal.MCRConfiguration;
-
-import uk.ac.soton.isvr.*;
-
-public class HumanEchoServlet extends HttpServlet {
-    private HumanEcho echo;
-
-    private static Logger logger = Logger.getLogger(HumanEchoServlet.class);
-
-    public void init(ServletConfig config) throws ServletException {
-        super.init(config);
-
-        // reading properties file
-        try {
-            Properties properties = new Properties();
-            properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("myapp.properties"));
-
-            //get the property value and print it out
-            System.out.println(properties.getProperty("tmpdir"));
-            System.out.println(properties.getProperty("outdir"));
-
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        try {
-            echo = new HumanEcho();
-        }
-        catch(MWException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void destroy() {
-        super.destroy();
-
-        if(echo!=null) {
-            echo.dispose();
-        }
-    }
-
-    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
-        // todo: validate/normalise distance
-        int dist = Integer.parseInt(request.getParameter("dist"));
-        MWStructArray Input = null;
-        HumanEcho echo;
-
-        try {
-            echo = new HumanEcho();
-
-            logger.error("We are logging!");
-
-            // Matlab structure:
-            // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')
-
-            String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};
-            Input = new MWStructArray(1, 1, InputStructFields);
-            Input.set("dist", 1, Double.valueOf(dist));
-            Input.set("azim", 1, Double.valueOf(0));
-            Input.set("orient", 1, "horz");
-            Input.set("dirweight", 1, Double.valueOf(0.2));
-
-            // the ofname should depend on the parameters
-            StringBuilder sb = new StringBuilder();
-            sb.append("e_d");
-            sb.append(dist);
-            sb.append(".wav");
-            String outputfname = sb.toString();
-
-            Input.set("outputfname", 1, outputfname);
-
-            // todo: before calling should test if wav already exists..
-            Object[] result = echo.simulateBinauralSignals(Input);
-        }
-        catch(MWException e) {
-            e.printStackTrace();
-        }
-
-        System.out.println("MCRROOT: " + System.getenv("MCRROOT"));
-        System.out.println("PATH: " + System.getenv("PATH"));
-        System.out.println(MCRConfiguration.isInstalledMCR());
-
-
-        StringBuffer buffer = new StringBuffer();
-
-        buffer.append("<BR>");
-        buffer.append("<BR>");
-
-        buffer.append("worked, ?");
-
-        buffer.append("<BR>");
-        buffer.append("<BR>");
-
-/*
-        buffer.append("<TABLE >");
-        for (double[] row : square)
-        {
-            buffer.append("<TR>");
-            for (double value : row)
-            {
-                buffer.append("<TH>");
-                buffer.append(new Double(value).intValue());
-            }
-        }
-        buffer.append("</TABLE>");
-        buffer.append("<BR>");
-        response.getOutputStream().print(buffer.toString());
-*/
-    }
-}
--- a/webapp/WEB-INF/src/TestEchoClass.java	Fri Dec 06 12:27:19 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-import com.mathworks.toolbox.javabuilder.MWJavaObjectRef;
-import com.mathworks.toolbox.javabuilder.MWNumericArray;
-import com.mathworks.toolbox.javabuilder.MWStructArray;
-import com.mathworks.toolbox.javabuilder.MWException;
-
-import uk.ac.soton.isvr.*;
-
-public class TestEchoClass {
-    public static void main(String[] args) {
-        //Instantiate Objects to null
-        MWStructArray Input = null;
-
-        HumanEcho echo;
-
-        try {
-            echo = new HumanEcho();
-
-            // Matlab structure:
-            // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')
-
-            String[] InputStructFields = {"dist", "azim", "orient", "dirweight", "outputfname"};
-            Input = new MWStructArray(1, 1, InputStructFields);
-            Input.set("dist", 1, Double.valueOf(0.9));
-            Input.set("azim", 1, Double.valueOf(0));
-            Input.set("orient", 1, "horz");
-            Input.set("dirweight", 1, Double.valueOf(0.2));
-            Input.set("outputfname", 1, "yeah.wav");
-
-
-            Object[] result = echo.simulateBinauralSignals(Input);
-
-            // MWNumericArray array = (MWNumericArray)result[0];
-            // square = (double[][])array.toArray();
-
-        }
-        catch(MWException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-}