pax_global_header 0000666 0000000 0000000 00000000064 14006305156 0014512 g ustar 00root root 0000000 0000000 52 comment=5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d
vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/ 0000775 0000000 0000000 00000000000 14006305156 0022101 5 ustar 00root root 0000000 0000000 vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/.gitignore 0000664 0000000 0000000 00000000026 14006305156 0024067 0 ustar 00root root 0000000 0000000 target/**
/nbproject/
vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/.gitlab-ci.yml 0000664 0000000 0000000 00000001501 14006305156 0024532 0 ustar 00root root 0000000 0000000 stages:
- build
- test
- deploy
build:
stage: build
tags:
- docker
image: maven:3.6.3-openjdk-11
script:
- mvn clean package -DskipTests -DfinalName=vospace-datamodel
artifacts:
paths:
- target/vospace-datamodel.jar
- pom.xml
expire_in: 7 days
only:
- master
test:
stage: test
tags:
- docker
script:
- mvn clean test
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print "coverage=" 100*covered/instructions }' target/site/jacoco/jacoco.csv
coverage: '/coverage=\d+\.\d+/'
only:
- master
deploy:
stage: deploy
tags:
- docker
script:
- mvn deploy:deploy-file
-Dfile=target/vospace-datamodel.jar
-DrepositoryId=ia2.snapshots
-DpomFile=pom.xml
-Durl=${IA2_MVN_REPO_SNAPSHOTS}
only:
- master
vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/README.md 0000664 0000000 0000000 00000004235 14006305156 0023364 0 ustar 00root root 0000000 0000000 # VOSpace Data Model
## Generating beans from XML schema
cd xsd
xjc vospace.xsd
### Changes to the online XSD files
It seems that xjc does something wrong when retriving the imported XSD from the web, so the dependent files have been downloaded and relative path has been specified in `schemaLocation` attribute.
In vospace.xsd:
In uws.xsd:
### Changes to the generated classes
In package-info.java the following element has been added to serialize the XML keeping the namespace.
xmlns = {
@javax.xml.bind.annotation.XmlNs(
namespaceURI = "http://www.ivoa.net/xml/VOSpace/v2.0",
prefix = "vos"
)
}
Some issues emerged in handling inheritance and namespaces in a way compatible both to JSON and XML formats. Moreover it was necessary to setup a workaround for filling the `xsi:type` of the root node:
In Node.java type field and removeType() method have been added:
// Used for generating missing type attribute for root node. For child nodes it is filled automatically.
@XmlAttribute(name = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance", required = false)
private String type;
/* This method exists to fix the issue with type attribute. See RemoveDuplicateTypeAdapter class. */
public void removeType() {
this.type = null;
}
For JSON compatibility the following has been added to Node.java (annotation on class):
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type", include = JsonTypeInfo.As.EXISTING_PROPERTY)
@JsonTypeIdResolver(NodeTypeJsonResolver.class)
The `@JsonTypeInfo` tells to Jackson that the field type is used to handle inheritance. A custom type id resolver has been created to handle the `vos:` prefix.
2 annotations have been added to each node subtype:
@XmlRootElement(name = "node")
`@XmlRootElement` is necessary to parse single nodes. The value `"node"` has been specified because by default the bean would be serialized as ``.
vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/nb-configuration.xml 0000664 0000000 0000000 00000001775 14006305156 0026101 0 ustar 00root root 0000000 0000000
JDK_14
vospace-datamodel-5c4d42c29b6a81c843018f3772a45e3c0ecd9a5d/pom.xml 0000664 0000000 0000000 00000006403 14006305156 0023421 0 ustar 00root root 0000000 0000000
4.0.0
it.oats.inaf
vospace-datamodel
1.0-SNAPSHOT
jar
UTF-8
11
11
${project.artifactId}-${project.version}
org.glassfish.jaxb
jaxb-runtime
2.3.2
runtime
com.fasterxml.jackson.module
jackson-module-jaxb-annotations
2.10.3
org.junit.jupiter
junit-jupiter-api
5.6.0
test
org.junit.jupiter
junit-jupiter-params
5.6.0
test
org.junit.jupiter
junit-jupiter-engine
5.6.0
test
com.jayway.jsonpath
json-path
2.4.0
test
com.jayway.jsonpath
json-path-assert
2.4.0
test
${finalName}
maven-surefire-plugin
2.22.2
org.jacoco
jacoco-maven-plugin
0.8.6
prepare-agent
report
test
report