SOLR-14654: remove all references of runtime lib

This commit is contained in:
Noble Paul 2020-10-14 11:13:38 +11:00
parent 03fe8e5260
commit 2f651b156c
5 changed files with 15 additions and 58 deletions

View File

@ -598,26 +598,23 @@ public class SolrConfigHandler extends RequestHandlerBase implements SolrCoreAwa
@SuppressWarnings({"unchecked"})
private boolean verifyClass(CommandOperation op, String clz, @SuppressWarnings({"rawtypes"})Class expected) {
if (clz == null) return true;
if (!"true".equals(String.valueOf(op.getStr("runtimeLib", null)))) {
PluginInfo info = new PluginInfo(SolrRequestHandler.TYPE, op.getDataMap());
//this is not dynamically loaded so we can verify the class right away
try {
if(expected == Expressible.class) {
@SuppressWarnings("resource")
SolrResourceLoader resourceLoader = info.pkgName == null ?
req.getCore().getResourceLoader() :
req.getCore().getResourceLoader(info.pkgName);
resourceLoader.findClass(info.className, expected);
} else {
req.getCore().createInitInstance(info, expected, clz, "");
}
} catch (Exception e) {
log.error("Error checking plugin : ", e);
op.addError(e.getMessage());
return false;
PluginInfo info = new PluginInfo(SolrRequestHandler.TYPE, op.getDataMap());
try {
if (expected == Expressible.class) {
@SuppressWarnings("resource")
SolrResourceLoader resourceLoader = info.pkgName == null ?
req.getCore().getResourceLoader() :
req.getCore().getResourceLoader(info.pkgName);
resourceLoader.findClass(info.className, expected);
} else {
req.getCore().createInitInstance(info, expected, clz, "");
}
} catch (Exception e) {
log.error("Error checking plugin : ", e);
op.addError(e.getMessage());
return false;
}
return true;
}

View File

@ -19,11 +19,8 @@ package org.apache.solr.core;
import java.util.Arrays;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.handler.TestBlobHandler;
import org.apache.solr.util.RestTestHarness;
import org.junit.BeforeClass;
import org.junit.Test;
/**
@ -31,25 +28,9 @@ import org.junit.Test;
*/
public class TestCustomStream extends AbstractFullDistribZkTestBase {
@BeforeClass
public static void enableRuntimeLib() throws Exception {
System.setProperty("enable.runtime.lib", "true");
}
@Test
public void testDynamicLoadingCustomStream() throws Exception {
System.setProperty("enable.runtime.lib", "true");
setupRestTestHarnesses();
String blobName = "colltest";
HttpSolrClient randomClient = (HttpSolrClient) clients.get(random().nextInt(clients.size()));
String baseURL = randomClient.getBaseURL();
baseURL = baseURL.substring(0, baseURL.lastIndexOf('/'));
TestBlobHandler.createSystemCollection(getHttpSolrClient(baseURL, randomClient.getHttpClient()));
waitForRecoveriesToFinish(".system", true);
String payload = "{\n" +
"'create-expressible' : { 'name' : 'hello', 'class': 'org.apache.solr.core.HelloStream' }\n" +
"}";

View File

@ -9,10 +9,6 @@
"type": "string",
"description": "The request handler class. Class names do not need to be fully qualified if they are included with Solr, so you can abbreviate the name as 'solr.SearchHandler'. Custom or third-party class names may need to be fully qualified, however."
},
"runtimeLib": {
"type": "boolean",
"description": "An optional parameter to use a custom .jar file that has been uploaded to Solr's blobstore. This additionally requires that the .jar has also been registered with the 'add-runtimelib' command, which is one of the available commands for the Config API."
},
"startup": {
"type": "string",
"description": "Allows the request handler to only start when requested. The only option is 'lazy'.",

View File

@ -8,10 +8,6 @@
"class": {
"type": "string",
"description": "The configuration item class. Class names do not need to be fully qualified if they are included with Solr, so you can abbreviate the name as 'solr.SearchHandler'. Custom or third-party class names may need to be fully qualified, however."
},
"runtimeLib": {
"type": "boolean",
"description": "An optional parameter to use a custom .jar file that has been uploaded to Solr's blobstore. This additionally requires that the .jar has also been registered with the 'add-runtimelib' command, which is one of the available commands for the Config API."
}
},
"required": [ "name", "class"],

View File

@ -197,19 +197,6 @@
"items": {
"type": "string"
}
},
"add-runtimelib": {
"#include": "core.config.Commands.runtimeLib"
},
"update-runtimelib": {
"#include": "core.config.Commands.runtimeLib"
},
"delete-runtimelib": {
"type":"array",
"description": "Deletes one or more runtime libraries (runtimeLibs), using the name given when the runtimeLib was created. Define more than one runtimeLibs by separating the list of names with commas.",
"items": {
"type": "string"
}
}
}
}