Class SolrCLI

java.lang.Object
org.apache.solr.cli.SolrCLI
All Implemented Interfaces:
CLIO

public class SolrCLI extends Object implements CLIO
Command-line utility for working with Solr.
  • Constructor Details

    • SolrCLI

      public SolrCLI()
  • Method Details

    • main

      public static void main(String[] args) throws Exception
      Runs a tool.
      Throws:
      Exception
    • findTool

      public static Tool findTool(String[] args, ToolRuntime runtime) throws Exception
      Throws:
      Exception
    • parseCmdLine

      public static org.apache.commons.cli.CommandLine parseCmdLine(Tool tool, String[] args)
    • checkSslStoreSysProp

      protected static void checkSslStoreSysProp(String solrInstallDir, String key)
    • getOptionWithDeprecatedAndDefault

      public static String getOptionWithDeprecatedAndDefault(org.apache.commons.cli.CommandLine cli, org.apache.commons.cli.Option opt, org.apache.commons.cli.Option deprecated, String def)
      Returns the value of the option with the given name, or the value of the deprecated option. If both values are null, then it returns the default value.

      If this method is marked as unused by your IDE, it means we have no deprecated CLI options currently, congratulations! This method is preserved for the next time we need to deprecate a CLI option.

    • processCommandLineArgs

      public static org.apache.commons.cli.CommandLine processCommandLineArgs(Tool tool, String[] args)
      Parses the command-line arguments passed by the user.
    • printToolHelp

      public static void printToolHelp(Tool tool)
      Prints tool help for a given tool
    • getFormatter

      public static org.apache.commons.cli.HelpFormatter getFormatter()
    • postJsonToSolr

      public static org.apache.solr.common.util.NamedList<Object> postJsonToSolr(org.apache.solr.client.solrj.SolrClient solrClient, String updatePath, String jsonBody) throws Exception
      Throws:
      Exception
    • uptime

      public static String uptime(long uptimeMs)
    • print

      public static void print(Object message)
    • printGreen

      public static void printGreen(Object message)
      Console print using green color
    • printRed

      public static void printRed(Object message)
      Console print using red color
    • print

      public static void print(String color, Object message)