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