}
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
// Make sure the cores is enabled
CoreContainer cores = getCoreContainer();
if (cores == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Core container instance missing");
}
boolean doPersist = false;
// Pick the action
SolrParams params = req.getParams();
CoreAdminAction action = CoreAdminAction.STATUS;
String a = params.get(CoreAdminParams.ACTION);
if (a != null) {
action = CoreAdminAction.get(a);
if (action == null) {
doPersist = this.handleCustomAction(req, rsp);
}
}
if (action != null) {
switch (action) {
case CREATE: {
doPersist = this.handleCreateAction(req, rsp);
break;
}
case RENAME: {
doPersist = this.handleRenameAction(req, rsp);
break;
}
case ALIAS: {
doPersist = this.handleAliasAction(req, rsp);
break;
}
case UNLOAD: {
doPersist = this.handleUnloadAction(req, rsp);
break;
}
case STATUS: {
doPersist = this.handleStatusAction(req, rsp);
break;
}
case PERSIST: {
doPersist = this.handlePersistAction(req, rsp);
break;
}
case RELOAD: {
doPersist = this.handleReloadAction(req, rsp);
break;
}
case SWAP: {
doPersist = this.handleSwapAction(req, rsp);
break;
}
case MERGEINDEXES: {
doPersist = this.handleMergeAction(req, rsp);
break;
}
default: {
doPersist = this.handleCustomAction(req, rsp);
break;
}
case LOAD:
break;
}
}
// Should we persist the changes?
if (doPersist) {
cores.persist();
rsp.add("saved", cores.getConfigFile().getAbsolutePath());
}
rsp.setHttpCaching(false);
}