Class DatalinkValidator


  • public class DatalinkValidator
    extends java.lang.Object
    Performs validation of DataLink documents. A Reporter instance is supplied at construction time, and all validation reports are reported via that object.

    The DataLink document is loaded as a DOM rather than using SAX to stream it. DataLink documents are expected to be of a fairly manageable size, so this should be OK.

    Since:
    23 Nov 2017
    Author:
    Mark Taylor
    See Also:
    DataLink-1.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      uk.ac.starlink.vo.datalink.LinksDoc createLinksDoc​(uk.ac.starlink.votable.VODocument vodoc)
      Parses a VOTable document as a DataLink structure, reporting any validation issues as it does.
      void validateDatalink​(java.io.InputStream in)
      Performs checks on a DataLink document read from a given input stream.
      void validateDatalink​(java.net.URL url, boolean isLinksService, boolean mustSucceed)
      Performs checks on a DataLink document obtained from a URL.
      void validateDatalink​(uk.ac.starlink.votable.VODocument vodoc)
      Performs DataLink-specific validation on a VOTable DOM.
      void validateLinksDoc​(uk.ac.starlink.vo.datalink.LinksDoc linksDoc)
      Performs checks on a LinksDoc object.
      • Methods inherited from class java.lang.Object

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

      • DatalinkValidator

        public DatalinkValidator​(Reporter reporter)
        Constructor.
        Parameters:
        reporter - destination for validation methods
    • Method Detail

      • validateDatalink

        public void validateDatalink​(java.net.URL url,
                                     boolean isLinksService,
                                     boolean mustSucceed)
        Performs checks on a DataLink document obtained from a URL.

        The supplied URL is assumed to refer to a GET request expected to return a DataLink document, and with no RESPONSEFORMAT parameter (which means that the result must be a TABLEDATA-serialization VOTable). Checks on the HTTP and DALI behaviour are run in addition to the DataLink checks themselves. Additional checks may be performed if the service is asserted to be a DataLink {links} service.

        Parameters:
        url - document URL
        isLinksService - true iff the service is supposed to conform to ivo://ivoa.net/std/DataLink#links-1.0
        mustSucceed - if true, the service is not supposed to return an error response
      • validateDatalink

        public void validateDatalink​(java.io.InputStream in)
        Performs checks on a DataLink document read from a given input stream.

        The supplied InputStream is assumed to be the result of a DataLink request with no RESPONSEFORMAT parameter, which means that the result must a TABLEDATA-serialization VOTable.

        Parameters:
        in - input stream
      • validateDatalink

        public void validateDatalink​(uk.ac.starlink.votable.VODocument vodoc)
        Performs DataLink-specific validation on a VOTable DOM.
        Parameters:
        vodoc - DOM assumed to contain a document conforming to the DataLink standard
      • validateLinksDoc

        public void validateLinksDoc​(uk.ac.starlink.vo.datalink.LinksDoc linksDoc)
        Performs checks on a LinksDoc object. This performs additional validation on an object which has already been parsed as a DataLink document.
        Parameters:
        linksDoc - object representing DataLink document
      • createLinksDoc

        public uk.ac.starlink.vo.datalink.LinksDoc createLinksDoc​(uk.ac.starlink.votable.VODocument vodoc)
        Parses a VOTable document as a DataLink structure, reporting any validation issues as it does.
        Parameters:
        vodoc - DOM assumed to conform to DataLink rules
        Returns:
        parsed represntation of the DataLink document