Class AbstractConvertSubcommand.AbstractConversionCommandExecutor

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

protected abstract static class AbstractConvertSubcommand.AbstractConversionCommandExecutor extends dev.metaschema.cli.processor.command.AbstractCommandExecutor
Used by implementing classes to provide for execution of a conversion command.
  • 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
    Modifier
    Constructor
    Description
    protected
    AbstractConversionCommandExecutor(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
     
    protected abstract dev.metaschema.databind.IBindingContext
    Get the binding context to use for data processing.
    protected abstract void
    handleConversion(URI source, dev.metaschema.databind.io.Format toFormat, Writer writer, dev.metaschema.databind.io.IBoundLoader loader)
    Called to perform a content conversion.

    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

    • AbstractConversionCommandExecutor

      protected AbstractConversionCommandExecutor(@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() throws dev.metaschema.cli.processor.command.CommandExecutionException, dev.metaschema.core.model.MetaschemaException
      Get the binding context to use for data processing.
      Returns:
      the context
      Throws:
      dev.metaschema.cli.processor.command.CommandExecutionException - if an error occurred getting the binding context
      dev.metaschema.core.model.MetaschemaException - if an error occurred while setting up the binding context, such as pre-loading any needed modules
    • execute

      public void execute() throws dev.metaschema.cli.processor.command.CommandExecutionException
      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
    • handleConversion

      protected abstract void handleConversion(@NonNull URI source, @NonNull dev.metaschema.databind.io.Format toFormat, @NonNull Writer writer, @NonNull dev.metaschema.databind.io.IBoundLoader loader) throws FileNotFoundException, IOException
      Called to perform a content conversion.
      Parameters:
      source - the resource to convert
      toFormat - the format to convert to
      writer - the writer to use to write converted content
      loader - the Metaschema loader to use to load the content to convert
      Throws:
      FileNotFoundException - if the requested resource was not found
      IOException - if there was an error reading or writing content