Class KeyStoreAwareCommand

java.lang.Object
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable
Direct Known Subclasses:
BaseKeyStoreCommand, HasPasswordKeyStoreCommand

public abstract class KeyStoreAwareCommand
extends EnvironmentAwareCommand
An EnvironmentAwareCommand that needs to access the elasticsearch keystore, possibly decrypting it if it is password protected.
  • Field Details

  • Constructor Details

  • Method Details

    • readPassword

      protected static SecureString readPassword​(Terminal terminal, boolean withVerification) throws UserException
      Reads the keystore password from the Terminal, prompting for verification where applicable and returns it as a SecureString.
      Parameters:
      terminal - the terminal to use for user inputs
      withVerification - whether the user should be prompted for password verification
      Returns:
      a SecureString with the password the user entered
      Throws:
      UserException - If the user is prompted for verification and enters a different password
    • decryptKeyStore

      protected static void decryptKeyStore​(KeyStoreWrapper keyStore, Terminal terminal) throws UserException, java.security.GeneralSecurityException, java.io.IOException
      Decrypt the keyStore, prompting the user to enter the password in the Terminal if it is password protected
      Throws:
      UserException
      java.security.GeneralSecurityException
      java.io.IOException
    • execute

      protected abstract void execute​(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.Exception
      Description copied from class: EnvironmentAwareCommand
      Execute the command with the initialized Environment.
      Specified by:
      execute in class EnvironmentAwareCommand
      Throws:
      java.lang.Exception