1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.oscal.tools.cli.core.commands.oscal;
7   
8   import gov.nist.secauto.metaschema.cli.processor.CLIProcessor.CallingContext;
9   import gov.nist.secauto.metaschema.cli.processor.ExitStatus;
10  import gov.nist.secauto.metaschema.cli.processor.command.ICommandExecutor;
11  import gov.nist.secauto.oscal.tools.cli.core.commands.AbstractOscalValidationCommand;
12  
13  import org.apache.commons.cli.CommandLine;
14  import org.apache.logging.log4j.LogManager;
15  import org.apache.logging.log4j.Logger;
16  
17  import edu.umd.cs.findbugs.annotations.NonNull;
18  
19  public abstract class AbstractDeprecatedOscalValidationSubcommand
20      extends AbstractOscalValidationCommand {
21    private static final Logger LOGGER = LogManager.getLogger(AbstractDeprecatedOscalValidationSubcommand.class);
22  
23    @Override
24    public ICommandExecutor newExecutor(CallingContext callingContext, CommandLine commandLine) {
25      return new DeprecatedOscalCommandExecutor(callingContext, commandLine);
26    }
27  
28    protected final class DeprecatedOscalCommandExecutor
29        extends AbstractOscalValidationCommand.OscalCommandExecutor {
30  
31      private DeprecatedOscalCommandExecutor(
32          @NonNull CallingContext callingContext,
33          @NonNull CommandLine commandLine) {
34        super(callingContext, commandLine);
35      }
36  
37      @Override
38      public ExitStatus execute() {
39        LOGGER.atWarn().log("This command path is deprecated. Please use 'validate'.");
40  
41        return super.execute();
42      }
43    }
44  }