Package org.apache.solr.cli
Class RunExampleTool
java.lang.Object
org.apache.solr.cli.ToolBase
org.apache.solr.cli.RunExampleTool
- All Implemented Interfaces:
Tool
Supports start command in the bin/solr script.
Enhances start command by providing an interactive session with the user to launch (or relaunch the -e cloud example)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRunExampleTool(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
Modifier and TypeMethodDescriptioncheckPortConflict(String solrUrl, String credentials, Path solrHomeDir, int port) protected voidcopyIfNeeded(Path src, Path dest) protected StringcreateCloudExampleCollection(int numNodes, Scanner readInput, boolean prompt, String solrUrl, String credentials) getName()Defines the interface to a Solr tool that can be run from this command-line app.getNodeStatus(String solrUrl, String credentials, int maxWaitSecs) org.apache.commons.cli.OptionsRetrieve theOptionssupported by this tool.protected booleanisPortAvailable(int port) protected booleanisValidConfig(Path configsetsDir, String config) protected Stringprotected Stringprotected Integerprotected 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 PathsetupSolrHomeDir(Path serverDir, Path solrHomeParentDir, String dirName) startSolr(Path 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, getConnectionOptions, getRuntime, isVerbose, runTool
-
Field Details
-
userInput
-
executor
protected org.apache.commons.exec.Executor executor -
script
-
serverDir
-
exampleDir
-
solrHomeDir
-
urlScheme
-
-
Constructor Details
-
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, ToolRuntime runtime)
-
-
Method Details
-
getName
Description copied from interface:ToolDefines the interface to a Solr tool that can be run from this command-line app. -
getOptions
public org.apache.commons.cli.Options getOptions()Description copied from interface:ToolRetrieve theOptionssupported by this tool.- Specified by:
getOptionsin interfaceTool- Overrides:
getOptionsin classToolBase- Returns:
- The
Optionsthis tool supports.
-
runImpl
-
runExample
protected void runExample(org.apache.commons.cli.CommandLine cli, String exampleName) throws Exception - Throws:
Exception
-
runCloudExample
- Throws:
Exception
-
waitToSeeLiveNodes
wait until the number of live nodes == numNodes. -
startSolr
protected Map<String,Object> startSolr(Path solrHomeDir, boolean cloudMode, org.apache.commons.cli.CommandLine cli, int port, String zkHost, int maxWaitSecs) throws Exception - Throws:
Exception
-
checkPortConflict
-
readExtraArgs
-
createCloudExampleCollection
protected String createCloudExampleCollection(int numNodes, Scanner readInput, boolean prompt, String solrUrl, String credentials) throws Exception - Throws:
Exception
-
isValidConfig
-
getNodeStatus
protected Map<String,Object> getNodeStatus(String solrUrl, String credentials, int maxWaitSecs) throws Exception - Throws:
Exception
-
setupSolrHomeDir
protected Path setupSolrHomeDir(Path serverDir, Path solrHomeParentDir, String dirName) throws IOException - Throws:
IOException
-
copyIfNeeded
- Throws:
IOException
-
isPortAvailable
protected boolean isPortAvailable(int port) -
promptForPort
-
promptForInt
-
prompt
-
prompt
-