Simplify InstallPlugin
Create instances using a Provider, and add builder methods to set the parameters. This makes the implementation more consistent with other REST endpoints, and will make it easier to use from the plugin API. Change-Id: I5a4db8917c47c62dc5ce199ecad70c724e4e876c
This commit is contained in:
@@ -33,13 +33,18 @@ public class PluginsCollection
|
||||
private final DynamicMap<RestView<PluginResource>> views;
|
||||
private final PluginLoader loader;
|
||||
private final Provider<ListPlugins> list;
|
||||
private final Provider<InstallPlugin> install;
|
||||
|
||||
@Inject
|
||||
PluginsCollection(
|
||||
DynamicMap<RestView<PluginResource>> views, PluginLoader loader, Provider<ListPlugins> list) {
|
||||
DynamicMap<RestView<PluginResource>> views,
|
||||
PluginLoader loader,
|
||||
Provider<ListPlugins> list,
|
||||
Provider<InstallPlugin> install) {
|
||||
this.views = views;
|
||||
this.loader = loader;
|
||||
this.list = list;
|
||||
this.install = install;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +69,7 @@ public class PluginsCollection
|
||||
if (!loader.isRemoteAdminEnabled()) {
|
||||
throw new MethodNotAllowedException("remote installation is disabled");
|
||||
}
|
||||
return new InstallPlugin(loader, id.get(), true /* created */);
|
||||
return install.get().setName(id.get()).setCreated(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user