Added some exception classes to encapsulate the internal exceptions that can occur when sending Boat/race/regatta data.
#story[778]
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package seng302.Exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by f123 on 25-Apr-17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception thrown when we cannot generate Boats.xml and send an XML message.
|
||||||
|
*/
|
||||||
|
public class InvalidBoatDataException extends RuntimeException
|
||||||
|
{
|
||||||
|
|
||||||
|
public InvalidBoatDataException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidBoatDataException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package seng302.Exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by f123 on 25-Apr-17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exception thrown when we cannot generate Race.xml data, and send an XML message.
|
||||||
|
*/
|
||||||
|
public class InvalidRaceDataException extends RuntimeException
|
||||||
|
{
|
||||||
|
public InvalidRaceDataException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidRaceDataException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package seng302.Exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by f123 on 25-Apr-17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception thrown when a Regatta.xml message cannot be generated and sent.
|
||||||
|
*/
|
||||||
|
public class InvalidRegattaDataException extends RuntimeException
|
||||||
|
{
|
||||||
|
public InvalidRegattaDataException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidRegattaDataException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,18 @@ import org.w3c.dom.Attr;
|
|||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import seng302.Data.RaceData;
|
import seng302.Data.RaceData;
|
||||||
|
import seng302.Exceptions.InvalidBoatDataException;
|
||||||
|
import seng302.Exceptions.InvalidRaceDataException;
|
||||||
|
import seng302.Exceptions.InvalidRegattaDataException;
|
||||||
import seng302.Model.Race;
|
import seng302.Model.Race;
|
||||||
import seng302.RaceDataSource;
|
import seng302.RaceDataSource;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerConfigurationException;
|
||||||
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
@@ -40,7 +46,7 @@ public class Event {
|
|||||||
this.outputStream = outputStream;
|
this.outputStream = outputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws IOException
|
public void start()
|
||||||
{
|
{
|
||||||
System.out.println("\nREGATTA DATA\n");//TEMP REMOVE debug
|
System.out.println("\nREGATTA DATA\n");//TEMP REMOVE debug
|
||||||
sendRegattaData();
|
sendRegattaData();
|
||||||
@@ -56,80 +62,107 @@ public class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void sendRegattaData() {
|
public void sendRegattaData() throws InvalidRegattaDataException {
|
||||||
try {
|
|
||||||
|
|
||||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
|
||||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
|
||||||
|
|
||||||
//root element
|
|
||||||
Document doc = docBuilder.newDocument();
|
|
||||||
Element rootElement = doc.createElement("RegattaConfig");
|
|
||||||
doc.appendChild(rootElement);
|
|
||||||
|
|
||||||
//regattaID element
|
|
||||||
Element regattaID = doc.createElement("RegattaID");
|
|
||||||
regattaID.appendChild(doc.createTextNode("3"));
|
|
||||||
rootElement.appendChild(regattaID);
|
|
||||||
|
|
||||||
//regattaName element
|
|
||||||
Element regattaName = doc.createElement("RegattaName");
|
|
||||||
regattaName.appendChild(doc.createTextNode("New Zealand Test"));
|
|
||||||
rootElement.appendChild(regattaName);
|
|
||||||
|
|
||||||
//courseName element
|
|
||||||
Element courseName = doc.createElement("CourseName");
|
|
||||||
courseName.appendChild(doc.createTextNode("North Head"));
|
|
||||||
rootElement.appendChild(courseName);
|
|
||||||
|
|
||||||
//centralLatitude element
|
|
||||||
Element centralLat = doc.createElement("CentralLatitude");
|
|
||||||
centralLat.appendChild(doc.createTextNode(Double.toString(32.293039)));
|
|
||||||
rootElement.appendChild(centralLat);
|
|
||||||
|
|
||||||
//centralLongitude element
|
|
||||||
Element centralLong = doc.createElement("CentralLongitude");
|
|
||||||
centralLong.appendChild(doc.createTextNode(Double.toString(-64.843983)));
|
|
||||||
rootElement.appendChild(centralLong);
|
|
||||||
|
|
||||||
//centralAltitude element
|
|
||||||
Element centralAlt = doc.createElement("CentralAltitude");
|
|
||||||
centralAlt.appendChild(doc.createTextNode(Double.toString(0)));
|
|
||||||
rootElement.appendChild(centralAlt);
|
|
||||||
|
|
||||||
//utcOffset element
|
|
||||||
Element utcOffset = doc.createElement("UtcOffset");
|
|
||||||
utcOffset.appendChild(doc.createTextNode(Double.toString(-3)));
|
|
||||||
rootElement.appendChild(utcOffset);
|
|
||||||
|
|
||||||
//magneticVariation element
|
|
||||||
Element magneticVariation = doc.createElement("MagneticVariation");
|
|
||||||
magneticVariation.appendChild(doc.createTextNode(Double.toString(14.76)));
|
|
||||||
rootElement.appendChild(magneticVariation);
|
|
||||||
|
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
|
||||||
DOMSource source = new DOMSource(doc);
|
|
||||||
|
|
||||||
|
|
||||||
|
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||||
//Serialize document.
|
DocumentBuilder docBuilder = null;
|
||||||
StringWriter stringWriter = new StringWriter();
|
try
|
||||||
StreamResult result = new StreamResult(stringWriter);
|
{
|
||||||
transformer.transform(source,result);
|
docBuilder = docFactory.newDocumentBuilder();
|
||||||
//TODO now we should place in XML message object.
|
|
||||||
//TODO now we should serialize xml message object.
|
|
||||||
//TODO now we should write serialized xml message over this.outputStream.
|
|
||||||
|
|
||||||
this.outputStream.write(stringWriter.toString().getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
|
||||||
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
catch (ParserConfigurationException e)
|
||||||
|
{
|
||||||
|
throw new InvalidRegattaDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
//root element
|
||||||
|
Document doc = docBuilder.newDocument();
|
||||||
|
Element rootElement = doc.createElement("RegattaConfig");
|
||||||
|
doc.appendChild(rootElement);
|
||||||
|
|
||||||
|
//regattaID element
|
||||||
|
Element regattaID = doc.createElement("RegattaID");
|
||||||
|
regattaID.appendChild(doc.createTextNode("3"));
|
||||||
|
rootElement.appendChild(regattaID);
|
||||||
|
|
||||||
|
//regattaName element
|
||||||
|
Element regattaName = doc.createElement("RegattaName");
|
||||||
|
regattaName.appendChild(doc.createTextNode("New Zealand Test"));
|
||||||
|
rootElement.appendChild(regattaName);
|
||||||
|
|
||||||
|
//courseName element
|
||||||
|
Element courseName = doc.createElement("CourseName");
|
||||||
|
courseName.appendChild(doc.createTextNode("North Head"));
|
||||||
|
rootElement.appendChild(courseName);
|
||||||
|
|
||||||
|
//centralLatitude element
|
||||||
|
Element centralLat = doc.createElement("CentralLatitude");
|
||||||
|
centralLat.appendChild(doc.createTextNode(Double.toString(32.293039)));
|
||||||
|
rootElement.appendChild(centralLat);
|
||||||
|
|
||||||
|
//centralLongitude element
|
||||||
|
Element centralLong = doc.createElement("CentralLongitude");
|
||||||
|
centralLong.appendChild(doc.createTextNode(Double.toString(-64.843983)));
|
||||||
|
rootElement.appendChild(centralLong);
|
||||||
|
|
||||||
|
//centralAltitude element
|
||||||
|
Element centralAlt = doc.createElement("CentralAltitude");
|
||||||
|
centralAlt.appendChild(doc.createTextNode(Double.toString(0)));
|
||||||
|
rootElement.appendChild(centralAlt);
|
||||||
|
|
||||||
|
//utcOffset element
|
||||||
|
Element utcOffset = doc.createElement("UtcOffset");
|
||||||
|
utcOffset.appendChild(doc.createTextNode(Double.toString(-3)));
|
||||||
|
rootElement.appendChild(utcOffset);
|
||||||
|
|
||||||
|
//magneticVariation element
|
||||||
|
Element magneticVariation = doc.createElement("MagneticVariation");
|
||||||
|
magneticVariation.appendChild(doc.createTextNode(Double.toString(14.76)));
|
||||||
|
rootElement.appendChild(magneticVariation);
|
||||||
|
|
||||||
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
|
Transformer transformer = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer = transformerFactory.newTransformer();
|
||||||
|
}
|
||||||
|
catch (TransformerConfigurationException e)
|
||||||
|
{
|
||||||
|
throw new InvalidRegattaDataException();
|
||||||
|
}
|
||||||
|
DOMSource source = new DOMSource(doc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Serialize document.
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
StreamResult result = new StreamResult(stringWriter);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer.transform(source,result);
|
||||||
|
}
|
||||||
|
catch (TransformerException e)
|
||||||
|
{
|
||||||
|
throw new InvalidRegattaDataException();
|
||||||
|
}
|
||||||
|
//TODO now we should place in XML message object.
|
||||||
|
//TODO now we should serialize xml message object.
|
||||||
|
//TODO now we should write serialized xml message over this.outputStream.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.outputStream.write(stringWriter.toString().getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new InvalidRegattaDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendRaceData() throws IOException
|
public void sendRaceData() throws InvalidRaceDataException
|
||||||
{
|
{
|
||||||
RaceData raceData = new RaceData(raceDataSource);
|
RaceData raceData = new RaceData(raceDataSource);
|
||||||
//Serialize race data to an XML as a string.
|
//Serialize race data to an XML as a string.
|
||||||
@@ -139,112 +172,147 @@ public class Event {
|
|||||||
//TODO now we should serialize xml message object.
|
//TODO now we should serialize xml message object.
|
||||||
//TODO now we should write serialized xml message over this.outputStream.
|
//TODO now we should write serialized xml message over this.outputStream.
|
||||||
|
|
||||||
this.outputStream.write(xmlString.getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
try
|
||||||
|
{
|
||||||
|
this.outputStream.write(xmlString.getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new InvalidRaceDataException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBoatData() {
|
public void sendBoatData() throws InvalidBoatDataException
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
List<BoatInRace> boatData = raceDataSource.getBoats();
|
List<BoatInRace> boatData = raceDataSource.getBoats();
|
||||||
try {
|
|
||||||
|
|
||||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
|
||||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
|
||||||
|
|
||||||
//root element
|
|
||||||
Document doc = docBuilder.newDocument();
|
|
||||||
Element rootElement = doc.createElement("BoatConfig");
|
|
||||||
doc.appendChild(rootElement);
|
|
||||||
|
|
||||||
//Boats element
|
|
||||||
Element boats = doc.createElement("Boats");
|
|
||||||
rootElement.appendChild(boats);
|
|
||||||
|
|
||||||
for (int i=0; i < boatData.size(); i++) {
|
|
||||||
|
|
||||||
//Boat element
|
|
||||||
Element boat = doc.createElement("Boat");
|
|
||||||
|
|
||||||
//Type attribute
|
|
||||||
Attr attrType = doc.createAttribute("Type");
|
|
||||||
attrType.setValue("Mark");
|
|
||||||
boat.setAttributeNode(attrType);
|
|
||||||
|
|
||||||
//SourceID attribute
|
|
||||||
Attr attrSourceID = doc.createAttribute("SourceID");
|
|
||||||
attrSourceID.setValue(Integer.toString(boatData.get(i).getSourceID()));
|
|
||||||
boat.setAttributeNode(attrSourceID);
|
|
||||||
|
|
||||||
//ShapeID attribute
|
|
||||||
Attr attrShapeID = doc.createAttribute("ShapeID");
|
|
||||||
attrShapeID.setValue("0");
|
|
||||||
boat.setAttributeNode(attrShapeID);
|
|
||||||
|
|
||||||
//HullNum attribute
|
|
||||||
Attr attrHullNum = doc.createAttribute("HullNum");
|
|
||||||
attrHullNum.setValue("RG01");
|
|
||||||
boat.setAttributeNode(attrHullNum);
|
|
||||||
|
|
||||||
//StoweName attribute
|
|
||||||
Attr attrStoweName = doc.createAttribute("StoweName");
|
|
||||||
attrStoweName.setValue(boatData.get(i).getAbbrev());
|
|
||||||
boat.setAttributeNode(attrStoweName);
|
|
||||||
|
|
||||||
//ShortName attribute
|
|
||||||
Attr attrShortName = doc.createAttribute("ShortName");
|
|
||||||
attrShortName.setValue(boatData.get(i).getAbbrev());
|
|
||||||
boat.setAttributeNode(attrShortName);
|
|
||||||
|
|
||||||
//BoatName attribute
|
|
||||||
Attr attrBoatName = doc.createAttribute("BoatName");
|
|
||||||
attrBoatName.setValue(boatData.get(i).toString());
|
|
||||||
boat.setAttributeNode(attrBoatName);
|
|
||||||
|
|
||||||
//GPSCoord for element
|
|
||||||
Element GPSCoord = doc.createElement("GPSposition");
|
|
||||||
|
|
||||||
//Z axis attribute
|
|
||||||
Attr attrZCoord = doc.createAttribute("Z");
|
|
||||||
attrZCoord.setValue("0");
|
|
||||||
GPSCoord.setAttributeNode(attrZCoord);
|
|
||||||
|
|
||||||
//Y axis attribute
|
|
||||||
Attr attrYCoord = doc.createAttribute("Y");
|
|
||||||
attrYCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLatitude()));
|
|
||||||
GPSCoord.setAttributeNode(attrYCoord);
|
|
||||||
|
|
||||||
//X axis attribute
|
|
||||||
Attr attrXCoord = doc.createAttribute("X");
|
|
||||||
attrXCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLongitude()));
|
|
||||||
GPSCoord.setAttributeNode(attrXCoord);
|
|
||||||
|
|
||||||
//Write GPSCoord to boat
|
|
||||||
boat.appendChild(GPSCoord);
|
|
||||||
|
|
||||||
//Write boat to boats
|
|
||||||
boats.appendChild(boat);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
TransformerFactory trasformerFactory = TransformerFactory.newInstance();
|
|
||||||
Transformer transformer = trasformerFactory.newTransformer();
|
|
||||||
DOMSource source = new DOMSource(doc);
|
|
||||||
|
|
||||||
|
|
||||||
//Serialize document.
|
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||||
StringWriter stringWriter = new StringWriter();
|
DocumentBuilder docBuilder = null;
|
||||||
StreamResult result = new StreamResult(stringWriter);
|
|
||||||
transformer.transform(source,result);
|
|
||||||
//TODO now we should place in XML message object.
|
|
||||||
//TODO now we should serialize xml message object.
|
|
||||||
//TODO now we should write serialized xml message over this.outputStream.
|
|
||||||
|
|
||||||
this.outputStream.write(stringWriter.toString().getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
try
|
||||||
|
{
|
||||||
|
docBuilder = docFactory.newDocumentBuilder();
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
catch (ParserConfigurationException e)
|
||||||
|
{
|
||||||
|
throw new InvalidBoatDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
//root element
|
||||||
|
Document doc = docBuilder.newDocument();
|
||||||
|
Element rootElement = doc.createElement("BoatConfig");
|
||||||
|
doc.appendChild(rootElement);
|
||||||
|
|
||||||
|
//Boats element
|
||||||
|
Element boats = doc.createElement("Boats");
|
||||||
|
rootElement.appendChild(boats);
|
||||||
|
|
||||||
|
for (int i=0; i < boatData.size(); i++) {
|
||||||
|
|
||||||
|
//Boat element
|
||||||
|
Element boat = doc.createElement("Boat");
|
||||||
|
|
||||||
|
//Type attribute
|
||||||
|
Attr attrType = doc.createAttribute("Type");
|
||||||
|
attrType.setValue("Mark");
|
||||||
|
boat.setAttributeNode(attrType);
|
||||||
|
|
||||||
|
//SourceID attribute
|
||||||
|
Attr attrSourceID = doc.createAttribute("SourceID");
|
||||||
|
attrSourceID.setValue(Integer.toString(boatData.get(i).getSourceID()));
|
||||||
|
boat.setAttributeNode(attrSourceID);
|
||||||
|
|
||||||
|
//ShapeID attribute
|
||||||
|
Attr attrShapeID = doc.createAttribute("ShapeID");
|
||||||
|
attrShapeID.setValue("0");
|
||||||
|
boat.setAttributeNode(attrShapeID);
|
||||||
|
|
||||||
|
//HullNum attribute
|
||||||
|
Attr attrHullNum = doc.createAttribute("HullNum");
|
||||||
|
attrHullNum.setValue("RG01");
|
||||||
|
boat.setAttributeNode(attrHullNum);
|
||||||
|
|
||||||
|
//StoweName attribute
|
||||||
|
Attr attrStoweName = doc.createAttribute("StoweName");
|
||||||
|
attrStoweName.setValue(boatData.get(i).getAbbrev());
|
||||||
|
boat.setAttributeNode(attrStoweName);
|
||||||
|
|
||||||
|
//ShortName attribute
|
||||||
|
Attr attrShortName = doc.createAttribute("ShortName");
|
||||||
|
attrShortName.setValue(boatData.get(i).getAbbrev());
|
||||||
|
boat.setAttributeNode(attrShortName);
|
||||||
|
|
||||||
|
//BoatName attribute
|
||||||
|
Attr attrBoatName = doc.createAttribute("BoatName");
|
||||||
|
attrBoatName.setValue(boatData.get(i).toString());
|
||||||
|
boat.setAttributeNode(attrBoatName);
|
||||||
|
|
||||||
|
//GPSCoord for element
|
||||||
|
Element GPSCoord = doc.createElement("GPSposition");
|
||||||
|
|
||||||
|
//Z axis attribute
|
||||||
|
Attr attrZCoord = doc.createAttribute("Z");
|
||||||
|
attrZCoord.setValue("0");
|
||||||
|
GPSCoord.setAttributeNode(attrZCoord);
|
||||||
|
|
||||||
|
//Y axis attribute
|
||||||
|
Attr attrYCoord = doc.createAttribute("Y");
|
||||||
|
attrYCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLatitude()));
|
||||||
|
GPSCoord.setAttributeNode(attrYCoord);
|
||||||
|
|
||||||
|
//X axis attribute
|
||||||
|
Attr attrXCoord = doc.createAttribute("X");
|
||||||
|
attrXCoord.setValue(Double.toString(boatData.get(i).getCurrentPosition().getLongitude()));
|
||||||
|
GPSCoord.setAttributeNode(attrXCoord);
|
||||||
|
|
||||||
|
//Write GPSCoord to boat
|
||||||
|
boat.appendChild(GPSCoord);
|
||||||
|
|
||||||
|
//Write boat to boats
|
||||||
|
boats.appendChild(boat);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TransformerFactory trasformerFactory = TransformerFactory.newInstance();
|
||||||
|
Transformer transformer = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer = trasformerFactory.newTransformer();
|
||||||
|
}
|
||||||
|
catch (TransformerConfigurationException e)
|
||||||
|
{
|
||||||
|
throw new InvalidBoatDataException();
|
||||||
|
}
|
||||||
|
DOMSource source = new DOMSource(doc);
|
||||||
|
|
||||||
|
|
||||||
|
//Serialize document.
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
StreamResult result = new StreamResult(stringWriter);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer.transform(source,result);
|
||||||
|
}
|
||||||
|
catch (TransformerException e)
|
||||||
|
{
|
||||||
|
throw new InvalidBoatDataException();
|
||||||
|
}
|
||||||
|
//TODO now we should place in XML message object.
|
||||||
|
//TODO now we should serialize xml message object.
|
||||||
|
//TODO now we should write serialized xml message over this.outputStream.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.outputStream.write(stringWriter.toString().getBytes());//TEMP currently we output the XML doc, not the serialized message.
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new InvalidBoatDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user