Loading .gitignore 0 → 100644 +1 −0 Original line number Original line Diff line number Diff line target/** pom.xml 0 → 100644 +34 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>it.oats.inaf</groupId> <artifactId>vospace-datamodel</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <!-- JAXB dependency --> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.2</version> </dependency> <!-- Jackson-JAXB compatibility --> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> <version>2.10.3</version> </dependency> </dependencies> </project> No newline at end of file src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeJsonResolver.java 0 → 100644 +44 −0 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.DatabindContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase; import net.ivoa.xml.vospace.v2.Node; /** * This class is called during JSON serialization and deserialization and it is * necessary to keep the vos prefix in the type property when performing a * conversion between XML and JSON and considering also the inheritance of the * Node class. * * The Node class must be annotated in this way: * * @JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type", include = * JsonTypeInfo.As.EXISTING_PROPERTY) * @JsonTypeIdResolver(NodeTypeJsonResolver.class) */ public class NodeTypeJsonResolver extends TypeIdResolverBase { @Override public String idFromValueAndType(Object o, Class<?> type) { return idFromValue(o); } @Override public String idFromValue(Object o) { Node node = (Node) o; return node.getType(); } @Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; } @Override public JavaType typeFromId(DatabindContext context, String id) { String noPrefixId = id.replace("vos:", ""); return context.getTypeFactory().constructFromCanonical("net.ivoa.xml.vospace.v2." + noPrefixId); } } src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeSetter.java 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.databind.util.StdConverter; import net.ivoa.xml.vospace.v2.Node; /** * Fills the type field at the end of the JSON deserialization. * Node implementations must be annotated with * @JsonDeserialize(converter = NodeTypeAdder.<NodeType>.class) */ public class NodeTypeSetter<T extends Node> extends StdConverter<T, T> { @Override public T convert(T node) { node.setType("vos:" + node.getClass().getSimpleName()); return node; } public static class UnstructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.UnstructuredDataNode> { } public static class StructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.StructuredDataNode> { } public static class ContainerNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.ContainerNode> { } public static class LinkNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.LinkNode> { } } src/main/java/net/ivoa/xml/uws/v1/ErrorSummary.java 0 → 100644 +121 −0 Original line number Original line Diff line number Diff line // // 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: 2020.10.24 at 09:39:16 AM CEST // package net.ivoa.xml.uws.v1; 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; /** * * A short summary of an error - a fuller representation of the * error may be retrieved from /{jobs}/{job-id}/error * * * <p>Java class for ErrorSummary complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="ErrorSummary"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/> * </sequence> * <attribute name="type" use="required" type="{http://www.ivoa.net/xml/UWS/v1.0}ErrorType" /> * <attribute name="hasDetail" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /> * </restriction> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ErrorSummary", propOrder = { "message" }) public class ErrorSummary { @XmlElement(required = true) protected String message; @XmlAttribute(name = "type", required = true) protected ErrorType type; @XmlAttribute(name = "hasDetail", required = true) protected boolean hasDetail; /** * Gets the value of the message property. * * @return * possible object is * {@link String } * */ public String getMessage() { return message; } /** * Sets the value of the message property. * * @param value * allowed object is * {@link String } * */ public void setMessage(String value) { this.message = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link ErrorType } * */ public ErrorType getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link ErrorType } * */ public void setType(ErrorType value) { this.type = value; } /** * Gets the value of the hasDetail property. * */ public boolean isHasDetail() { return hasDetail; } /** * Sets the value of the hasDetail property. * */ public void setHasDetail(boolean value) { this.hasDetail = value; } } Loading
pom.xml 0 → 100644 +34 −0 Original line number Original line Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>it.oats.inaf</groupId> <artifactId>vospace-datamodel</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <!-- JAXB dependency --> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.glassfish.jaxb</groupId> <artifactId>jaxb-runtime</artifactId> <version>2.3.2</version> </dependency> <!-- Jackson-JAXB compatibility --> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> <version>2.10.3</version> </dependency> </dependencies> </project> No newline at end of file
src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeJsonResolver.java 0 → 100644 +44 −0 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.DatabindContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase; import net.ivoa.xml.vospace.v2.Node; /** * This class is called during JSON serialization and deserialization and it is * necessary to keep the vos prefix in the type property when performing a * conversion between XML and JSON and considering also the inheritance of the * Node class. * * The Node class must be annotated in this way: * * @JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type", include = * JsonTypeInfo.As.EXISTING_PROPERTY) * @JsonTypeIdResolver(NodeTypeJsonResolver.class) */ public class NodeTypeJsonResolver extends TypeIdResolverBase { @Override public String idFromValueAndType(Object o, Class<?> type) { return idFromValue(o); } @Override public String idFromValue(Object o) { Node node = (Node) o; return node.getType(); } @Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; } @Override public JavaType typeFromId(DatabindContext context, String id) { String noPrefixId = id.replace("vos:", ""); return context.getTypeFactory().constructFromCanonical("net.ivoa.xml.vospace.v2." + noPrefixId); } }
src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeSetter.java 0 → 100644 +30 −0 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.databind.util.StdConverter; import net.ivoa.xml.vospace.v2.Node; /** * Fills the type field at the end of the JSON deserialization. * Node implementations must be annotated with * @JsonDeserialize(converter = NodeTypeAdder.<NodeType>.class) */ public class NodeTypeSetter<T extends Node> extends StdConverter<T, T> { @Override public T convert(T node) { node.setType("vos:" + node.getClass().getSimpleName()); return node; } public static class UnstructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.UnstructuredDataNode> { } public static class StructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.StructuredDataNode> { } public static class ContainerNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.ContainerNode> { } public static class LinkNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.LinkNode> { } }
src/main/java/net/ivoa/xml/uws/v1/ErrorSummary.java 0 → 100644 +121 −0 Original line number Original line Diff line number Diff line // // 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: 2020.10.24 at 09:39:16 AM CEST // package net.ivoa.xml.uws.v1; 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; /** * * A short summary of an error - a fuller representation of the * error may be retrieved from /{jobs}/{job-id}/error * * * <p>Java class for ErrorSummary complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="ErrorSummary"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/> * </sequence> * <attribute name="type" use="required" type="{http://www.ivoa.net/xml/UWS/v1.0}ErrorType" /> * <attribute name="hasDetail" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /> * </restriction> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ErrorSummary", propOrder = { "message" }) public class ErrorSummary { @XmlElement(required = true) protected String message; @XmlAttribute(name = "type", required = true) protected ErrorType type; @XmlAttribute(name = "hasDetail", required = true) protected boolean hasDetail; /** * Gets the value of the message property. * * @return * possible object is * {@link String } * */ public String getMessage() { return message; } /** * Sets the value of the message property. * * @param value * allowed object is * {@link String } * */ public void setMessage(String value) { this.message = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link ErrorType } * */ public ErrorType getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link ErrorType } * */ public void setType(ErrorType value) { this.type = value; } /** * Gets the value of the hasDetail property. * */ public boolean isHasDetail() { return hasDetail; } /** * Sets the value of the hasDetail property. * */ public void setHasDetail(boolean value) { this.hasDetail = value; } }