Class SchemaInformation


  • public class SchemaInformation
    extends Object
    Information about types and properties declared in OGC/ISO schemas. This class requires a connection to http://standards.iso.org/iso/19115/-3/ or a local copy of those files.

    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 amount of Maps that we need to manage.

    Since:
    3.1
    • Constructor Detail

      • SchemaInformation

        public SchemaInformation​(Path schemaRootDirectory,
                                 Departures departures,
                                 DocumentationStyle style)
        Creates a new verifier. If the computer contains a local copy of ISO schemas, then the schemaRootDirectory argument can be set to that directory for faster schema loadings. If non-null, that directory should contain the same files than http://standards.iso.org/iso/ (not necessarily with all sub-directories). In particular, that directory should contain an 19115 sub-directory.

        The Departures.mergedTypes entries 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, or null if none.
        departures - expected departures between XML schemas and GeoAPI annotations.
        style - style of the documentation to store (none, verbatim or sentences).
    • Method Detail

      • getTypeDefinition

        public Map<String,​SchemaInformation.ElementgetTypeDefinition​(String typeName)
        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 the null key for the class containing those properties.

        The given typeName shall be the XML name, not the OGC/ISO name. They differ for abstract classes. For example the Party type 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"), or null.
        Returns:
        all properties for the given class in declaration order, or null if unknown.
      • getTypeDefinition

        public Map<String,​SchemaInformation.ElementgetTypeDefinition​(Class<?> type)
        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 to getTypeDefinition(String).
        Parameters:
        type - the GeoAPI interface (e.g. Metadata), or null.
        Returns:
        all properties for the given class in declaration order, or null if unknown.