From 6a9c381c0708cc45a06af5ee0ac8570518801968 Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Mon, 4 Jan 2016 15:48:12 +0000 Subject: [PATCH] SOLR-8476: COreAdminHandler refactoring git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1722900 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/handler/admin/CoreAdminHandler.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java index d9e5a830b9a..fdb0129ea9f 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java @@ -51,6 +51,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; +import static org.apache.solr.common.params.CoreAdminParams.ACTION; +import static org.apache.solr.common.params.CoreAdminParams.CoreAdminAction.STATUS; + /** * * @since solr 1.3 @@ -140,14 +143,9 @@ public class CoreAdminHandler extends RequestHandlerBase { } // Pick the action - SolrParams params = req.getParams(); - CoreAdminAction action = CoreAdminAction.STATUS; - String a = params.get(CoreAdminParams.ACTION); - if (a == null) return; - - CoreAdminOperation op = opMap.get(a.toLowerCase(Locale.ROOT)); + CoreAdminOperation op = opMap.get(req.getParams().get(ACTION, STATUS.toString()).toLowerCase(Locale.ROOT)); if (op == null) { - this.handleCustomAction(req, rsp); + handleCustomAction(req, rsp); return; } @@ -157,7 +155,7 @@ public class CoreAdminHandler extends RequestHandlerBase { } else { try { MDC.put("CoreAdminHandler.asyncId", taskId); - MDC.put("CoreAdminHandler.action", action.name()); + MDC.put("CoreAdminHandler.action", op.action.toString()); parallelExecutor.execute(new Runnable() { @Override public void run() { @@ -196,7 +194,7 @@ public class CoreAdminHandler extends RequestHandlerBase { */ protected void handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unsupported operation: " + - req.getParams().get(CoreAdminParams.ACTION)); + req.getParams().get(ACTION)); } public static ImmutableMap paramToProp = ImmutableMap.builder()