Package org.apache.solr.cli
Class RunExampleTool
- java.lang.Object
-
- org.apache.solr.cli.ToolBase
-
- org.apache.solr.cli.RunExampleTool
-
-
Field Summary
Fields Modifier and Type Field Description protected FileexampleDirprotected org.apache.commons.exec.Executorexecutorprotected Stringscriptprotected FileserverDirprotected FilesolrHomeDirprotected StringurlSchemeprotected InputStreamuserInput
-
Constructor Summary
Constructors Constructor Description RunExampleTool(org.apache.commons.exec.Executor executor, InputStream userInput, ToolRuntime runtime)RunExampleTool(ToolRuntime runtime)Default constructor used by the framework when running as a command-line application.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>checkPortConflict(String solrUrl, File solrHomeDir, int port)protected voidcopyIfNeeded(File src, File dest)protected StringcreateCloudExampleCollection(int numNodes, Scanner readInput, boolean prompt, String solrUrl)StringgetName()Defines the interface to a Solr tool that can be run from this command-line app.protected Map<String,Object>getNodeStatus(String solrUrl, int maxWaitSecs, org.apache.commons.cli.CommandLine cli)List<org.apache.commons.cli.Option>getOptions()protected booleanisPortAvailable(int port)protected booleanisValidConfig(File configsetsDir, String config)protected Stringprompt(Scanner s, String prompt)protected Stringprompt(Scanner s, String prompt, String defaultValue)protected IntegerpromptForInt(Scanner s, String prompt, String label, Integer defVal, Integer min, Integer max)protected IntegerpromptForPort(Scanner s, int node, String prompt, Integer defVal)protected StringreadExtraArgs(String[] extraArgsArr)protected voidrunCloudExample(org.apache.commons.cli.CommandLine cli)protected voidrunExample(org.apache.commons.cli.CommandLine cli, String exampleName)voidrunImpl(org.apache.commons.cli.CommandLine cli)protected FilesetupSolrHomeDir(File serverDir, File solrHomeParentDir, String dirName)protected Map<String,Object>startSolr(File solrHomeDir, boolean cloudMode, org.apache.commons.cli.CommandLine cli, int port, String zkHost, int maxWaitSecs)protected voidwaitToSeeLiveNodes(String zkHost, int numNodes)wait until the number of live nodes == numNodes.-
Methods inherited from class org.apache.solr.cli.ToolBase
echo, echoIfVerbose, getRuntime, isVerbose, runTool
-
-
-
-
Constructor Detail
-
RunExampleTool
public RunExampleTool(ToolRuntime runtime)
Default constructor used by the framework when running as a command-line application.
-
RunExampleTool
public RunExampleTool(org.apache.commons.exec.Executor executor, InputStream userInput, ToolRuntime runtime)
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:ToolDefines the interface to a Solr tool that can be run from this command-line app.
-
getOptions
public List<org.apache.commons.cli.Option> getOptions()
-
runImpl
public void runImpl(org.apache.commons.cli.CommandLine cli) 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
-
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
-
checkPortConflict
protected Map<String,Object> checkPortConflict(String solrUrl, File solrHomeDir, int port)
-
createCloudExampleCollection
protected String createCloudExampleCollection(int numNodes, Scanner readInput, boolean prompt, String solrUrl) throws Exception
- Throws:
Exception
-
getNodeStatus
protected Map<String,Object> getNodeStatus(String solrUrl, int maxWaitSecs, org.apache.commons.cli.CommandLine cli) throws Exception
- Throws:
Exception
-
setupSolrHomeDir
protected File setupSolrHomeDir(File serverDir, File solrHomeParentDir, String dirName) throws IOException
- Throws:
IOException
-
copyIfNeeded
protected void copyIfNeeded(File src, File dest) throws IOException
- Throws:
IOException
-
isPortAvailable
protected boolean isPortAvailable(int port)
-
promptForInt
protected Integer promptForInt(Scanner s, String prompt, String label, Integer defVal, Integer min, Integer max)
-
-