Class SchematronValidationService

java.lang.Object
ddf.services.schematron.SchematronValidationService
All Implemented Interfaces:
ddf.catalog.util.Describable, ddf.catalog.validation.MetacardValidator, ddf.catalog.validation.ReportingMetacardValidator, org.codice.ddf.platform.services.common.Describable

public class SchematronValidationService extends Object implements ddf.catalog.validation.MetacardValidator, ddf.catalog.util.Describable, ddf.catalog.validation.ReportingMetacardValidator
This pre-ingest service provides validation of an ingested XML document against a Schematron schema file.

When this service is instantiated at deployment time to the OSGi container it goes through 3 different preprocessing stages on the Schematron schema file. (These steps are required by the ISO Schematron implementation)

  1. 1. Preprocess the Schematron schema with iso_dsdl_include.xsl. This is a macro processor to assemble the schema from various parts.
  2. 2. Preprocess the output from stage 1 with iso_abstract_expand.xsl. This is a macro processor to convert abstract patterns to real patterns.
  3. 3. Compile the Schematron schema into an XSLT script. This will use iso_svrl_for_xslt2.xsl (which in turn invokes iso_schematron_skeleton_for_saxon.xsl)

When XML documents are ingested, this service will run the XSLT generated by stage 3 against the XML document, validating it against the "compiled" Schematron schema file.

This service is using the SVRL script, hence the output of the validation will be an SVRL-formatted XML document.

Author:
rodgersh
See Also:
  • Field Details

  • Constructor Details

    • SchematronValidationService

      public SchematronValidationService()
  • Method Details

    • init

      public void init() throws SchematronInitializationException
      Throws:
      SchematronInitializationException
    • setSuppressWarnings

      public void setSuppressWarnings(boolean suppressWarnings)
    • setSchematronFileNames

      public void setSchematronFileNames(List<String> schematronFileNames) throws SchematronInitializationException
      Throws:
      SchematronInitializationException
    • setNamespace

      public void setNamespace(String namespace)
    • setPriority

      public void setPriority(int priority)
    • validate

      public void validate(ddf.catalog.data.Metacard metacard) throws ddf.catalog.validation.ValidationException
      Specified by:
      validate in interface ddf.catalog.validation.MetacardValidator
      Throws:
      ddf.catalog.validation.ValidationException
    • getVersion

      public String getVersion()
      Specified by:
      getVersion in interface ddf.catalog.util.Describable
      Specified by:
      getVersion in interface org.codice.ddf.platform.services.common.Describable
    • getId

      public String getId()
      Specified by:
      getId in interface ddf.catalog.util.Describable
      Specified by:
      getId in interface org.codice.ddf.platform.services.common.Describable
    • setId

      public void setId(String id)
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface ddf.catalog.util.Describable
      Specified by:
      getTitle in interface org.codice.ddf.platform.services.common.Describable
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface ddf.catalog.util.Describable
      Specified by:
      getDescription in interface org.codice.ddf.platform.services.common.Describable
    • getOrganization

      public String getOrganization()
      Specified by:
      getOrganization in interface ddf.catalog.util.Describable
      Specified by:
      getOrganization in interface org.codice.ddf.platform.services.common.Describable
    • validateMetacard

      public Optional<ddf.catalog.validation.report.MetacardValidationReport> validateMetacard(ddf.catalog.data.Metacard metacard)
      Specified by:
      validateMetacard in interface ddf.catalog.validation.ReportingMetacardValidator