Rename InstallPluginInfo to InstallPluginInput
Change-Id: I94cc0bf0bb6405edcae994efda2953148843db96
This commit is contained in:
@@ -17,7 +17,7 @@ package com.google.gerrit.extensions.common;
|
|||||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||||
import com.google.gerrit.extensions.restapi.RawInput;
|
import com.google.gerrit.extensions.restapi.RawInput;
|
||||||
|
|
||||||
public class InstallPluginInfo {
|
public class InstallPluginInput {
|
||||||
public @DefaultInput String url;
|
public @DefaultInput String url;
|
||||||
public RawInput raw;
|
public RawInput raw;
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ package com.google.gerrit.server.plugins;
|
|||||||
|
|
||||||
import com.google.gerrit.common.data.GlobalCapability;
|
import com.google.gerrit.common.data.GlobalCapability;
|
||||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||||
import com.google.gerrit.extensions.common.InstallPluginInfo;
|
import com.google.gerrit.extensions.common.InstallPluginInput;
|
||||||
import com.google.gerrit.extensions.common.PluginInfo;
|
import com.google.gerrit.extensions.common.PluginInfo;
|
||||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||||
@@ -32,7 +32,7 @@ import java.net.URL;
|
|||||||
import java.util.zip.ZipException;
|
import java.util.zip.ZipException;
|
||||||
|
|
||||||
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
||||||
class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInfo> {
|
class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInput> {
|
||||||
private final PluginLoader loader;
|
private final PluginLoader loader;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean created;
|
private final boolean created;
|
||||||
@@ -44,7 +44,7 @@ class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInf
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response<PluginInfo> apply(TopLevelResource resource, InstallPluginInfo input)
|
public Response<PluginInfo> apply(TopLevelResource resource, InstallPluginInput input)
|
||||||
throws BadRequestException, MethodNotAllowedException, IOException {
|
throws BadRequestException, MethodNotAllowedException, IOException {
|
||||||
if (!loader.isRemoteAdminEnabled()) {
|
if (!loader.isRemoteAdminEnabled()) {
|
||||||
throw new MethodNotAllowedException("remote installation is disabled");
|
throw new MethodNotAllowedException("remote installation is disabled");
|
||||||
@@ -71,7 +71,7 @@ class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputStream openStream(InstallPluginInfo input) throws IOException, BadRequestException {
|
private InputStream openStream(InstallPluginInput input) throws IOException, BadRequestException {
|
||||||
if (input.raw != null) {
|
if (input.raw != null) {
|
||||||
return input.raw.getInputStream();
|
return input.raw.getInputStream();
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInf
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
||||||
static class Overwrite implements RestModifyView<PluginResource, InstallPluginInfo> {
|
static class Overwrite implements RestModifyView<PluginResource, InstallPluginInput> {
|
||||||
private final PluginLoader loader;
|
private final PluginLoader loader;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -92,7 +92,7 @@ class InstallPlugin implements RestModifyView<TopLevelResource, InstallPluginInf
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response<PluginInfo> apply(PluginResource resource, InstallPluginInfo input)
|
public Response<PluginInfo> apply(PluginResource resource, InstallPluginInput input)
|
||||||
throws BadRequestException, MethodNotAllowedException, IOException {
|
throws BadRequestException, MethodNotAllowedException, IOException {
|
||||||
return new InstallPlugin(loader, resource.getName(), false)
|
return new InstallPlugin(loader, resource.getName(), false)
|
||||||
.apply(TopLevelResource.INSTANCE, input);
|
.apply(TopLevelResource.INSTANCE, input);
|
||||||
|
|||||||
Reference in New Issue
Block a user