Commit abd2a06f authored by Sonia Zorba's avatar Sonia Zorba
Browse files


parent 9ed68210
# VOSpace XML
# VOSpace REST service
## Generating beans from XML schema
## Database
cd xsd
xjc vospace.xsd
This VOSpace implementation uses the database populated by the [VOSpace Transfer Service application]( To avoid duplicating database definitions, DAO test classes load the database directly from the files of that repository. We assume that when running the tests the git repository exists and it is located in the same parent folder containing this repository. We could decide to create a dedicate common repository for sharing only the database structure and configuration files between the 2 projects.
### 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:
<xsd:import namespace="" schemaLocation="./uws.xsd"/>
In uws.xsd:
<xs:import namespace="" schemaLocation="./xlink.xsd"/>
### Changes to the generated classes
In the following element has been added to serialize the XML keeping the namespace.
xmlns = {
namespaceURI = "",
prefix = "vos"
Some issues emerged in handling inheritance and namespaces in a way compatible both to JSON and XML formats.
In type has been added:
@XmlAttribute(name = "type", namespace = "")
protected String type;
public String getType() {
return type;
For JSON compatibility the following has been added to (annotation on class):
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type", include = JsonTypeInfo.As.EXISTING_PROPERTY)
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")
@JsonDeserialize(converter = NodeTypeSetter.UnstructuredDataNode.class)
`@XmlRootElement` is necessary to parse single nodes. The value `"node"` has been specified because by default the bean would be serialized as `<unstructuredDataNode>`.
The `NodeTypeSetter` class fills the `type` field during JSON serialization and deserialization.
To reconfigure the path of that repository edit the property `init_database_scripts_path` in
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment