Made all the model classes extend off the schema xml classes for race, and made xml builder, validator and reader utility class.

#story[1092]
This commit is contained in:
Fan-Wu Yang
2017-08-14 03:47:42 +12:00
parent 70d5447e88
commit b5e414f97a
33 changed files with 477 additions and 5071 deletions
@@ -337,7 +337,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
int cornerSeq = Integer.parseInt(getAttribute(cornerElement, "SeqID"));
cornersList.add(new Corner(cornerID, cornerSeq));
cornersList.add(new Corner(cornerID, cornerSeq, "SP", 3));
//Gets the CompoundMark associated with this corner.
CompoundMark lastCompoundMark = this.compoundMarkMap.get(cornerID);
@@ -356,7 +356,7 @@ public class RaceXMLReader extends XMLReader implements RaceDataSource {
cornerSeq = Integer.parseInt(getAttribute(cornerElement, "SeqID"));
cornersList.add(new Corner(cornerID, cornerSeq));
cornersList.add(new Corner(cornerID, cornerSeq, "Port", 3));
//Gets the CompoundMark associated with this corner.
CompoundMark currentCompoundMark = this.compoundMarkMap.get(cornerID);
@@ -1,10 +1,12 @@
package shared.model;
import shared.xml.Race.XMLCompoundMark;
/**
* Represents a compound mark - that is, either one or two individual marks which form a single compound mark.
*/
public class CompoundMark {
public class CompoundMark extends XMLCompoundMark{
/**
* The ID of the compound mark.
@@ -39,11 +41,7 @@ public class CompoundMark {
* @param mark1 The individual mark that comprises this compound mark.
*/
public CompoundMark(int id, String name, Mark mark1) {
this.id = id;
this.name = name;
this.mark1 = mark1;
this.averageGPSCoordinate = calculateAverage();
this(id, name, mark1, null);
}
@@ -55,6 +53,13 @@ public class CompoundMark {
* @param mark2 The second individual mark that comprises this compound mark.
*/
public CompoundMark(int id, String name, Mark mark1, Mark mark2) {
//parent set up
super();
setName(name);
setCompoundMarkID(id);
getMark().add(mark1);
if (mark2 != null) getMark().add(mark2);
this.id = id;
this.name = name;
this.mark1 = mark1;
@@ -72,14 +77,6 @@ public class CompoundMark {
return id;
}
/**
* Returns the name of this compound mark
* @return The name of this compound mark.
*/
public String getName() {
return name;
}
/**
* Returns the first mark of the compound mark.
* @return The first mark of the compound mark.
@@ -1,23 +1,25 @@
package shared.model;
import shared.xml.Race.XMLCorner;
/**
* Created by Gondr on 3/08/2017.
*/
public class Corner {
public class Corner extends XMLCorner{
private int id;
private int seqID;
public Corner(int id, int seqID){
public Corner(int id, int seqID, String rounding, int zoneSize){
super();
setCompoundMarkID(id);
setSeqID(seqID);
setRounding(rounding);
setZoneSize(zoneSize);
this.id = id;
this.seqID = seqID;
}
public int getId() {
return id;
}
public int getSeqID() {
return seqID;
}
}
@@ -1,28 +1,21 @@
package shared.model;
import shared.xml.Race.XMLMark;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* Represents an individual mark.
* Has a source ID, name, and position.
*/
public class Mark {
/**
* The source ID of the mark.
*/
private int sourceID;
/**
* The name of the mark.
*/
private String name;
public class Mark extends XMLMark{
/**
* The position of the mark.
*/
private GPSCoordinate position;
/**
* Constructs a mark with a given source ID, name, and position.
* @param sourceID The source ID of the mark.
@@ -30,8 +23,12 @@ public class Mark {
* @param position The position of the mark.
*/
public Mark(int sourceID, String name, GPSCoordinate position) {
this.sourceID = sourceID;
this.name = name;
super();
targetLat = position.getLatitude();
targetLng = position.getLongitude();
setSourceID(sourceID);
setName(name);
this.position = position;
}
@@ -44,14 +41,6 @@ public class Mark {
return name;
}
/**
* Returns the source ID of the mark.
* @return The source ID of the mark.
*/
public int getSourceID() {
return sourceID;
}
/**
* Returns the position of the mark.
* @return The position of the mark.
@@ -23,7 +23,7 @@ public abstract class Race implements Runnable {
/**
* The source of race related data.
*/
protected mock.xml.Race raceDataSource;
protected RaceDataSource raceDataSource;
/**
* The source of boat related data.
@@ -134,7 +134,7 @@ public abstract class Race implements Runnable {
* @param regattaDataSource Data source for race related data (course name, location, timezone, etc...).
* @param latestMessages The collection of latest messages, which can be written to, or read from.
*/
public Race(BoatDataSource boatDataSource, mock.xml.Race raceDataSource, RegattaDataSource regattaDataSource, LatestMessages latestMessages) {
public Race(BoatDataSource boatDataSource, RaceDataSource raceDataSource, RegattaDataSource regattaDataSource, LatestMessages latestMessages) {
//Keep a reference to data sources.
this.raceDataSource = raceDataSource;
@@ -0,0 +1,135 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Mark" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"mark"
})
public class XMLCompoundMark {
@XmlElement(name = "Mark", required = true)
protected List<XMLMark> mark;
@XmlAttribute(name = "CompoundMarkID", required = true)
protected int compoundMarkID;
@XmlAttribute(name = "Name", required = true)
protected String name;
/**
* Gets the value of the mark property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the mark property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMark().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLMark }
*
*
*/
public List<XMLMark> getMark() {
if (mark == null) {
mark = new ArrayList<XMLMark>();
}
return this.mark;
}
/**
* Gets the value of the compoundMarkID property.
*
*/
public int getCompoundMarkID() {
return compoundMarkID;
}
/**
* Sets the value of the compoundMarkID property.
*
*/
public void setCompoundMarkID(int value) {
this.compoundMarkID = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
}
@@ -0,0 +1,87 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Corner" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"corner"
})
public class XMLCompoundMarkSequence {
@XmlElement(name = "Corner", required = true)
protected List<XMLCorner> corner;
/**
* Gets the value of the corner property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the corner property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCorner().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLCorner }
*
*
*/
public List<XMLCorner> getCorner() {
if (corner == null) {
corner = new ArrayList<XMLCorner>();
}
return this.corner;
}
}
@@ -0,0 +1,122 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public class XMLCorner {
@XmlAttribute(name = "CompoundMarkID", required = true)
protected int compoundMarkID;
@XmlAttribute(name = "SeqID", required = true)
protected int seqID;
@XmlAttribute(name = "Rounding", required = true)
protected String rounding;
@XmlAttribute(name = "ZoneSize", required = true)
protected int zoneSize;
/**
* Gets the value of the compoundMarkID property.
*
*/
public int getCompoundMarkID() {
return compoundMarkID;
}
/**
* Sets the value of the compoundMarkID property.
*
*/
public void setCompoundMarkID(int value) {
this.compoundMarkID = value;
}
/**
* Gets the value of the seqID property.
*
*/
public int getSeqID() {
return seqID;
}
/**
* Sets the value of the seqID property.
*
*/
public void setSeqID(int value) {
this.seqID = value;
}
/**
* Gets the value of the rounding property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRounding() {
return rounding;
}
/**
* Sets the value of the rounding property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRounding(String value) {
this.rounding = value;
}
/**
* Gets the value of the zoneSize property.
*
*/
public int getZoneSize() {
return zoneSize;
}
/**
* Sets the value of the zoneSize property.
*
*/
public void setZoneSize(int value) {
this.zoneSize = value;
}
}
@@ -0,0 +1,100 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="CompoundMark" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Mark" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"compoundMark"
})
public class XMLCourse {
@XmlElement(name = "CompoundMark", required = true)
protected List<XMLCompoundMark> compoundMark;
/**
* Gets the value of the compoundMark property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the compoundMark property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCompoundMark().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLCompoundMark }
*
*
*/
public List<XMLCompoundMark> getCompoundMark() {
if (compoundMark == null) {
compoundMark = new ArrayList<XMLCompoundMark>();
}
return this.compoundMark;
}
}
@@ -0,0 +1,86 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Limit" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"limit"
})
public class XMLCourseLimit {
@XmlElement(name = "Limit", required = true)
protected List<XMLLimit> limit;
/**
* Gets the value of the limit property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the limit property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getLimit().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLLimit }
*
*
*/
public List<XMLLimit> getLimit() {
if (limit == null) {
limit = new ArrayList<XMLLimit>();
}
return this.limit;
}
}
@@ -0,0 +1,95 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public class XMLLimit {
@XmlAttribute(name = "Lat", required = true)
protected double lat;
@XmlAttribute(name = "Lon", required = true)
protected double lon;
@XmlAttribute(name = "SeqID", required = true)
protected int seqID;
/**
* Gets the value of the lat property.
*
*/
public double getLat() {
return lat;
}
/**
* Sets the value of the lat property.
*
*/
public void setLat(double value) {
this.lat = value;
}
/**
* Gets the value of the lon property.
*
*/
public double getLon() {
return lon;
}
/**
* Sets the value of the lon property.
*
*/
public void setLon(double value) {
this.lon = value;
}
/**
* Gets the value of the seqID property.
*
*/
public int getSeqID() {
return seqID;
}
/**
* Sets the value of the seqID property.
*
*/
public void setSeqID(int value) {
this.seqID = value;
}
}
@@ -0,0 +1,149 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public class XMLMark {
@XmlAttribute(name = "SeqId")
protected Integer seqId;
@XmlAttribute(name = "Name", required = true)
protected String name;
@XmlAttribute(name = "TargetLat", required = true)
protected double targetLat;
@XmlAttribute(name = "TargetLng", required = true)
protected double targetLng;
@XmlAttribute(name = "SourceID", required = true)
protected int sourceID;
/**
* Gets the value of the seqId property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getSeqId() {
return seqId;
}
/**
* Sets the value of the seqId property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setSeqId(Integer value) {
this.seqId = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the targetLat property.
*
*/
public double getTargetLat() {
return targetLat;
}
/**
* Sets the value of the targetLat property.
*
*/
public void setTargetLat(double value) {
this.targetLat = value;
}
/**
* Gets the value of the targetLng property.
*
*/
public double getTargetLng() {
return targetLng;
}
/**
* Sets the value of the targetLng property.
*
*/
public void setTargetLng(double value) {
this.targetLng = value;
}
/**
* Gets the value of the sourceID property.
*
*/
public int getSourceID() {
return sourceID;
}
/**
* Sets the value of the sourceID property.
*
*/
public void setSourceID(int value) {
this.sourceID = value;
}
}
@@ -0,0 +1,85 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Yacht" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"yacht"
})
public class XMLParticipants {
@XmlElement(name = "Yacht", required = true)
protected List<XMLYacht> yacht;
/**
* Gets the value of the yacht property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the yacht property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getYacht().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLYacht }
*
*
*/
public List<XMLYacht> getYacht() {
if (yacht == null) {
yacht = new ArrayList<XMLYacht>();
}
return this.yacht;
}
}
@@ -0,0 +1,362 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 03:20:03 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="RaceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="RaceType" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="CreationTimeDate" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="RaceStartTime">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="Postpone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="Time" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="Participants">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Yacht" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="CompoundMarkSequence">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Corner" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Rounding" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="ZoneSize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="Course">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="CompoundMark" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Mark" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SeqId" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="TargetLat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="TargetLng" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;attribute name="CompoundMarkID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="CourseLimit">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Limit" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="Lat" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="Lon" use="required" type="{http://www.w3.org/2001/XMLSchema}double" />
* &lt;attribute name="SeqID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"raceID",
"raceType",
"creationTimeDate",
"raceStartTime",
"participants",
"compoundMarkSequence",
"course",
"courseLimit"
})
@XmlRootElement(name = "Race")
public class XMLRace {
@XmlElement(name = "RaceID")
protected int raceID;
@XmlElement(name = "RaceType", required = true)
protected String raceType;
@XmlElement(name = "CreationTimeDate", required = true)
protected String creationTimeDate;
@XmlElement(name = "RaceStartTime", required = true)
protected XMLRaceStartTime raceStartTime;
@XmlElement(name = "Participants", required = true)
protected XMLParticipants participants;
@XmlElement(name = "CompoundMarkSequence", required = true)
protected XMLCompoundMarkSequence compoundMarkSequence;
@XmlElement(name = "Course", required = true)
protected XMLCourse course;
@XmlElement(name = "CourseLimit", required = true)
protected XMLCourseLimit courseLimit;
/**
* Gets the value of the raceID property.
*
*/
public int getRaceID() {
return raceID;
}
/**
* Sets the value of the raceID property.
*
*/
public void setRaceID(int value) {
this.raceID = value;
}
/**
* Gets the value of the raceType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRaceType() {
return raceType;
}
/**
* Sets the value of the raceType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRaceType(String value) {
this.raceType = value;
}
/**
* Gets the value of the creationTimeDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCreationTimeDate() {
return creationTimeDate;
}
/**
* Sets the value of the creationTimeDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCreationTimeDate(String value) {
this.creationTimeDate = value;
}
/**
* Gets the value of the raceStartTime property.
*
* @return
* possible object is
* {@link XMLRaceStartTime }
*
*/
public XMLRaceStartTime getRaceStartTime() {
return raceStartTime;
}
/**
* Sets the value of the raceStartTime property.
*
* @param value
* allowed object is
* {@link XMLRaceStartTime }
*
*/
public void setRaceStartTime(XMLRaceStartTime value) {
this.raceStartTime = value;
}
/**
* Gets the value of the participants property.
*
* @return
* possible object is
* {@link XMLParticipants }
*
*/
public XMLParticipants getParticipants() {
return participants;
}
/**
* Sets the value of the participants property.
*
* @param value
* allowed object is
* {@link XMLParticipants }
*
*/
public void setParticipants(XMLParticipants value) {
this.participants = value;
}
/**
* Gets the value of the compoundMarkSequence property.
*
* @return
* possible object is
* {@link XMLCompoundMarkSequence }
*
*/
public XMLCompoundMarkSequence getCompoundMarkSequence() {
return compoundMarkSequence;
}
/**
* Sets the value of the compoundMarkSequence property.
*
* @param value
* allowed object is
* {@link XMLCompoundMarkSequence }
*
*/
public void setCompoundMarkSequence(XMLCompoundMarkSequence value) {
this.compoundMarkSequence = value;
}
/**
* Gets the value of the course property.
*
* @return
* possible object is
* {@link XMLCourse }
*
*/
public XMLCourse getCourse() {
return course;
}
/**
* Sets the value of the course property.
*
* @param value
* allowed object is
* {@link XMLCourse }
*
*/
public void setCourse(XMLCourse value) {
this.course = value;
}
/**
* Gets the value of the courseLimit property.
*
* @return
* possible object is
* {@link XMLCourseLimit }
*
*/
public XMLCourseLimit getCourseLimit() {
return courseLimit;
}
/**
* Sets the value of the courseLimit property.
*
* @param value
* allowed object is
* {@link XMLCourseLimit }
*
*/
public void setCourseLimit(XMLCourseLimit value) {
this.courseLimit = value;
}
}
@@ -0,0 +1,127 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:41:51 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the shared.xml.Race package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class XMLRaceFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: shared.xml.Race
*
*/
public XMLRaceFactory() {
}
/**
* Create an instance of {@link XMLRace }
*
*/
public XMLRace createRace() {
return new XMLRace();
}
/**
* Create an instance of {@link XMLRaceStartTime }
*
*/
public XMLRaceStartTime createXMLRaceStartTime() {
return new XMLRaceStartTime();
}
/**
* Create an instance of {@link XMLParticipants }
*
*/
public XMLParticipants createXMLParticipants() {
return new XMLParticipants();
}
/**
* Create an instance of {@link XMLCompoundMarkSequence }
*
*/
public XMLCompoundMarkSequence createXMLCompoundMarkSequence() {
return new XMLCompoundMarkSequence();
}
/**
* Create an instance of {@link XMLCourse }
*
*/
public XMLCourse createXMLCourse() {
return new XMLCourse();
}
/**
* Create an instance of {@link XMLCourseLimit }
*
*/
public XMLCourseLimit createXMLCourseLimit() {
return new XMLCourseLimit();
}
/**
* Create an instance of {@link XMLLimit }
*
*/
public XMLLimit createXMLLimit() {
return new XMLLimit();
}
/**
* Create an instance of {@link XMLCompoundMark }
*
*/
public XMLCompoundMark createXMLCompoundMark() {
return new XMLCompoundMark();
}
/**
* Create an instance of {@link XMLMark }
*
*/
public XMLMark createXMLMark() {
return new XMLMark();
}
/**
* Create an instance of {@link XMLCorner }
*
*/
public XMLCorner createXMLCorner() {
return new XMLCorner();
}
/**
* Create an instance of {@link XMLYacht }
*
*/
public XMLYacht createXMLYacht() {
return new XMLYacht();
}
}
@@ -0,0 +1,92 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="Postpone" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;attribute name="Time" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public class XMLRaceStartTime {
@XmlAttribute(name = "Postpone", required = true)
protected String postpone;
@XmlAttribute(name = "Time", required = true)
protected String time;
/**
* Gets the value of the postpone property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPostpone() {
return postpone;
}
/**
* Sets the value of the postpone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPostpone(String value) {
this.postpone = value;
}
/**
* Gets the value of the time property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTime() {
return time;
}
/**
* Sets the value of the time property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTime(String value) {
this.time = value;
}
}
@@ -0,0 +1,84 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.14 at 02:54:32 AM NZST
//
package shared.xml.Race;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="SourceID" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
* &lt;attribute name="Entry" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public class XMLYacht {
@XmlAttribute(name = "SourceID", required = true)
protected int sourceID;
@XmlAttribute(name = "Entry")
protected String entry;
/**
* Gets the value of the sourceID property.
*
*/
public int getSourceID() {
return sourceID;
}
/**
* Sets the value of the sourceID property.
*
*/
public void setSourceID(int value) {
this.sourceID = value;
}
/**
* Gets the value of the entry property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEntry() {
return entry;
}
/**
* Sets the value of the entry property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEntry(String value) {
this.entry = value;
}
}
@@ -3,6 +3,7 @@ package shared.xml;
import mock.xml.Race;
import mock.xml.RaceXMLCreator;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
@@ -17,6 +18,7 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
@@ -47,7 +49,7 @@ public class XMLUtilities {
public static Object xmlToClass(String xml, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(xml);
Document document = parser.parse(new InputSource(new ByteArrayInputStream(xml.getBytes("utf-8"))));
return xmlToClass(document, schemaURL, c);
}