Limitations:
Current implementation ignores the XML prefix (e.g."cit:" in "cit:CI_Citation").
We assume that there is no name collision, especially given that "CI_" prefix in front of
most OGC/ISO class names have the effect of a namespace. If a collision nevertheless happen, then
an exception will be thrown.
Current implementation assumes that XML element name, type name, property name and property type
name follow some naming convention. For example, type names are suffixed with "_Type" in OGC
schemas, while property type names are suffixed with "_PropertyType". This class throws an
exception if a type does not follow the expected naming convention. This requirement makes
implementation easier, by reducing the number of Maps that we need to manage.
- Since:
- 3.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe type and namespace of a property or type. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSchemaInformation(Path schemaRootDirectory, Departures departures, DocumentationStyle style) Creates a new verifier. -
Method Summary
Modifier and TypeMethodDescriptiongetTypeDefinition(Class<?> type) Returns the type definitions for the given class.getTypeDefinition(String typeName) Returns the type definitions for a class of the given name.voidLoads the default set of XSD files.voidloadSchema(String location) Loads the XSD file at the given URL.
-
Field Details
-
SCHEMA_ROOT_URL
The URL from where to download ISO schema. The complete URL is formed by taking a namespace, replace the "http://standards.iso.org/iso/" by this "https://schemas.isotc211.org/" value, then append".xsd"suffix.- See Also:
-
ROOT_NAMESPACE
The root of ISO namespaces, which is "http://standards.iso.org/iso/". Not used for downloading XSD files. This URL differs fromSCHEMA_ROOT_URLfor historical reasons.- See Also:
-
-
Constructor Details
-
SchemaInformation
Creates a new verifier. If the computer contains a local copy of ISO schemas, then theschemaRootDirectoryargument can be set to that directory for faster schema loadings. If non-null, that directory should contain the same files as https://schemas.isotc211.org/ (not necessarily with all sub-directories). In particular, that directory should contain an19115sub-directory.The
Departures.mergedTypesentries will be removed as they are found. This allows the caller to verify if the map contains any unnecessary departure declarations.- Parameters:
schemaRootDirectory- path to local copy of ISO schemas, ornullif none.departures- expected departures between XML schemas and GeoAPI annotations.style- style of the documentation to store (none, verbatim or sentences).
-
-
Method Details
-
loadDefaultSchemas
public void loadDefaultSchemas() throws ParserConfigurationException, IOException, SAXException, SchemaExceptionLoads the default set of XSD files. This method invokesloadSchema(String)for a predefined set of metadata schemas, in approximate dependency order.- Throws:
ParserConfigurationException- if the XML parser cannot be created.IOException- if an I/O error occurred while reading a file.SAXException- if a file cannot be parsed as a XML document.SchemaException- if a XML document cannot be interpreted as an OGC/ISO schema.
-
loadSchema
public void loadSchema(String location) throws ParserConfigurationException, IOException, SAXException, SchemaException Loads the XSD file at the given URL. Only information of interest are stored, and we assume that the XSD follows OGC/ISO conventions. This method may be invoked recursively if the XSD contains<xs:include>elements.- Parameters:
location- complete URL to the XSD file to load.- Throws:
ParserConfigurationException- if the XML parser cannot be created.IOException- if an I/O error occurred while reading the specified file.SAXException- if the specified file cannot be parsed as a XML document.SchemaException- if the XML document cannot be interpreted as an OGC/ISO schema.
-
getTypeDefinition
Returns the type definitions for a class of the given name. Keys are property names and values are their types, with"_PropertyType"suffix omitted. The map contains an entry associated to thenullkey for the class containing those properties.The given
typeNameshall be the XML name, not the OGC/ISO name. They differ for abstract classes. For example, thePartytype is named"CI_Party"is OGC/ISO models but"AbstractCI_Party"in XML schemas.- Parameters:
typeName- XML name of a type (e.g."MD_Metadata"), ornull.- Returns:
- all properties for the given class in declaration order, or
nullif unknown.
-
getTypeDefinition
Returns the type definitions for the given class. This convenience method computes a XML name from the annotations attached to the given type, then delegates togetTypeDefinition(String).- Parameters:
type- the GeoAPI interface (e.g.Metadata), ornull.- Returns:
- all properties for the given class in declaration order, or
nullif unknown.
-