001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.oscal.tools.cli.core.commands; 007 008import org.apache.commons.cli.CommandLine; 009import org.apache.logging.log4j.LogManager; 010import org.apache.logging.log4j.Logger; 011 012import dev.metaschema.cli.processor.CallingContext; 013import dev.metaschema.cli.processor.command.CommandExecutionException; 014import dev.metaschema.cli.processor.command.ICommandExecutor; 015import edu.umd.cs.findbugs.annotations.NonNull; 016 017/** 018 * This abstract command implementation provides user feedback about extending 019 * command being deprecated in favor of the {@link ValidateCommand}. 020 */ 021public abstract class AbstractDeprecatedOscalValidationSubcommand 022 extends AbstractOscalValidationCommand { 023 private static final Logger LOGGER = LogManager.getLogger(AbstractDeprecatedOscalValidationSubcommand.class); 024 025 @Override 026 public ICommandExecutor newExecutor(CallingContext callingContext, CommandLine commandLine) { 027 return new CommandExecutor(callingContext, commandLine); 028 } 029 030 private final class CommandExecutor 031 extends AbstractOscalValidationCommand.OscalValidationCommandExecutor { 032 033 private CommandExecutor( 034 @NonNull CallingContext callingContext, 035 @NonNull CommandLine commandLine) { 036 super(callingContext, commandLine); 037 } 038 039 @Override 040 public void execute() throws CommandExecutionException { 041 LOGGER.atWarn().log("This command path is deprecated. Please use 'validate'."); 042 043 super.execute(); 044 } 045 } 046}