Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
edde3bb
Extract various Tools into the .util.cli package
epugh Mar 20, 2023
1e4ea50
First pass of responding to intellij suggestions.
epugh Mar 20, 2023
d1f2b3f
Simplify logic?
epugh Mar 20, 2023
63955bf
add license and update log pattern
epugh Mar 20, 2023
a31d47a
tweaks to pass precheck
epugh Mar 20, 2023
e414201
Create package-info.java
epugh Mar 20, 2023
37a60ac
tidy
epugh Mar 20, 2023
a77a0fe
Merge remote-tracking branch 'upstream/main' into SOLR-16711
epugh Mar 20, 2023
0494975
tweaks from merge of TimeUnit...
epugh Mar 20, 2023
c44e9a1
use try/with resources pattern
epugh Mar 20, 2023
4b86cc9
Deal with potential for tools in two packages
epugh Mar 20, 2023
6c3a4eb
some missing tools in the list of help options...
epugh Mar 20, 2023
a815206
remove deprecated method...
epugh Mar 20, 2023
71afd55
tidy
epugh Mar 20, 2023
3e07675
Deprecated method
epugh Mar 21, 2023
e6a196f
This method is used by many tools, to genericize the error message
epugh Mar 21, 2023
aef213c
chase down some more try/with resource places
epugh Mar 21, 2023
2db2d43
Updates required after removing deprecated method
epugh Mar 21, 2023
1f1d7ea
Remove unused getCommonToolOptions methods
epugh Mar 21, 2023
401de0d
Rework Option[] to be next to each other and all caps to follow the p…
epugh Mar 21, 2023
5f4bd3b
Reviewing intellij feedback on this class...
epugh Mar 21, 2023
6210b15
Be explicit on TimeUnit
epugh Mar 21, 2023
5426522
Match pattern of other defaults.
epugh Mar 21, 2023
98973f1
Let's use our TimeUnit
epugh Mar 21, 2023
1b7dc8c
tidy
epugh Mar 21, 2023
cbbbd6f
We actually have one test dedicated to one tool, so put it in the sam…
epugh Mar 21, 2023
c39c35f
Update solr/core/src/java/org/apache/solr/util/SolrCLI.java
epugh Mar 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions solr/core/src/java/org/apache/solr/util/ExportTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SolrNamedThreadFactory;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.util.cli.ToolBase;
import org.noggit.CharArr;
import org.noggit.JSONWriter;

public class ExportTool extends SolrCLI.ToolBase {
public class ExportTool extends ToolBase {
@Override
public String getName() {
return "export";
Expand Down Expand Up @@ -176,7 +177,7 @@ public void streamDocListInfo(long numFound, long start, Float maxScore) {}
static Set<String> formats = Set.of(JAVABIN, "jsonl");

@Override
protected void runImpl(CommandLine cli) throws Exception {
public void runImpl(CommandLine cli) throws Exception {
String url = cli.getOptionValue("url");
Info info = new MultiThreadedRunner(url);
info.query = cli.getOptionValue("query", "*:*");
Expand Down
13 changes: 5 additions & 8 deletions solr/core/src/java/org/apache/solr/util/PackageTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.lucene.util.SuppressForbidden;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
Expand All @@ -40,11 +39,12 @@
import org.apache.solr.packagemanager.SolrPackage;
import org.apache.solr.packagemanager.SolrPackage.SolrPackageRelease;
import org.apache.solr.packagemanager.SolrPackageInstance;
import org.apache.solr.util.SolrCLI.StatusTool;
import org.apache.solr.util.cli.StatusTool;
import org.apache.solr.util.cli.ToolBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PackageTool extends SolrCLI.ToolBase {
public class PackageTool extends ToolBase {

private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

Expand All @@ -71,7 +71,7 @@ public String getName() {
"We really need to print the stacktrace here, otherwise "
+ "there shall be little else information to debug problems. Other SolrCLI tools "
+ "don't print stack traces, hence special treatment is needed here.")
protected void runImpl(CommandLine cli) throws Exception {
public void runImpl(CommandLine cli) throws Exception {
try {
solrUrl = cli.getOptionValues("solrUrl")[cli.getOptionValues("solrUrl").length - 1];
solrBaseUrl = solrUrl.replaceAll("\\/solr$", ""); // strip out ending "/solr"
Expand Down Expand Up @@ -364,8 +364,7 @@ private String getZkHost(CommandLine cli) throws Exception {
if (zkHost != null) return zkHost;

String systemInfoUrl = solrUrl + "/admin/info/system";
CloseableHttpClient httpClient = SolrCLI.getHttpClient();
try {
try (CloseableHttpClient httpClient = SolrCLI.getHttpClient()) {
// hit Solr to get system info
Map<String, Object> systemInfo = SolrCLI.getJson(httpClient, systemInfoUrl, 2, true);

Expand All @@ -381,8 +380,6 @@ private String getZkHost(CommandLine cli) throws Exception {
}
zkHost = zookeeper;
}
} finally {
HttpClientUtil.close(httpClient);
}

return zkHost;
Expand Down
Loading