Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions changelog/unreleased/SOLR-18234-solr-cli-reorganise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Reorganize org.apache.solr.cli into domain-based sub-packages
type: other
authors:
- name: Jalaz Kumar
links:
- name: SOLR-18234
url: https://issues.apache.org/jira/browse/SOLR-18234
1 change: 1 addition & 0 deletions 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
47 changes: 30 additions & 17 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,36 @@
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.PackageTool;
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.snapshot.SnapshotCreateTool;
import org.apache.solr.cli.tools.snapshot.SnapshotDeleteTool;
import org.apache.solr.cli.tools.snapshot.SnapshotDescribeTool;
import org.apache.solr.cli.tools.snapshot.SnapshotExportTool;
import org.apache.solr.cli.tools.snapshot.SnapshotListTool;
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.ZkToolHelp;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
import org.apache.solr.common.util.ContentStreamBase;
Expand Down Expand Up @@ -220,23 +250,6 @@ private static Tool newTool(String toolType, ToolRuntime runtime) throws Excepti
throw new IllegalArgumentException(toolType + " is not a valid command!");
}

/**
* Returns the value of the option with the given name, or the value of the deprecated option. If
* both values are null, then it returns the default value.
*
* <p>If this method is marked as unused by your IDE, it means we have no deprecated CLI options
* currently, congratulations! This method is preserved for the next time we need to deprecate a
* CLI option.
*/
public static String getOptionWithDeprecatedAndDefault(
CommandLine cli, Option opt, Option deprecated, String def) {
String val = cli.getOptionValue(opt);
if (val == null) {
val = cli.getOptionValue(deprecated);
}
return val == null ? def : val;
}

Comment on lines -223 to -239

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused method. thus removed it.

// TODO: SOLR-17429 - remove the custom logic when Commons CLI is upgraded and
// makes stderr the default, or makes Option.toDeprecatedString() public.
private static void deprecatedHandlerStdErr(Option o) {
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,16 @@
* 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.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.json.JsonMapResponseParser;
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 @@ -27,6 +27,12 @@
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.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 @@ -37,6 +37,11 @@
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.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.util.EnvUtils;
import org.apache.solr.core.SolrCore;
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,11 @@
import org.apache.commons.cli.MissingArgumentException;
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.SolrCLI;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.common.util.NamedList;
import org.noggit.CharArr;
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 @@ -27,7 +27,11 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.io.file.PathUtils;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.CommonCLIOptions.DefaultValues;
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.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
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.lang.invoke.MethodHandles;
import java.util.Collection;
Expand All @@ -25,6 +25,10 @@
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.ToolBase;
import org.apache.solr.cli.ToolRuntime;
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 @@ -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,10 @@
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.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 @@ -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 static org.apache.solr.cli.SolrCLI.printGreen;
import static org.apache.solr.cli.SolrCLI.printRed;
Expand All @@ -32,6 +32,10 @@
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.lucene.util.SuppressForbidden;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
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,11 @@
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.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.jetty.HttpJettySolrClient;
import org.apache.solr.client.solrj.request.UpdateRequest;
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 static java.nio.charset.StandardCharsets.US_ASCII;
import static java.nio.charset.StandardCharsets.UTF_8;
Expand Down Expand Up @@ -71,6 +71,11 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.solr.cli.CLIO;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.api.util.SolrVersion;
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 java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -45,6 +45,13 @@
import org.apache.commons.exec.Executor;
import org.apache.commons.exec.environment.EnvironmentUtils;
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.SolrCLI;
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.impl.CloudSolrClient;
import org.apache.solr.common.SolrException;
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.BufferedReader;
import java.io.FileInputStream;
Expand All @@ -38,6 +38,11 @@
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.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.comp.StreamComparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
* limitations under the License.
*/

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

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.solr.cli.CLIUtils;
import org.apache.solr.cli.CommonCLIOptions;
import org.apache.solr.cli.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.api.util.SolrVersion;
import org.apache.solr.client.solrj.request.SystemInfoRequest;
import org.apache.solr.client.solrj.response.SystemInfoResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
* limitations under the License.
*/

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

import java.io.IOException;
import java.util.concurrent.TimeUnit;
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.ToolBase;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.solrj.impl.SolrZkClientTimeout;
import org.apache.solr.cloud.ZkController;
import org.apache.solr.common.cloud.ClusterProperties;
Expand Down
Loading