public class SolrCLI extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SolrCLI.ApiTool
Used to send an arbitrary HTTP request to a Solr API endpoint.
|
static class |
SolrCLI.HealthcheckTool
Requests health information about a specific collection in SolrCloud.
|
static class |
SolrCLI.SolrCloudTool
Helps build SolrCloud aware tools by initializing a CloudSolrServer
instance before running the tool.
|
static class |
SolrCLI.StatusTool
Get the status of a Solr server.
|
static interface |
SolrCLI.Tool
Defines the interface to a Solr tool that can be run from this command-line app.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.cli.Option[] |
cloudOptions |
static String |
DEFAULT_SOLR_URL |
static org.apache.log4j.Logger |
log |
static String |
ZK_HOST |
Constructor and Description |
---|
SolrCLI() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
asList(String jsonPath,
Map<String,Object> json)
Helper function for reading a List of Strings from a JSON Object tree.
|
static Long |
asLong(String jsonPath,
Map<String,Object> json)
Helper function for reading a Long value from a JSON Object tree.
|
static Map<String,Object> |
asMap(String jsonPath,
Map<String,Object> json)
Helper function for reading a Map from a JSON Object tree.
|
static String |
asString(String jsonPath,
Map<String,Object> json)
Helper function for reading a String value from a JSON Object tree.
|
static Object |
atPath(String jsonPath,
Map<String,Object> json)
Helper function for reading an Object of unknown type from a JSON Object tree.
|
static boolean |
checkCommunicationError(Exception exc)
Determine if a request to Solr failed due to a communication error,
which is generally retry-able.
|
static void |
closeHttpClient(org.apache.http.client.HttpClient httpClient) |
static org.apache.commons.cli.Option[] |
getCommonToolOptions()
Support options common to all tools.
|
static org.apache.http.client.HttpClient |
getHttpClient() |
static Map<String,Object> |
getJson(org.apache.http.client.HttpClient httpClient,
String getUrl)
Utility function for sending HTTP GET request to Solr and then doing some
validation of the response.
|
static Map<String,Object> |
getJson(org.apache.http.client.HttpClient httpClient,
String getUrl,
int attempts)
Utility function for sending HTTP GET request to Solr with built-in retry support.
|
static Map<String,Object> |
getJson(String getUrl)
Useful when a tool just needs to send one request to Solr.
|
static org.apache.commons.cli.Option[] |
joinCommonAndToolOptions(org.apache.commons.cli.Option[] toolOpts) |
static org.apache.commons.cli.Option[] |
joinOptions(org.apache.commons.cli.Option[] lhs,
org.apache.commons.cli.Option[] rhs) |
static void |
main(String[] args)
Runs a tool.
|
static org.apache.commons.cli.CommandLine |
processCommandLineArgs(org.apache.commons.cli.Option[] customOptions,
String[] args)
Parses the command-line arguments passed by the user.
|
public static org.apache.log4j.Logger log
public static final String DEFAULT_SOLR_URL
public static final String ZK_HOST
public static org.apache.commons.cli.Option[] cloudOptions
public static org.apache.commons.cli.Option[] getCommonToolOptions()
public static org.apache.commons.cli.Option[] joinCommonAndToolOptions(org.apache.commons.cli.Option[] toolOpts)
public static org.apache.commons.cli.Option[] joinOptions(org.apache.commons.cli.Option[] lhs, org.apache.commons.cli.Option[] rhs)
public static org.apache.commons.cli.CommandLine processCommandLineArgs(org.apache.commons.cli.Option[] customOptions, String[] args)
public static boolean checkCommunicationError(Exception exc)
public static org.apache.http.client.HttpClient getHttpClient()
public static void closeHttpClient(org.apache.http.client.HttpClient httpClient)
public static Map<String,Object> getJson(String getUrl) throws Exception
Exception
public static Map<String,Object> getJson(org.apache.http.client.HttpClient httpClient, String getUrl, int attempts) throws Exception
Exception
public static Map<String,Object> getJson(org.apache.http.client.HttpClient httpClient, String getUrl) throws Exception
Exception
public static String asString(String jsonPath, Map<String,Object> json)
public static Long asLong(String jsonPath, Map<String,Object> json)
public static List<String> asList(String jsonPath, Map<String,Object> json)
public static Map<String,Object> asMap(String jsonPath, Map<String,Object> json)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.