org.apache.solr.util

## Class SolrCLI.RunExampleTool

- java.lang.Object
- - org.apache.solr.util.SolrCLI.ToolBase
  - - org.apache.solr.util.SolrCLI.RunExampleTool

- All Implemented Interfaces:
    SolrCLI.Tool
  Enclosing class:
    SolrCLI

      public static class SolrCLI.RunExampleTool
      extends SolrCLI.ToolBase

  Supports an interactive session with the user to launch (or relaunch the -e cloud example)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected File` | `exampleDir`
    `protected org.apache.commons.exec.Executor` | `executor`
    `protected String` | `script`
    `protected File` | `serverDir`
    `protected String` | `urlScheme`
    `protected InputStream` | `userInput`

    - ### Fields inherited from class org.apache.solr.util.SolrCLI.ToolBase

      `stdout, verbose`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RunExampleTool()` Default constructor used by the framework when running as a command-line application.
    `RunExampleTool(org.apache.commons.exec.Executor executor, InputStream userInput, PrintStream stdout)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Map<String,Object>` | `checkPortConflict(String solrUrl, File solrHomeDir, int port, org.apache.commons.cli.CommandLine cli)`
    `protected void` | `copyIfNeeded(File src, File dest)`
    `protected String` | `createCloudExampleCollection(int numNodes, Scanner readInput, boolean prompt, String solrUrl)`
    `String` | `getName()`
    `protected Map<String,Object>` | `getNodeStatus(String solrUrl, int maxWaitSecs)`
    `org.apache.commons.cli.Option[]` | `getOptions()`
    `protected boolean` | `isPortAvailable(int port)`
    `protected boolean` | `isValidConfig(File configsetsDir, String config)`
    `protected String` | `prompt(Scanner s, String prompt)`
    `protected String` | `prompt(Scanner s, String prompt, String defaultValue)`
    `protected Integer` | `promptForInt(Scanner s, String prompt, String label, Integer defVal, Integer min, Integer max)`
    `protected Integer` | `promptForPort(Scanner s, int node, String prompt, Integer defVal)`
    `protected String` | `readExtraArgs(String[] extraArgsArr)`
    `protected void` | `runCloudExample(org.apache.commons.cli.CommandLine cli)`
    `protected void` | `runDihExample(org.apache.commons.cli.CommandLine cli)`
    `protected void` | `runExample(org.apache.commons.cli.CommandLine cli, String exampleName)`
    `protected void` | `runImpl(org.apache.commons.cli.CommandLine cli)`
    `protected void` | `setCollectionConfigProperty(String solrUrl, String collectionName, String propName, String propValue)`
    `protected File` | `setupExampleDir(File serverDir, File exampleParentDir, String dirName)`
    `protected Map<String,Object>` | `startSolr(File solrHomeDir, boolean cloudMode, org.apache.commons.cli.CommandLine cli, int port, String zkHost, int maxWaitSecs)`
    `protected void` | `waitToSeeLiveNodes(int maxWaitSecs, String zkHost, int numNodes)`

    - ### Methods inherited from class org.apache.solr.util.SolrCLI.ToolBase

      `echo, runTool`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### userInput

          protected InputStream userInput

    - #### 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()

    - #### getOptions

          public org.apache.commons.cli.Option[] getOptions()

    - #### runImpl

          protected void runImpl(org.apache.commons.cli.CommandLine cli)
                          throws Exception

      Specified by:
        `runImpl` in class `SolrCLI.ToolBase`
      Throws:
        `Exception`

    - #### runDihExample

          protected void runDihExample(org.apache.commons.cli.CommandLine cli)
                                throws Exception

      Throws:
        `Exception`

    - #### 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,
                                                     String propName,
                                                     String propValue)

    - #### waitToSeeLiveNodes

          protected void waitToSeeLiveNodes(int maxWaitSecs,
                                            String zkHost,
                                            int 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`

    - #### checkPortConflict

          protected Map<String,Object> checkPortConflict(String solrUrl,
                                                         File solrHomeDir,
                                                         int port,
                                                         org.apache.commons.cli.CommandLine cli)

    - #### 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)

    - #### getNodeStatus

          protected Map<String,Object> getNodeStatus(String solrUrl,
                                                     int maxWaitSecs)
                                              throws Exception

      Throws:
        `Exception`

    - #### setupExampleDir

          protected File setupExampleDir(File serverDir,
                                         File exampleParentDir,
                                         String dirName)
                                  throws IOException

      Throws:
        `IOException`

    - #### copyIfNeeded

          protected void copyIfNeeded(File src,
                                      File dest)
                               throws IOException

      Throws:
        `IOException`

    - #### isPortAvailable

          protected boolean isPortAvailable(int port)

    - #### promptForPort

          protected Integer promptForPort(Scanner s,
                                          int node,
                                          String prompt,
                                          Integer defVal)

    - #### promptForInt

          protected Integer promptForInt(Scanner s,
                                         String prompt,
                                         String label,
                                         Integer defVal,
                                         Integer min,
                                         Integer max)

    - #### prompt

          protected String prompt(Scanner s,
                                  String prompt)

    - #### prompt

          protected String prompt(Scanner s,
                                  String prompt,
                                  String defaultValue)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.