Class AbstractTerminalCommand
java.lang.Object
gov.nist.secauto.metaschema.cli.processor.command.AbstractTerminalCommand
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static Path
A utility method that can be used to get the current working directory.protected static URI
resolveAgainstCWD
(String uri) A utility method that can be used to resolve a URI (as a string) against the URI for the current working directory.protected static URI
resolveAgainstCWD
(URI uri) A utility method that can be used to resolve a URI against the URI for the current working directory.protected static Path
resolveAgainstCWD
(Path path) A utility method that can be used to resolve a path against the current working directory.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface gov.nist.secauto.metaschema.cli.processor.command.ICommand
gatherOptions, getDescription, getExtraArguments, getName, getSubCommandByName, getSubCommands, isSubCommandRequired, newExecutor, validateExtraArguments, validateOptions
-
Constructor Details
-
AbstractTerminalCommand
public AbstractTerminalCommand()
-
-
Method Details
-
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
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
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
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
-