Class AbstractValidateContentCommand.AbstractValidationCommandExecutor

java.lang.Object
dev.metaschema.cli.processor.command.AbstractCommandExecutor
dev.metaschema.cli.commands.AbstractValidateContentCommand.AbstractValidationCommandExecutor
All Implemented Interfaces:
dev.metaschema.cli.processor.command.ICommandExecutor
Enclosing class:
AbstractValidateContentCommand

protected abstract class AbstractValidateContentCommand.AbstractValidationCommandExecutor extends dev.metaschema.cli.processor.command.AbstractCommandExecutor
Drives the validation execution.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface dev.metaschema.cli.processor.command.ICommandExecutor

    dev.metaschema.cli.processor.command.ICommandExecutor.ExecutionFunction
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractValidationCommandExecutor(dev.metaschema.cli.processor.CallingContext callingContext, org.apache.commons.cli.CommandLine commandLine)
    Construct a new command executor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Execute the validation operation.
    protected abstract dev.metaschema.databind.IBindingContext
    getBindingContext(Set<dev.metaschema.core.model.constraint.IConstraintSet> constraintSets)
    Get the binding context to use for data processing.
    protected abstract dev.metaschema.core.model.IModule
    getModule(org.apache.commons.cli.CommandLine commandLine, dev.metaschema.databind.IBindingContext bindingContext)
    Get the module to use for validation.
    protected abstract dev.metaschema.databind.IBindingContext.ISchemaValidationProvider
    getSchemaValidationProvider(dev.metaschema.core.model.IModule module, org.apache.commons.cli.CommandLine commandLine, dev.metaschema.databind.IBindingContext bindingContext)
    Get the schema validation implementation requested based on the provided command line arguments.

    Methods inherited from class dev.metaschema.cli.processor.command.AbstractCommandExecutor

    getCallingContext, getCommand, getCommandLine

    Methods inherited from class java.lang.Object

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

    • AbstractValidationCommandExecutor

      public AbstractValidationCommandExecutor(@NonNull dev.metaschema.cli.processor.CallingContext callingContext, @NonNull org.apache.commons.cli.CommandLine commandLine)
      Construct a new command executor.
      Parameters:
      callingContext - the context of the command execution
      commandLine - the parsed command line details
  • Method Details

    • getBindingContext

      @NonNull protected abstract dev.metaschema.databind.IBindingContext getBindingContext(@NonNull Set<dev.metaschema.core.model.constraint.IConstraintSet> constraintSets) throws dev.metaschema.cli.processor.command.CommandExecutionException
      Get the binding context to use for data processing.
      Parameters:
      constraintSets - the constraints to configure in the resulting binding context
      Returns:
      the context
      Throws:
      dev.metaschema.cli.processor.command.CommandExecutionException - if a error occurred while getting the binding context
    • getModule

      @NonNull protected abstract dev.metaschema.core.model.IModule getModule(@NonNull org.apache.commons.cli.CommandLine commandLine, @NonNull dev.metaschema.databind.IBindingContext bindingContext) throws dev.metaschema.cli.processor.command.CommandExecutionException
      Get the module to use for validation.

      This module is used to generate schemas and as a source of built-in constraints.

      Parameters:
      commandLine - the provided command line argument information
      bindingContext - the context used to access Metaschema module information based on Java class bindings
      Returns:
      the loaded Metaschema module
      Throws:
      dev.metaschema.cli.processor.command.CommandExecutionException - if an error occurred while loading the module
    • getSchemaValidationProvider

      @NonNull protected abstract dev.metaschema.databind.IBindingContext.ISchemaValidationProvider getSchemaValidationProvider(@NonNull dev.metaschema.core.model.IModule module, @NonNull org.apache.commons.cli.CommandLine commandLine, @NonNull dev.metaschema.databind.IBindingContext bindingContext)
      Get the schema validation implementation requested based on the provided command line arguments.

      It is typical for this call to result in the dynamic generation of a schema to use for validation.

      Parameters:
      module - the Metaschema module to generate the schema from
      commandLine - the provided command line argument information
      bindingContext - the context used to access Metaschema module information based on Java class bindings
      Returns:
      the provider
    • execute

      public void execute() throws dev.metaschema.cli.processor.command.CommandExecutionException
      Execute the validation operation.
      Specified by:
      execute in interface dev.metaschema.cli.processor.command.ICommandExecutor
      Specified by:
      execute in class dev.metaschema.cli.processor.command.AbstractCommandExecutor
      Throws:
      dev.metaschema.cli.processor.command.CommandExecutionException