Class EnvironmentAwareCommand

    • Constructor Summary

      Constructors 
      Constructor Description
      EnvironmentAwareCommand​(java.lang.String description)
      Construct the command with the specified command description.
      EnvironmentAwareCommand​(java.lang.String description, java.lang.Runnable beforeMain)
      Construct the command with the specified command description and runnable to execute before main is invoked.
    • Method Summary

      Modifier and Type Method Description
      protected Environment createEnv​(java.util.Map<java.lang.String,​java.lang.String> settings)
      Create an Environment for the command to use.
      protected Environment createEnv​(Settings baseSettings, java.util.Map<java.lang.String,​java.lang.String> settings)
      Create an Environment for the command to use.
      protected void execute​(Terminal terminal, joptsimple.OptionSet options)  
      protected abstract void execute​(Terminal terminal, joptsimple.OptionSet options, Environment env)
      Execute the command with the initialized Environment.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnvironmentAwareCommand

        public EnvironmentAwareCommand​(java.lang.String description)
        Construct the command with the specified command description. This command will have logging configured without reading Elasticsearch configuration files.
        Parameters:
        description - the command description
      • EnvironmentAwareCommand

        public EnvironmentAwareCommand​(java.lang.String description,
                                       java.lang.Runnable beforeMain)
        Construct the command with the specified command description and runnable to execute before main is invoked. Commands constructed with this constructor must take ownership of configuring logging.
        Parameters:
        description - the command description
        beforeMain - the before-main runnable
    • Method Detail

      • execute

        protected void execute​(Terminal terminal,
                               joptsimple.OptionSet options)
                        throws java.lang.Exception
        Specified by:
        execute in class Command
        Throws:
        java.lang.Exception
      • execute

        protected abstract void execute​(Terminal terminal,
                                        joptsimple.OptionSet options,
                                        Environment env)
                                 throws java.lang.Exception
        Execute the command with the initialized Environment.
        Throws:
        java.lang.Exception