Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8a9bcb3
proper packaging
jaykay12 Jul 25, 2026
620c403
more re-packaging
jaykay12 Jul 25, 2026
0e09eb5
changes
jaykay12 Jul 25, 2026
a15a564
more re-organise
jaykay12 Jul 25, 2026
6fd51eb
pcakge info
jaykay12 Jul 25, 2026
b7b5c85
tidying up
jaykay12 Jul 25, 2026
6890483
wildcard imports removed
jaykay12 Jul 25, 2026
62f8ac7
tidy
jaykay12 Jul 25, 2026
227379b
Added cl
jaykay12 Jul 25, 2026
bf15b88
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Jul 26, 2026
65bbd94
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Aug 30, 2026
9a40eca
minor
jaykay12 Aug 30, 2026
540e041
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Sep 20, 2026
8252648
minor
jaykay12 Sep 20, 2026
1f9df94
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 3, 2026
f0265ac
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 6, 2026
156d8dc
compilation fix
jaykay12 Oct 6, 2026
5874edc
minor refactoring
jaykay12 Oct 6, 2026
a6c980f
more refactoring
jaykay12 Oct 6, 2026
ec08acd
tests refactored
jaykay12 Oct 6, 2026
179e2d1
more refactoring
jaykay12 Oct 6, 2026
50632aa
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 6, 2026
2d14f4c
no longer needed
jaykay12 Oct 6, 2026
479640b
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 7, 2026
430db4b
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 8, 2026
b48de2c
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 8, 2026
5de3b32
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 9, 2026
9103345
picocli refactoring
jaykay12 Oct 9, 2026
85424a9
import setup
jaykay12 Oct 9, 2026
b08717b
imports & tidying
jaykay12 Oct 9, 2026
66ddc77
compile checks
jaykay12 Oct 9, 2026
9470080
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 9, 2026
d76a134
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 11, 2026
99c7afb
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 12, 2026
8c8be0d
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 13, 2026
b262bee
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 14, 2026
db417dd
Merge branch 'main' into SOLR-18234-solr-cli-refactor
jaykay12 Oct 17, 2026
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
8 changes: 8 additions & 0 deletions changelog/unreleased/SOLR-18234-solr-cli-reorganise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Reorganize org.apache.solr.cli into domain-based sub-packages
type: other
authors:
- name: Jalaz Kumar
nick: jaykay12
links:
- name: SOLR-18234
url: https://issues.apache.org/jira/browse/SOLR-18234
3 changes: 2 additions & 1 deletion solr/core/src/java/org/apache/solr/cli/CLIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.exec.OS;
import org.apache.solr.cli.tools.cluster.StatusTool;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
Expand Down Expand Up @@ -254,7 +255,7 @@ public static String normalizeSolrUrl(CommandLine cli) throws Exception {
*
* @param connectionOptions the parsed connection group, or null if none of its options was given
*/
static String resolveSolrUrl(ConnectionOptions connectionOptions, String credentials)
public static String resolveSolrUrl(ConnectionOptions connectionOptions, String credentials)
throws Exception {
String solrUrl = connectionOptions != null ? connectionOptions.solrUrl : null;
if (solrUrl == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
/**
* Picocli mixin for the {@code -c} / {@code --name} option naming the collection a command acts on.
*/
class CollectionNameOptions {
public class CollectionNameOptions {

@CommandLine.Option(
names = {"-c", "--name"},
required = true,
paramLabel = "NAME",
description = "Name of the collection.")
String name;
public String name;
}
17 changes: 9 additions & 8 deletions solr/core/src/java/org/apache/solr/cli/ConnectionOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import java.util.Map;
import org.apache.solr.cli.tools.cluster.StatusTool;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.common.util.EnvUtils;
Expand All @@ -30,34 +31,34 @@
* ensure the user provides at most one of {@code --solr-connection}, {@code --solr-url} or {@code
* --zk-host}.
*/
class ConnectionOptions {
public class ConnectionOptions {
@CommandLine.Option(
names = {"-s", "--solr-connection"},
description =
"Zookeeper or HTTP(s) connection string; unnecessary if SOLR_CONNECTION is defined in solr.in.sh; otherwise, defaults to "
+ CommonCLIOptions.DefaultValues.ZK_HOST
+ ".")
String solrConnection;
public String solrConnection;

@CommandLine.Option(
names = {"--solr-url"},
description =
"Base Solr URL, which can be used to determine the zk-host if that's not known.")
String solrUrl;
public String solrUrl;

@CommandLine.Option(
names = {"-z", "--zk-host"},
description =
"Zookeeper connection string; unnecessary if ZK_HOST is defined in solr.in.sh; otherwise, defaults to "
+ CommonCLIOptions.DefaultValues.ZK_HOST
+ ".")
String zkHost;
public String zkHost;

/**
* The effective ZooKeeper connection string, taking {@code --solr-connection} into account, or
* null if the user targeted Solr via a URL (or gave no target at all).
*/
String effectiveZkHost() throws IOException {
public String effectiveZkHost() throws IOException {
if (solrConnection != null) {
var connection = CloudSolrClient.CloudSolrClientConnection.parse(solrConnection);
return connection.isZookeeper() ? solrConnection : null;
Expand All @@ -69,15 +70,15 @@ String effectiveZkHost() throws IOException {
* The effective Solr URL, taking {@code --solr-connection} into account, or null if the user
* targeted ZooKeeper (or gave no target at all).
*/
String effectiveSolrUrl() throws IOException {
public String effectiveSolrUrl() throws IOException {
if (solrConnection != null) {
var connection = CloudSolrClient.CloudSolrClientConnection.parse(solrConnection);
return connection.isZookeeper() ? null : connection.quorumItems().get(0);
}
return solrUrl;
}

static String resolveSolrUrl(ConnectionOptions connectionOptions, String credentials)
public static String resolveSolrUrl(ConnectionOptions connectionOptions, String credentials)
throws Exception {
if (connectionOptions != null) {
String solrUrl = connectionOptions.effectiveSolrUrl();
Expand Down Expand Up @@ -114,7 +115,7 @@ static String resolveSolrUrl(ConnectionOptions connectionOptions, String credent
return defaultUrl;
}

static String resolveZkHost(
public static String resolveZkHost(
ConnectionOptions connectionOptions, String solrUrl, String credentials) throws Exception {
boolean resolveFromSolrUrl = false;
if (connectionOptions != null) {
Expand Down
37 changes: 37 additions & 0 deletions solr/core/src/java/org/apache/solr/cli/SolrCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,43 @@
import org.apache.commons.cli.help.HelpFormatter;
import org.apache.commons.cli.help.TableDefinition;
import org.apache.commons.cli.help.TextHelpAppendable;
import org.apache.solr.cli.tools.ApiTool;
import org.apache.solr.cli.tools.AssertTool;
import org.apache.solr.cli.tools.AuthTool;
import org.apache.solr.cli.tools.ConfigTool;
import org.apache.solr.cli.tools.CreateTool;
import org.apache.solr.cli.tools.DeleteTool;
import org.apache.solr.cli.tools.ExportTool;
import org.apache.solr.cli.tools.PostLogsTool;
import org.apache.solr.cli.tools.PostTool;
import org.apache.solr.cli.tools.RunExampleTool;
import org.apache.solr.cli.tools.StreamTool;
import org.apache.solr.cli.tools.VersionTool;
import org.apache.solr.cli.tools.cluster.ClusterTool;
import org.apache.solr.cli.tools.cluster.HealthcheckTool;
import org.apache.solr.cli.tools.cluster.StatusTool;
import org.apache.solr.cli.tools.pkg.PackageTool;
import org.apache.solr.cli.tools.snapshot.SnapshotCreateShim;
import org.apache.solr.cli.tools.snapshot.SnapshotCreateTool;
import org.apache.solr.cli.tools.snapshot.SnapshotDeleteShim;
import org.apache.solr.cli.tools.snapshot.SnapshotDeleteTool;
import org.apache.solr.cli.tools.snapshot.SnapshotDescribeShim;
import org.apache.solr.cli.tools.snapshot.SnapshotDescribeTool;
import org.apache.solr.cli.tools.snapshot.SnapshotExportShim;
import org.apache.solr.cli.tools.snapshot.SnapshotExportTool;
import org.apache.solr.cli.tools.snapshot.SnapshotListShim;
import org.apache.solr.cli.tools.snapshot.SnapshotListTool;
import org.apache.solr.cli.tools.snapshot.SnapshotTool;
import org.apache.solr.cli.tools.zk.ConfigSetDownloadTool;
import org.apache.solr.cli.tools.zk.ConfigSetUploadTool;
import org.apache.solr.cli.tools.zk.UpdateACLTool;
import org.apache.solr.cli.tools.zk.ZkCpTool;
import org.apache.solr.cli.tools.zk.ZkLsTool;
import org.apache.solr.cli.tools.zk.ZkMkrootTool;
import org.apache.solr.cli.tools.zk.ZkMvTool;
import org.apache.solr.cli.tools.zk.ZkRmTool;
import org.apache.solr.cli.tools.zk.ZkTool;
import org.apache.solr.cli.tools.zk.ZkToolHelp;
import org.apache.solr.client.api.util.SolrVersion;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.request.ContentWriterUpdateRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.cli;
package org.apache.solr.cli.process;

import static org.apache.solr.servlet.CoreContainerProvider.SOLR_INSTALL_DIR;

Expand Down
19 changes: 19 additions & 0 deletions solr/core/src/java/org/apache/solr/cli/process/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** Utilities for discovering and managing Solr OS processes. */
package org.apache.solr.cli.process;
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@
* limitations under the License.
*/

package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.net.URI;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
import org.apache.solr.client.solrj.response.InputStreamResponseParser;
Expand Down Expand Up @@ -107,7 +113,7 @@ void callApi(ApiParams params) throws Exception {
echo(response);
}

protected String callGet(String url, String credentials) throws Exception {
public String callGet(String url, String credentials) throws Exception {
URI uri = new URI(url.replace("+", "%20"));
String solrUrl = getSolrUrlFromUri(uri);
String path = uri.getPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
Expand All @@ -28,6 +28,14 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.cli.tools.cluster.StatusTool;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.request.HealthCheckRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -38,6 +38,13 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.lucene.util.Constants;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.cli.tools.zk.ZkConnectionOptions;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.util.EnvUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.util.HashMap;
import java.util.List;
Expand All @@ -24,6 +24,15 @@
import org.apache.commons.cli.MissingArgumentException;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ConnectionOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.SolrCLI;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.common.util.EnvUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -28,7 +28,16 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.io.file.PathUtils;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.CommonCLIOptions.DefaultValues;
import org.apache.solr.cli.ConnectionOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.cli.tools.cluster.StatusTool;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.util.Locale;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DeprecatedAttributes;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ConnectionOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.RemoteSolrException;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import static org.apache.solr.common.params.CommonParams.FL;
import static org.apache.solr.common.params.CommonParams.JAVABIN;
Expand Down Expand Up @@ -54,6 +54,13 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.lucene.util.SuppressForbidden;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ConnectionOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.solr.cli;
package org.apache.solr.cli.tools;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -36,6 +36,14 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ConnectionOptions;
import org.apache.solr.cli.CredentialsOptions;
import org.apache.solr.cli.DefaultToolRuntime;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
Expand Down
Loading
Loading