Class RunExampleTool

  • All Implemented Interfaces:
    Tool

    public class RunExampleTool
    extends ToolBase
    Supports an interactive session with the user to launch (or relaunch the -e cloud example)
    • Field Detail

      • executor

        protected org.apache.commons.exec.Executor executor
      • script

        protected String script
      • serverDir

        protected File serverDir
      • exampleDir

        protected File exampleDir
      • urlScheme

        protected String urlScheme
    • Constructor Detail

      • RunExampleTool

        public RunExampleTool()
        Default constructor used by the framework when running as a command-line application.
      • RunExampleTool

        public RunExampleTool​(org.apache.commons.exec.Executor executor,
                              InputStream userInput,
                              PrintStream stdout)
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Tool
        Defines the interface to a Solr tool that can be run from this command-line app.
      • getOptions

        public List<org.apache.commons.cli.Option> getOptions()
      • runExample

        protected void runExample​(org.apache.commons.cli.CommandLine cli,
                                  String exampleName)
                           throws Exception
        Throws:
        Exception
      • runCloudExample

        protected void runCloudExample​(org.apache.commons.cli.CommandLine cli)
                                throws Exception
        Throws:
        Exception
      • setCollectionConfigProperty

        protected void setCollectionConfigProperty​(String solrUrl,
                                                   String collectionName)
      • waitToSeeLiveNodes

        protected void waitToSeeLiveNodes​(String zkHost,
                                          int numNodes)
        wait until the number of live nodes == numNodes.
      • startSolr

        protected Map<String,​Object> startSolr​(File solrHomeDir,
                                                     boolean cloudMode,
                                                     org.apache.commons.cli.CommandLine cli,
                                                     int port,
                                                     String zkHost,
                                                     int maxWaitSecs)
                                              throws Exception
        Throws:
        Exception
      • readExtraArgs

        protected String readExtraArgs​(String[] extraArgsArr)
      • createCloudExampleCollection

        protected String createCloudExampleCollection​(int numNodes,
                                                      Scanner readInput,
                                                      boolean prompt,
                                                      String solrUrl)
                                               throws Exception
        Throws:
        Exception
      • isValidConfig

        protected boolean isValidConfig​(File configsetsDir,
                                        String config)
      • isPortAvailable

        protected boolean isPortAvailable​(int port)