Delegate dynamicBeans for external plugins
When dynamicbeans are defined by an external plugin on commands from a different plugin, instantiate the dynamic bean with a delegating classloader which uses the command's classloader as the parent and resolves resources via the dynamicbean's classloader. Also instantiate the dynamicbeans using the injector from the command. Change-Id: If2cff8235a9680eb64c58b77f2d482c5896baf0f
This commit is contained in:
committed by
Zac Livingston
parent
b32d6fcfe4
commit
4c4acd6796
@@ -36,6 +36,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gwtexpui.server.CacheHeaders;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashSet;
|
||||
@@ -51,11 +52,16 @@ class ParameterParser {
|
||||
ImmutableSet.of("pp", "prettyPrint", "strict", "callback", "alt", "fields");
|
||||
|
||||
private final CmdLineParser.Factory parserFactory;
|
||||
private final Injector injector;
|
||||
private final DynamicMap<DynamicOptions.DynamicBean> dynamicBeans;
|
||||
|
||||
@Inject
|
||||
ParameterParser(CmdLineParser.Factory pf, DynamicMap<DynamicOptions.DynamicBean> dynamicBeans) {
|
||||
ParameterParser(
|
||||
CmdLineParser.Factory pf,
|
||||
Injector injector,
|
||||
DynamicMap<DynamicOptions.DynamicBean> dynamicBeans) {
|
||||
this.parserFactory = pf;
|
||||
this.injector = injector;
|
||||
this.dynamicBeans = dynamicBeans;
|
||||
}
|
||||
|
||||
@@ -63,7 +69,7 @@ class ParameterParser {
|
||||
T param, ListMultimap<String, String> in, HttpServletRequest req, HttpServletResponse res)
|
||||
throws IOException {
|
||||
CmdLineParser clp = parserFactory.create(param);
|
||||
DynamicOptions pluginOptions = new DynamicOptions(param, dynamicBeans);
|
||||
DynamicOptions pluginOptions = new DynamicOptions(param, injector, dynamicBeans);
|
||||
pluginOptions.parseDynamicBeans(clp);
|
||||
pluginOptions.setDynamicBeans();
|
||||
pluginOptions.onBeanParseStart();
|
||||
|
||||
Reference in New Issue
Block a user