MCPcopy Create free account
hub / github.com/apache/solr / newTool

Method newTool

solr/core/src/java/org/apache/solr/cli/SolrCLI.java:179–220  ·  view source on GitHub ↗
(String toolType, ToolRuntime runtime)

Source from the content-addressed store, hash-verified

177 }
178
179 // Creates an instance of the requested tool, using classpath scanning if necessary
180 private static Tool newTool(String toolType, ToolRuntime runtime) throws Exception {
181 if ("healthcheck".equals(toolType)) return new HealthcheckTool(runtime);
182 else if ("status".equals(toolType)) return new StatusTool(runtime);
183 else if ("api".equals(toolType)) return new ApiTool(runtime);
184 else if ("create".equals(toolType)) return new CreateTool(runtime);
185 else if ("delete".equals(toolType)) return new DeleteTool(runtime);
186 else if ("config".equals(toolType)) return new ConfigTool(runtime);
187 else if ("run_example".equals(toolType)) return new RunExampleTool(runtime);
188 else if ("upconfig".equals(toolType)) return new ConfigSetUploadTool(runtime);
189 else if ("downconfig".equals(toolType)) return new ConfigSetDownloadTool(runtime);
190 else if ("zk-tool-help".equals(toolType)) return new ZkToolHelp(runtime);
191 else if ("rm".equals(toolType)) return new ZkRmTool(runtime);
192 else if ("mv".equals(toolType)) return new ZkMvTool(runtime);
193 else if ("cp".equals(toolType)) return new ZkCpTool(runtime);
194 else if ("ls".equals(toolType)) return new ZkLsTool(runtime);
195 else if ("cluster".equals(toolType)) return new ClusterTool(runtime);
196 else if ("updateacls".equals(toolType)) return new UpdateACLTool(runtime);
197 else if ("mkroot".equals(toolType)) return new ZkMkrootTool(runtime);
198 else if ("assert".equals(toolType)) return new AssertTool(runtime);
199 else if ("auth".equals(toolType)) return new AuthTool(runtime);
200 else if ("export".equals(toolType)) return new ExportTool(runtime);
201 else if ("package".equals(toolType)) return new PackageTool(runtime);
202 else if ("post".equals(toolType)) return new PostTool(runtime);
203 else if ("postlogs".equals(toolType)) return new PostLogsTool(runtime);
204 else if ("version".equals(toolType)) return new VersionTool(runtime);
205 else if ("stream".equals(toolType)) return new StreamTool(runtime);
206 else if ("snapshot-create".equals(toolType)) return new SnapshotCreateTool(runtime);
207 else if ("snapshot-delete".equals(toolType)) return new SnapshotDeleteTool(runtime);
208 else if ("snapshot-list".equals(toolType)) return new SnapshotListTool(runtime);
209 else if ("snapshot-describe".equals(toolType)) return new SnapshotDescribeTool(runtime);
210 else if ("snapshot-export".equals(toolType)) return new SnapshotExportTool(runtime);
211
212 // If you add a built-in tool to this class, add it here to avoid
213 // classpath scanning
214
215 for (Class<? extends Tool> next : findToolClassesInPackage("org.apache.solr.util")) {
216 Tool tool = next.getConstructor().newInstance();
217 if (toolType.equals(tool.getName())) return tool;
218 }
219
220 throw new IllegalArgumentException(toolType + " is not a valid command!");
221 }
222
223 /**

Callers 1

findToolMethod · 0.95

Calls 4

getNameMethod · 0.95
newInstanceMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected