Class PSBoundSchemaCacheKey

java.lang.Object
com.helger.schematron.pure.bound.PSBoundSchemaCacheKey

@Immutable public class PSBoundSchemaCacheKey extends Object
This class represents keys for the PSBoundSchemaCache. It is a combination of a resource and a phase. It is the responsible class for reading and binding a Schematron resource.
Author:
Philip Helger
  • Constructor Details

  • Method Details

    • isLenient

      public boolean isLenient()
    • getResource

      @Nonnull public final com.helger.commons.io.resource.IReadableResource getResource()
      Returns:
      The resource passed in the constructor. Never null.
    • getPhase

      @Nullable public final String getPhase()
      Returns:
      The phase selected in the constructor. May be null.
    • getErrorHandler

      @Nullable public final IPSErrorHandler getErrorHandler()
      Returns:
      The error handler passed in the constructor. May be null.
    • getCustomValidationHandler

      @Nullable public final IPSValidationHandler getCustomValidationHandler()
      Returns:
      The custom validation handler. May be null.
      Since:
      5.3.0
    • getXPathConfig

      @Nonnull public final IXPathConfig getXPathConfig()
      Returns:
      The XPath configuration to be used. May be null.
      Since:
      5.5.0
    • getEntityResolver

      @Nullable public final EntityResolver getEntityResolver()
      Returns:
      The XML entity resolver to be used. May be null.
    • readSchema

      @Nonnull @OverrideOnDemand public PSSchema readSchema(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable IPSErrorHandler aErrorHandler, @Nullable EntityResolver aEntityResolver) throws com.helger.schematron.SchematronException
      Read the specified schema from the passed resource.
      Parameters:
      aResource - The resource to read from. Never null.
      aErrorHandler - The error handler to use. May be null.
      aEntityResolver - The XML entity resolver to be used. May be null.
      Returns:
      The read schema. May not be null.
      Throws:
      com.helger.schematron.SchematronException - In case there is an error reading.
    • getQueryBinding

      @Nonnull @OverrideOnDemand public IPSQueryBinding getQueryBinding(@Nonnull PSSchema aSchema) throws com.helger.schematron.SchematronException
      Determine the query binding for the read schema.
      Parameters:
      aSchema - The read schema. Never null.
      Returns:
      The query binding to use. Never null.
      Throws:
      com.helger.schematron.SchematronException - In case the determination fails.
    • createPreprocessor

      @Nonnull @OverrideOnDemand public PSPreprocessor createPreprocessor(@Nonnull IPSQueryBinding aQueryBinding)
      Create the pre-processor to be used for createPreprocessedSchema(PSSchema, IPSQueryBinding).
      Parameters:
      aQueryBinding - The query binding to be determined from the read schema. Never null.
      Returns:
      The pre-processor to be used.
    • createPreprocessedSchema

      @Nonnull @OverrideOnDemand public PSSchema createPreprocessedSchema(@Nonnull PSSchema aSchema, @Nonnull IPSQueryBinding aQueryBinding) throws com.helger.schematron.SchematronException
      Pre-process the read schema, using the determined query binding.
      Parameters:
      aSchema - The read schema. Never null.
      aQueryBinding - The determined query binding. Never null.
      Returns:
      The pre-processed schema and never null.
      Throws:
      com.helger.schematron.SchematronException - In case pre-processing fails
    • createBoundSchema

      @Nonnull public IPSBoundSchema createBoundSchema() throws com.helger.schematron.SchematronException
      The main routine to create a bound schema from the passed resource and phase. The usual routine is to
      1. read the schema from the resource - see readSchema(IReadableResource, IPSErrorHandler, EntityResolver)
      2. resolve the query binding - see getQueryBinding(PSSchema)
      3. pre-process the schema - createPreprocessedSchema(PSSchema, IPSQueryBinding)
      4. and finally bind it - IPSQueryBinding.bind(PSSchema, String, IPSErrorHandler, IPSValidationHandler, IXPathConfig)
      Returns:
      The bound schema. Never null.
      Throws:
      com.helger.schematron.SchematronException - In case reading or binding fails.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object