The service metadata structure is defined by two XML schema definition (XSD) resources. The internal XSD owned by the Service Registry describes the frame of the metadata documents and properties mandatory for being handled by the Service Registry. It imports a schema which is expected as file <TalendRuntimePath>/etc/org.talend.esb.registry.server.metadata.xsd. The outline of this schema looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema
targetNamespace="http://metadata.extension.registry.esb.talend.org/v1"
elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://metadata.extension.registry.esb.talend.org/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<element name="metadata" type="tns:metadata"></element>
<complexType name="metadata">
<sequence>
<element name="CustomServiceType" type="string"></element>
<element name="CustomCreationDate">
<simpleType>
<restriction base="date">
<pattern value="[^:Z]*"></pattern>
</restriction>
</simpleType>
</element>
<element name="CustomDescription" type="string"></element>
<element name="CustomServiceOwner" type="string"></element>
</sequence>
</complexType>
</schema>
This sample schema shows what is expected as parts of a conversion-safe
schema. The custom schema information needs to be added in
<sequence>...</sequence>
. In the example shown above it
consists of all elements starting with Custom
. Element names are
chosen for demonstration purpose. There is no mandatory naming convention for
custom element names. However, there are restrictions to the custom schema
imposed by the fact that for import into ElasticSearch, metadata resources need
to be unambiguously convertible to JSON documents:
-
Custom namespaces are discarded on conversion. Therefore, XML nodes should have unique local names.
-
It is recommended to have metadata as a flat sequence of elements or elements nested in a simple way.
-
Inheritance and other advanced XML schema constructs are not supported.
When synchronization with ElasticSearch is configured, a JSON mapping template file must be created which matches the custom schema. The mapping file is <TalendRuntimePath>/etc/org.talend.esb.registry.el.sync.template.json.