Class IvoaSchemaResolver

  • All Implemented Interfaces:
    org.w3c.dom.ls.LSResourceResolver

    public class IvoaSchemaResolver
    extends java.lang.Object
    implements org.w3c.dom.ls.LSResourceResolver
    ResourceResolver implementation used for validating documents against XSD schemas relating to known IVOA standards. Schemas for a number of IVOA-related namespaces are kept locally. This means both that validation can be performed without having to retrieve documents from the remote IVOA web site, and also that documents are not able to subsitute their own hacked versions of the schema for a given namespace, they have to use the official one.
    Since:
    28 Apr 2014
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String AVAILABILITY_URI
      Namespace URI for VOSI availability schema.
      static java.lang.String CAPABILITIES_URI
      Namespace URI for VOSI capabilities schema.
      static java.util.Map<java.lang.String,​java.net.URL> IVOA_SCHEMA_MAP
      Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.ivoa.net.
      static java.lang.String UWS_URI
      Namespace URI for UWS schema.
      static java.lang.String VODATASERVICE_URI
      Namespace URI for VODataService schema.
      static java.util.Map<java.lang.String,​java.net.URL> W3C_SCHEMA_MAP
      Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.w3.org.
    • Constructor Summary

      Constructors 
      Constructor Description
      IvoaSchemaResolver()
      Constructs a resolver with a default schema map.
      IvoaSchemaResolver​(java.util.Map<java.lang.String,​java.net.URL> schemaMap)
      Constructs a resolver with a supplied schema map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getResolvedNamespaces()
      Returns the the schema namespaces which this resolver has so far been asked to resolve, and has successfully resolved to known URLs.
      java.util.Map<java.lang.String,​java.net.URL> getSchemaMap()
      Returns the namespace->URL map of schemas known by this resolver.
      java.util.Set<java.lang.String> getUnresolvedNamespaces()
      Returns the schema namespaces which this resolver has so far been asked to resolve, and has failed because they are unknown.
      org.w3c.dom.ls.LSInput resolveResource​(java.lang.String type, java.lang.String namespaceURI, java.lang.String publicId, java.lang.String systemId, java.lang.String baseURI)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VODATASERVICE_URI

        public static final java.lang.String VODATASERVICE_URI
        Namespace URI for VODataService schema.
        See Also:
        Constant Field Values
      • CAPABILITIES_URI

        public static final java.lang.String CAPABILITIES_URI
        Namespace URI for VOSI capabilities schema.
        See Also:
        Constant Field Values
      • AVAILABILITY_URI

        public static final java.lang.String AVAILABILITY_URI
        Namespace URI for VOSI availability schema.
        See Also:
        Constant Field Values
      • UWS_URI

        public static final java.lang.String UWS_URI
        Namespace URI for UWS schema.
        See Also:
        Constant Field Values
      • IVOA_SCHEMA_MAP

        public static final java.util.Map<java.lang.String,​java.net.URL> IVOA_SCHEMA_MAP
        Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.ivoa.net. Note that the namespace (map key) does not necessarily match the URL (map value) in point of minor version number; the minor version number in the URL may be later than the one in the namespace. This is deliberate, and is codified and explained in the XML Versioning document (at time of writing, PEN-XMLVers-1.0-20160906, sec 2.2.3).
      • W3C_SCHEMA_MAP

        public static final java.util.Map<java.lang.String,​java.net.URL> W3C_SCHEMA_MAP
        Unmodifiable map of namespace URIs to local schema URLs for a selection of schemas from http://www.w3.org.
    • Constructor Detail

      • IvoaSchemaResolver

        public IvoaSchemaResolver​(java.util.Map<java.lang.String,​java.net.URL> schemaMap)
        Constructs a resolver with a supplied schema map.
        Parameters:
        schemaMap - of known namespace to schema URLs
      • IvoaSchemaResolver

        public IvoaSchemaResolver()
        Constructs a resolver with a default schema map.
    • Method Detail

      • getSchemaMap

        public java.util.Map<java.lang.String,​java.net.URL> getSchemaMap()
        Returns the namespace->URL map of schemas known by this resolver. This may be modified to change the resolution behaviour.
        Returns:
        modifiable namespace->URL map for known schemas
      • resolveResource

        public org.w3c.dom.ls.LSInput resolveResource​(java.lang.String type,
                                                      java.lang.String namespaceURI,
                                                      java.lang.String publicId,
                                                      java.lang.String systemId,
                                                      java.lang.String baseURI)
        Specified by:
        resolveResource in interface org.w3c.dom.ls.LSResourceResolver
      • getResolvedNamespaces

        public java.util.Set<java.lang.String> getResolvedNamespaces()
        Returns the the schema namespaces which this resolver has so far been asked to resolve, and has successfully resolved to known URLs.
        Returns:
        successful schema namespace resolutions to date
      • getUnresolvedNamespaces

        public java.util.Set<java.lang.String> getUnresolvedNamespaces()
        Returns the schema namespaces which this resolver has so far been asked to resolve, and has failed because they are unknown.
        Returns:
        unsuccessful schema namespace resolutions to date