Module dev.metaschema.cli
Package dev.metaschema.cli.commands
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
ConstructorsModifierConstructorDescriptionprotectedAbstractConversionCommandExecutor(dev.metaschema.cli.processor.CallingContext callingContext, org.apache.commons.cli.CommandLine commandLine) Construct a new command executor. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()protected abstract dev.metaschema.databind.IBindingContextGet the binding context to use for data processing.protected abstract voidhandleConversion(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
-
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 executioncommandLine- 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.MetaschemaExceptionGet 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 contextdev.metaschema.core.model.MetaschemaException- if an error occurred while setting up the binding context, such as pre-loading any needed modules
-
execute
- Specified by:
executein interfacedev.metaschema.cli.processor.command.ICommandExecutor- Specified by:
executein classdev.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 converttoFormat- the format to convert towriter- the writer to use to write converted contentloader- the Metaschema loader to use to load the content to convert- Throws:
FileNotFoundException- if the requested resource was not foundIOException- if there was an error reading or writing content
-