Class AbstractTerminalCommand

java.lang.Object
gov.nist.secauto.metaschema.cli.processor.command.AbstractTerminalCommand
All Implemented Interfaces:
ICommand

public abstract class AbstractTerminalCommand extends Object implements ICommand
A base class for terminal commands in the command processing hierarchy. Terminal commands represent leaf nodes that perform actual operations and cannot have child commands.
  • Constructor Details

  • Method Details

    • getCurrentWorkingDirectory

      @NonNull protected static Path getCurrentWorkingDirectory()
      A utility method that can be used to get the current working directory.

      This method is thread-safe due to lazy initialization.

      Returns:
      the current working directory
    • resolveAgainstCWD

      @NonNull protected static Path resolveAgainstCWD(@NonNull Path path)
      A utility method that can be used to resolve a path against the current working directory.

      If the path is already absolute, then the provided path is returned.

      Parameters:
      path - the path to resolve
      Returns:
      the resolved path
    • resolveAgainstCWD

      @NonNull protected static URI resolveAgainstCWD(@NonNull URI uri)
      A utility method that can be used to resolve a URI against the URI for the current working directory.

      If the URI is already absolute, then the provided URI is returned.

      The path is normalized after resolution to remove any redundant name elements (like "." or "..").

      Parameters:
      uri - the uri to resolve
      Returns:
      the resolved URI
    • resolveAgainstCWD

      @NonNull protected static URI resolveAgainstCWD(@NonNull String uri) throws URISyntaxException
      A utility method that can be used to resolve a URI (as a string) against the URI for the current working directory.
      Parameters:
      uri - the uri to resolve
      Returns:
      the resolved URI
      Throws:
      URISyntaxException - if the provided URI is not a valid URI