Fixed XML Loading error, used VMG to calculate boat velocity

- XML read from stream instead of file
- Started implementing VMG to calculate boat velocity dynamically

Tags: #pair[wmu16, mra106] #story[986]
This commit is contained in:
Michael Rausch
2017-07-25 20:14:50 +12:00
parent 4f2dca7ecf
commit c8a96dcce9
7 changed files with 45 additions and 57 deletions
@@ -3,6 +3,7 @@ package seng302.models.xml;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.apache.commons.io.IOUtils;
import seng302.server.messages.XMLMessageSubType;
import java.io.*;
@@ -27,11 +28,7 @@ public class XMLGenerator {
configuration = new Configuration(Configuration.VERSION_2_3_26);
try {
configuration.setDirectoryForTemplateLoading(new File(getClass().getResource(XML_TEMPLATE_DIR).toURI()));
} catch (IOException e){
System.out.println("[FATAL] Server could not read XML templates");
} catch (URISyntaxException e) {
System.out.println("[FATAL] Xml template directory URI is invalid");
configuration.setClassForTemplateLoading(getClass(), XML_TEMPLATE_DIR);
} catch (NullPointerException e){
System.out.println("[FATAL] Server could not load XML Template directory, ensure this directory isn't empty");
}