mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
renamed PluginWrapper to InstalledPlugin
This commit is contained in:
@@ -42,7 +42,7 @@ import java.nio.file.Path;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
public final class PluginWrapper
|
public final class InstalledPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,7 +53,7 @@ public final class PluginWrapper
|
|||||||
* @param webResourceLoader web resource loader
|
* @param webResourceLoader web resource loader
|
||||||
* @param directory plugin directory
|
* @param directory plugin directory
|
||||||
*/
|
*/
|
||||||
public PluginWrapper(Plugin plugin, ClassLoader classLoader,
|
public InstalledPlugin(Plugin plugin, ClassLoader classLoader,
|
||||||
WebResourceLoader webResourceLoader, Path directory)
|
WebResourceLoader webResourceLoader, Path directory)
|
||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -68,7 +68,7 @@ public interface PluginLoader
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Collection<PluginWrapper> getInstalledPlugins();
|
public Collection<InstalledPlugin> getInstalledPlugins();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link ClassLoader} which is able to load classes and resources
|
* Returns a {@link ClassLoader} which is able to load classes and resources
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import sonia.scm.plugin.Plugin;
|
|||||||
import sonia.scm.plugin.PluginLoader;
|
import sonia.scm.plugin.PluginLoader;
|
||||||
import sonia.scm.plugin.PluginManager;
|
import sonia.scm.plugin.PluginManager;
|
||||||
import sonia.scm.plugin.PluginPermissions;
|
import sonia.scm.plugin.PluginPermissions;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
import sonia.scm.web.VndMediaType;
|
import sonia.scm.web.VndMediaType;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -53,7 +53,7 @@ public class InstalledPluginResource {
|
|||||||
@Produces(VndMediaType.PLUGIN_COLLECTION)
|
@Produces(VndMediaType.PLUGIN_COLLECTION)
|
||||||
public Response getInstalledPlugins() {
|
public Response getInstalledPlugins() {
|
||||||
PluginPermissions.read().check();
|
PluginPermissions.read().check();
|
||||||
List<PluginWrapper> plugins = new ArrayList<>(pluginLoader.getInstalledPlugins());
|
List<InstalledPlugin> plugins = new ArrayList<>(pluginLoader.getInstalledPlugins());
|
||||||
return Response.ok(collectionMapper.map(plugins)).build();
|
return Response.ok(collectionMapper.map(plugins)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import de.otto.edison.hal.Embedded;
|
|||||||
import de.otto.edison.hal.HalRepresentation;
|
import de.otto.edison.hal.HalRepresentation;
|
||||||
import de.otto.edison.hal.Links;
|
import de.otto.edison.hal.Links;
|
||||||
import sonia.scm.plugin.PluginInformation;
|
import sonia.scm.plugin.PluginInformation;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -25,7 +25,7 @@ public class PluginDtoCollectionMapper {
|
|||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HalRepresentation map(List<PluginWrapper> plugins) {
|
public HalRepresentation map(List<InstalledPlugin> plugins) {
|
||||||
List<PluginDto> dtos = plugins.stream().map(mapper::map).collect(toList());
|
List<PluginDto> dtos = plugins.stream().map(mapper::map).collect(toList());
|
||||||
return new HalRepresentation(createInstalledPluginsLinks(), embedDtos(dtos));
|
return new HalRepresentation(createInstalledPluginsLinks(), embedDtos(dtos));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import org.mapstruct.MappingTarget;
|
|||||||
import org.mapstruct.ObjectFactory;
|
import org.mapstruct.ObjectFactory;
|
||||||
import sonia.scm.plugin.PluginInformation;
|
import sonia.scm.plugin.PluginInformation;
|
||||||
import sonia.scm.plugin.PluginState;
|
import sonia.scm.plugin.PluginState;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ public abstract class PluginDtoMapper {
|
|||||||
@Inject
|
@Inject
|
||||||
private ResourceLinks resourceLinks;
|
private ResourceLinks resourceLinks;
|
||||||
|
|
||||||
public PluginDto map(PluginWrapper plugin) {
|
public PluginDto map(InstalledPlugin plugin) {
|
||||||
return map(plugin.getPlugin().getInformation());
|
return map(plugin.getPlugin().getInformation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.google.inject.Inject;
|
|||||||
import de.otto.edison.hal.Embedded;
|
import de.otto.edison.hal.Embedded;
|
||||||
import de.otto.edison.hal.HalRepresentation;
|
import de.otto.edison.hal.HalRepresentation;
|
||||||
import de.otto.edison.hal.Links;
|
import de.otto.edison.hal.Links;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,7 +24,7 @@ public class UIPluginDtoCollectionMapper {
|
|||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HalRepresentation map(Collection<PluginWrapper> plugins) {
|
public HalRepresentation map(Collection<InstalledPlugin> plugins) {
|
||||||
List<UIPluginDto> dtos = plugins.stream().map(mapper::map).collect(toList());
|
List<UIPluginDto> dtos = plugins.stream().map(mapper::map).collect(toList());
|
||||||
return new HalRepresentation(createLinks(), embedDtos(dtos));
|
return new HalRepresentation(createLinks(), embedDtos(dtos));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package sonia.scm.api.v2.resources;
|
|||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import de.otto.edison.hal.Links;
|
import de.otto.edison.hal.Links;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
import sonia.scm.util.HttpUtil;
|
import sonia.scm.util.HttpUtil;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -25,7 +25,7 @@ public class UIPluginDtoMapper {
|
|||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UIPluginDto map(PluginWrapper plugin) {
|
public UIPluginDto map(InstalledPlugin plugin) {
|
||||||
UIPluginDto dto = new UIPluginDto(
|
UIPluginDto dto = new UIPluginDto(
|
||||||
plugin.getPlugin().getInformation().getName(),
|
plugin.getPlugin().getInformation().getName(),
|
||||||
getScriptResources(plugin)
|
getScriptResources(plugin)
|
||||||
@@ -40,7 +40,7 @@ public class UIPluginDtoMapper {
|
|||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> getScriptResources(PluginWrapper wrapper) {
|
private Set<String> getScriptResources(InstalledPlugin wrapper) {
|
||||||
Set<String> scriptResources = wrapper.getPlugin().getResources().getScriptResources();
|
Set<String> scriptResources = wrapper.getPlugin().getResources().getScriptResources();
|
||||||
if (scriptResources != null) {
|
if (scriptResources != null) {
|
||||||
return scriptResources.stream()
|
return scriptResources.stream()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
|||||||
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
|
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
|
||||||
import com.webcohesion.enunciate.metadata.rs.TypeHint;
|
import com.webcohesion.enunciate.metadata.rs.TypeHint;
|
||||||
import sonia.scm.plugin.PluginLoader;
|
import sonia.scm.plugin.PluginLoader;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
import sonia.scm.security.AllowAnonymousAccess;
|
import sonia.scm.security.AllowAnonymousAccess;
|
||||||
import sonia.scm.web.VndMediaType;
|
import sonia.scm.web.VndMediaType;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class UIPluginResource {
|
|||||||
@TypeHint(CollectionDto.class)
|
@TypeHint(CollectionDto.class)
|
||||||
@Produces(VndMediaType.UI_PLUGIN_COLLECTION)
|
@Produces(VndMediaType.UI_PLUGIN_COLLECTION)
|
||||||
public Response getInstalledPlugins() {
|
public Response getInstalledPlugins() {
|
||||||
List<PluginWrapper> plugins = pluginLoader.getInstalledPlugins()
|
List<InstalledPlugin> plugins = pluginLoader.getInstalledPlugins()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(this::filter)
|
.filter(this::filter)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -85,7 +85,7 @@ public class UIPluginResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean filter(PluginWrapper plugin) {
|
private boolean filter(InstalledPlugin plugin) {
|
||||||
return plugin.getPlugin().getResources() != null;
|
return plugin.getPlugin().getResources() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import sonia.scm.plugin.Plugin;
|
|||||||
import sonia.scm.plugin.PluginException;
|
import sonia.scm.plugin.PluginException;
|
||||||
import sonia.scm.plugin.PluginLoadException;
|
import sonia.scm.plugin.PluginLoadException;
|
||||||
import sonia.scm.plugin.PluginLoader;
|
import sonia.scm.plugin.PluginLoader;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
import sonia.scm.plugin.PluginsInternal;
|
import sonia.scm.plugin.PluginsInternal;
|
||||||
import sonia.scm.plugin.SmpArchive;
|
import sonia.scm.plugin.SmpArchive;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
@@ -43,7 +43,7 @@ public final class PluginBootstrap {
|
|||||||
|
|
||||||
private final ClassLoaderLifeCycle classLoaderLifeCycle;
|
private final ClassLoaderLifeCycle classLoaderLifeCycle;
|
||||||
private final ServletContext servletContext;
|
private final ServletContext servletContext;
|
||||||
private final Set<PluginWrapper> plugins;
|
private final Set<InstalledPlugin> plugins;
|
||||||
private final PluginLoader pluginLoader;
|
private final PluginLoader pluginLoader;
|
||||||
|
|
||||||
PluginBootstrap(ServletContext servletContext, ClassLoaderLifeCycle classLoaderLifeCycle) {
|
PluginBootstrap(ServletContext servletContext, ClassLoaderLifeCycle classLoaderLifeCycle) {
|
||||||
@@ -58,7 +58,7 @@ public final class PluginBootstrap {
|
|||||||
return pluginLoader;
|
return pluginLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PluginWrapper> getPlugins() {
|
public Set<InstalledPlugin> getPlugins() {
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ public final class PluginBootstrap {
|
|||||||
return new DefaultPluginLoader(servletContext, classLoaderLifeCycle.getBootstrapClassLoader(), plugins);
|
return new DefaultPluginLoader(servletContext, classLoaderLifeCycle.getBootstrapClassLoader(), plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<PluginWrapper> collectPlugins() {
|
private Set<InstalledPlugin> collectPlugins() {
|
||||||
try {
|
try {
|
||||||
File pluginDirectory = getPluginDirectory();
|
File pluginDirectory = getPluginDirectory();
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
* @param installedPlugins
|
* @param installedPlugins
|
||||||
*/
|
*/
|
||||||
public DefaultPluginLoader(ServletContext servletContext, ClassLoader parent,
|
public DefaultPluginLoader(ServletContext servletContext, ClassLoader parent,
|
||||||
Set<PluginWrapper> installedPlugins)
|
Set<InstalledPlugin> installedPlugins)
|
||||||
{
|
{
|
||||||
this.installedPlugins = installedPlugins;
|
this.installedPlugins = installedPlugins;
|
||||||
this.uberClassLoader = new UberClassLoader(parent, installedPlugins);
|
this.uberClassLoader = new UberClassLoader(parent, installedPlugins);
|
||||||
@@ -141,7 +141,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Collection<PluginWrapper> getInstalledPlugins()
|
public Collection<InstalledPlugin> getInstalledPlugins()
|
||||||
{
|
{
|
||||||
return installedPlugins;
|
return installedPlugins;
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
private final ExtensionProcessor extensionProcessor;
|
private final ExtensionProcessor extensionProcessor;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Set<PluginWrapper> installedPlugins;
|
private final Set<InstalledPlugin> installedPlugins;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Set<ScmModule> modules;
|
private final Set<ScmModule> modules;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
this.httpClient = httpClient;
|
this.httpClient = httpClient;
|
||||||
installedPlugins = new HashMap<>();
|
installedPlugins = new HashMap<>();
|
||||||
|
|
||||||
for (PluginWrapper wrapper : pluginLoader.getInstalledPlugins())
|
for (InstalledPlugin wrapper : pluginLoader.getInstalledPlugins())
|
||||||
{
|
{
|
||||||
Plugin plugin = wrapper.getPlugin();
|
Plugin plugin = wrapper.getPlugin();
|
||||||
PluginInformation info = plugin.getInformation();
|
PluginInformation info = plugin.getInformation();
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
|||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
public DefaultUberWebResourceLoader(ServletContext servletContext, Iterable<PluginWrapper> plugins) {
|
public DefaultUberWebResourceLoader(ServletContext servletContext, Iterable<InstalledPlugin> plugins) {
|
||||||
this(servletContext, plugins, SCMContext.getContext().getStage());
|
this(servletContext, plugins, SCMContext.getContext().getStage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultUberWebResourceLoader(ServletContext servletContext, Iterable<PluginWrapper> plugins, Stage stage) {
|
public DefaultUberWebResourceLoader(ServletContext servletContext, Iterable<InstalledPlugin> plugins, Stage stage) {
|
||||||
this.servletContext = servletContext;
|
this.servletContext = servletContext;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
this.cache = createCache(stage);
|
this.cache = createCache(stage);
|
||||||
@@ -153,7 +153,7 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
|||||||
resources.add(ctxResource);
|
resources.add(ctxResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PluginWrapper wrapper : plugins)
|
for (InstalledPlugin wrapper : plugins)
|
||||||
{
|
{
|
||||||
URL resource = nonDirectory(wrapper.getWebResourceLoader().getResource(path));
|
URL resource = nonDirectory(wrapper.getWebResourceLoader().getResource(path));
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
|||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
{
|
{
|
||||||
for (PluginWrapper wrapper : plugins)
|
for (InstalledPlugin wrapper : plugins)
|
||||||
{
|
{
|
||||||
resource = nonDirectory(wrapper.getWebResourceLoader().getResource(path));
|
resource = nonDirectory(wrapper.getWebResourceLoader().getResource(path));
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ public class DefaultUberWebResourceLoader implements UberWebResourceLoader
|
|||||||
private final Cache<String, URL> cache;
|
private final Cache<String, URL> cache;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Iterable<PluginWrapper> plugins;
|
private final Iterable<InstalledPlugin> plugins;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final ServletContext servletContext;
|
private final ServletContext servletContext;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public final class PluginNode
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PluginWrapper getWrapper()
|
public InstalledPlugin getWrapper()
|
||||||
{
|
{
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ public final class PluginNode
|
|||||||
*
|
*
|
||||||
* @param wrapper
|
* @param wrapper
|
||||||
*/
|
*/
|
||||||
public void setWrapper(PluginWrapper wrapper)
|
public void setWrapper(InstalledPlugin wrapper)
|
||||||
{
|
{
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
}
|
}
|
||||||
@@ -192,5 +192,5 @@ public final class PluginNode
|
|||||||
private final ExplodedSmp plugin;
|
private final ExplodedSmp plugin;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private PluginWrapper wrapper;
|
private InstalledPlugin wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public Set<PluginWrapper> collectPlugins(ClassLoader classLoader)
|
public Set<InstalledPlugin> collectPlugins(ClassLoader classLoader)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
logger.info("collect plugins");
|
logger.info("collect plugins");
|
||||||
@@ -187,7 +187,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
logger.trace("create plugin wrappers and build classloaders");
|
logger.trace("create plugin wrappers and build classloaders");
|
||||||
|
|
||||||
Set<PluginWrapper> wrappers = createPluginWrappers(classLoader, rootNodes);
|
Set<InstalledPlugin> wrappers = createPluginWrappers(classLoader, rootNodes);
|
||||||
|
|
||||||
logger.debug("collected {} plugins", wrappers.size());
|
logger.debug("collected {} plugins", wrappers.size());
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void appendPluginWrapper(Set<PluginWrapper> plugins,
|
private void appendPluginWrapper(Set<InstalledPlugin> plugins,
|
||||||
ClassLoader classLoader, PluginNode node)
|
ClassLoader classLoader, PluginNode node)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@@ -217,7 +217,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
for (PluginNode parent : node.getParents())
|
for (PluginNode parent : node.getParents())
|
||||||
{
|
{
|
||||||
PluginWrapper wrapper = parent.getWrapper();
|
InstalledPlugin wrapper = parent.getWrapper();
|
||||||
|
|
||||||
if (wrapper != null)
|
if (wrapper != null)
|
||||||
{
|
{
|
||||||
@@ -236,7 +236,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginWrapper plugin =
|
InstalledPlugin plugin =
|
||||||
createPluginWrapper(createParentPluginClassLoader(classLoader, parents),
|
createPluginWrapper(createParentPluginClassLoader(classLoader, parents),
|
||||||
smp);
|
smp);
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private void appendPluginWrappers(Set<PluginWrapper> plugins,
|
private void appendPluginWrappers(Set<InstalledPlugin> plugins,
|
||||||
ClassLoader classLoader, List<PluginNode> nodes)
|
ClassLoader classLoader, List<PluginNode> nodes)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@@ -474,11 +474,11 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private PluginWrapper createPluginWrapper(ClassLoader classLoader,
|
private InstalledPlugin createPluginWrapper(ClassLoader classLoader,
|
||||||
ExplodedSmp smp)
|
ExplodedSmp smp)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
PluginWrapper wrapper = null;
|
InstalledPlugin wrapper = null;
|
||||||
Path directory = smp.getPath();
|
Path directory = smp.getPath();
|
||||||
Path descriptor = directory.resolve(PluginConstants.FILE_DESCRIPTOR);
|
Path descriptor = directory.resolve(PluginConstants.FILE_DESCRIPTOR);
|
||||||
|
|
||||||
@@ -490,7 +490,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
WebResourceLoader resourceLoader = createWebResourceLoader(directory);
|
WebResourceLoader resourceLoader = createWebResourceLoader(directory);
|
||||||
|
|
||||||
wrapper = new PluginWrapper(plugin, cl, resourceLoader, directory);
|
wrapper = new InstalledPlugin(plugin, cl, resourceLoader, directory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -512,11 +512,11 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private Set<PluginWrapper> createPluginWrappers(ClassLoader classLoader,
|
private Set<InstalledPlugin> createPluginWrappers(ClassLoader classLoader,
|
||||||
List<PluginNode> rootNodes)
|
List<PluginNode> rootNodes)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Set<PluginWrapper> plugins = Sets.newHashSet();
|
Set<InstalledPlugin> plugins = Sets.newHashSet();
|
||||||
|
|
||||||
appendPluginWrappers(plugins, classLoader, rootNodes);
|
appendPluginWrappers(plugins, classLoader, rootNodes);
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public final class PluginsInternal
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Set<PluginWrapper> collectPlugins(ClassLoaderLifeCycle classLoaderLifeCycle,
|
public static Set<InstalledPlugin> collectPlugins(ClassLoaderLifeCycle classLoaderLifeCycle,
|
||||||
Path directory)
|
Path directory)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@@ -159,7 +159,7 @@ public final class PluginsInternal
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Iterable<Plugin> unwrap(Iterable<PluginWrapper> wrapped)
|
public static Iterable<Plugin> unwrap(Iterable<InstalledPlugin> wrapped)
|
||||||
{
|
{
|
||||||
return Iterables.transform(wrapped, new Unwrap());
|
return Iterables.transform(wrapped, new Unwrap());
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ public final class PluginsInternal
|
|||||||
* @version Enter version here..., 14/06/05
|
* @version Enter version here..., 14/06/05
|
||||||
* @author Enter your name here...
|
* @author Enter your name here...
|
||||||
*/
|
*/
|
||||||
private static class Unwrap implements Function<PluginWrapper, Plugin>
|
private static class Unwrap implements Function<InstalledPlugin, Plugin>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,7 +200,7 @@ public final class PluginsInternal
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Plugin apply(PluginWrapper wrapper)
|
public Plugin apply(InstalledPlugin wrapper)
|
||||||
{
|
{
|
||||||
return wrapper.getPlugin();
|
return wrapper.getPlugin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public final class UberClassLoader extends ClassLoader
|
|||||||
* @param parent
|
* @param parent
|
||||||
* @param plugins
|
* @param plugins
|
||||||
*/
|
*/
|
||||||
public UberClassLoader(ClassLoader parent, Iterable<PluginWrapper> plugins)
|
public UberClassLoader(ClassLoader parent, Iterable<InstalledPlugin> plugins)
|
||||||
{
|
{
|
||||||
super(parent);
|
super(parent);
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
@@ -87,7 +87,7 @@ public final class UberClassLoader extends ClassLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Class<?> findClassInPlugins(String name) throws ClassNotFoundException {
|
private Class<?> findClassInPlugins(String name) throws ClassNotFoundException {
|
||||||
for (PluginWrapper plugin : plugins) {
|
for (InstalledPlugin plugin : plugins) {
|
||||||
Class<?> clazz = findClass(plugin.getClassLoader(), name);
|
Class<?> clazz = findClass(plugin.getClassLoader(), name);
|
||||||
if (clazz != null) {
|
if (clazz != null) {
|
||||||
return clazz;
|
return clazz;
|
||||||
@@ -119,7 +119,7 @@ public final class UberClassLoader extends ClassLoader
|
|||||||
{
|
{
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
|
||||||
for (PluginWrapper plugin : plugins)
|
for (InstalledPlugin plugin : plugins)
|
||||||
{
|
{
|
||||||
ClassLoader cl = plugin.getClassLoader();
|
ClassLoader cl = plugin.getClassLoader();
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ public final class UberClassLoader extends ClassLoader
|
|||||||
{
|
{
|
||||||
List<URL> urls = Lists.newArrayList();
|
List<URL> urls = Lists.newArrayList();
|
||||||
|
|
||||||
for (PluginWrapper plugin : plugins)
|
for (InstalledPlugin plugin : plugins)
|
||||||
{
|
{
|
||||||
ClassLoader cl = plugin.getClassLoader();
|
ClassLoader cl = plugin.getClassLoader();
|
||||||
|
|
||||||
@@ -194,5 +194,5 @@ public final class UberClassLoader extends ClassLoader
|
|||||||
Maps.newConcurrentMap();
|
Maps.newConcurrentMap();
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Iterable<PluginWrapper> plugins;
|
private final Iterable<InstalledPlugin> plugins;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import sonia.scm.plugin.Plugin;
|
|||||||
import sonia.scm.plugin.PluginInformation;
|
import sonia.scm.plugin.PluginInformation;
|
||||||
import sonia.scm.plugin.PluginLoader;
|
import sonia.scm.plugin.PluginLoader;
|
||||||
import sonia.scm.plugin.PluginState;
|
import sonia.scm.plugin.PluginState;
|
||||||
import sonia.scm.plugin.PluginWrapper;
|
import sonia.scm.plugin.InstalledPlugin;
|
||||||
import sonia.scm.web.VndMediaType;
|
import sonia.scm.web.VndMediaType;
|
||||||
|
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
@@ -86,9 +86,9 @@ class InstalledPluginResourceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getInstalledPlugins() throws URISyntaxException, UnsupportedEncodingException {
|
void getInstalledPlugins() throws URISyntaxException, UnsupportedEncodingException {
|
||||||
PluginWrapper pluginWrapper = new PluginWrapper(null, null, null, null);
|
InstalledPlugin installedPlugin = new InstalledPlugin(null, null, null, null);
|
||||||
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(pluginWrapper));
|
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(installedPlugin));
|
||||||
when(collectionMapper.map(Collections.singletonList(pluginWrapper))).thenReturn(new MockedResultDto());
|
when(collectionMapper.map(Collections.singletonList(installedPlugin))).thenReturn(new MockedResultDto());
|
||||||
|
|
||||||
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/installed");
|
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/installed");
|
||||||
request.accept(VndMediaType.PLUGIN_COLLECTION);
|
request.accept(VndMediaType.PLUGIN_COLLECTION);
|
||||||
@@ -107,12 +107,12 @@ class InstalledPluginResourceTest {
|
|||||||
pluginInformation.setName("pluginName");
|
pluginInformation.setName("pluginName");
|
||||||
pluginInformation.setState(PluginState.INSTALLED);
|
pluginInformation.setState(PluginState.INSTALLED);
|
||||||
Plugin plugin = new Plugin(2, pluginInformation, null, null, false, null);
|
Plugin plugin = new Plugin(2, pluginInformation, null, null, false, null);
|
||||||
PluginWrapper pluginWrapper = new PluginWrapper(plugin, null, null, null);
|
InstalledPlugin installedPlugin = new InstalledPlugin(plugin, null, null, null);
|
||||||
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(pluginWrapper));
|
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(installedPlugin));
|
||||||
|
|
||||||
PluginDto pluginDto = new PluginDto();
|
PluginDto pluginDto = new PluginDto();
|
||||||
pluginDto.setName("pluginName");
|
pluginDto.setName("pluginName");
|
||||||
when(mapper.map(pluginWrapper)).thenReturn(pluginDto);
|
when(mapper.map(installedPlugin)).thenReturn(pluginDto);
|
||||||
|
|
||||||
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/installed/pluginName");
|
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/installed/pluginName");
|
||||||
request.accept(VndMediaType.PLUGIN);
|
request.accept(VndMediaType.PLUGIN);
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public class UIRootResourceTest {
|
|||||||
assertTrue(response.getContentAsString().contains("/scm/my/bundle.js"));
|
assertTrue(response.getContentAsString().contains("/scm/my/bundle.js"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mockPlugins(PluginWrapper... plugins) {
|
private void mockPlugins(InstalledPlugin... plugins) {
|
||||||
when(pluginLoader.getInstalledPlugins()).thenReturn(Lists.newArrayList(plugins));
|
when(pluginLoader.getInstalledPlugins()).thenReturn(Lists.newArrayList(plugins));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,12 +180,12 @@ public class UIRootResourceTest {
|
|||||||
return new PluginResources(scripts, styles);
|
return new PluginResources(scripts, styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PluginWrapper mockPlugin(String id) {
|
private InstalledPlugin mockPlugin(String id) {
|
||||||
return mockPlugin(id, id, null);
|
return mockPlugin(id, id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PluginWrapper mockPlugin(String id, String name, PluginResources pluginResources) {
|
private InstalledPlugin mockPlugin(String id, String name, PluginResources pluginResources) {
|
||||||
PluginWrapper wrapper = mock(PluginWrapper.class);
|
InstalledPlugin wrapper = mock(InstalledPlugin.class);
|
||||||
when(wrapper.getId()).thenReturn(id);
|
when(wrapper.getId()).thenReturn(id);
|
||||||
|
|
||||||
Plugin plugin = mock(Plugin.class);
|
Plugin plugin = mock(Plugin.class);
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
public void testGetResourceFromCache() {
|
public void testGetResourceFromCache() {
|
||||||
DefaultUberWebResourceLoader resourceLoader =
|
DefaultUberWebResourceLoader resourceLoader =
|
||||||
new DefaultUberWebResourceLoader(servletContext,
|
new DefaultUberWebResourceLoader(servletContext,
|
||||||
new ArrayList<PluginWrapper>(), Stage.PRODUCTION);
|
new ArrayList<InstalledPlugin>(), Stage.PRODUCTION);
|
||||||
|
|
||||||
resourceLoader.getCache().put("/myresource", GITHUB);
|
resourceLoader.getCache().put("/myresource", GITHUB);
|
||||||
|
|
||||||
@@ -131,8 +131,8 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
{
|
{
|
||||||
File directory = temp.newFolder();
|
File directory = temp.newFolder();
|
||||||
File file = file(directory, "myresource");
|
File file = file(directory, "myresource");
|
||||||
PluginWrapper wrapper = createPluginWrapper(directory);
|
InstalledPlugin wrapper = createPluginWrapper(directory);
|
||||||
List<PluginWrapper> plugins = Lists.newArrayList(wrapper);
|
List<InstalledPlugin> plugins = Lists.newArrayList(wrapper);
|
||||||
WebResourceLoader resourceLoader =
|
WebResourceLoader resourceLoader =
|
||||||
new DefaultUberWebResourceLoader(servletContext, plugins);
|
new DefaultUberWebResourceLoader(servletContext, plugins);
|
||||||
|
|
||||||
@@ -170,8 +170,8 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
|
|
||||||
File directory = temp.newFolder();
|
File directory = temp.newFolder();
|
||||||
File file = file(directory, "myresource");
|
File file = file(directory, "myresource");
|
||||||
PluginWrapper wrapper = createPluginWrapper(directory);
|
InstalledPlugin wrapper = createPluginWrapper(directory);
|
||||||
List<PluginWrapper> plugins = Lists.newArrayList(wrapper);
|
List<InstalledPlugin> plugins = Lists.newArrayList(wrapper);
|
||||||
|
|
||||||
UberWebResourceLoader resourceLoader =
|
UberWebResourceLoader resourceLoader =
|
||||||
new DefaultUberWebResourceLoader(servletContext, plugins);
|
new DefaultUberWebResourceLoader(servletContext, plugins);
|
||||||
@@ -197,11 +197,11 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
WebResourceLoader loader = mock(WebResourceLoader.class);
|
WebResourceLoader loader = mock(WebResourceLoader.class);
|
||||||
when(loader.getResource("/myresource")).thenReturn(url);
|
when(loader.getResource("/myresource")).thenReturn(url);
|
||||||
|
|
||||||
PluginWrapper pluginWrapper = mock(PluginWrapper.class);
|
InstalledPlugin installedPlugin = mock(InstalledPlugin.class);
|
||||||
when(pluginWrapper.getWebResourceLoader()).thenReturn(loader);
|
when(installedPlugin.getWebResourceLoader()).thenReturn(loader);
|
||||||
|
|
||||||
WebResourceLoader resourceLoader =
|
WebResourceLoader resourceLoader =
|
||||||
new DefaultUberWebResourceLoader(servletContext, Lists.newArrayList(pluginWrapper));
|
new DefaultUberWebResourceLoader(servletContext, Lists.newArrayList(installedPlugin));
|
||||||
|
|
||||||
assertNull(resourceLoader.getResource("/myresource"));
|
assertNull(resourceLoader.getResource("/myresource"));
|
||||||
}
|
}
|
||||||
@@ -214,11 +214,11 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
WebResourceLoader loader = mock(WebResourceLoader.class);
|
WebResourceLoader loader = mock(WebResourceLoader.class);
|
||||||
when(loader.getResource("/myresource")).thenReturn(url);
|
when(loader.getResource("/myresource")).thenReturn(url);
|
||||||
|
|
||||||
PluginWrapper pluginWrapper = mock(PluginWrapper.class);
|
InstalledPlugin installedPlugin = mock(InstalledPlugin.class);
|
||||||
when(pluginWrapper.getWebResourceLoader()).thenReturn(loader);
|
when(installedPlugin.getWebResourceLoader()).thenReturn(loader);
|
||||||
|
|
||||||
UberWebResourceLoader resourceLoader =
|
UberWebResourceLoader resourceLoader =
|
||||||
new DefaultUberWebResourceLoader(servletContext, Lists.newArrayList(pluginWrapper));
|
new DefaultUberWebResourceLoader(servletContext, Lists.newArrayList(installedPlugin));
|
||||||
|
|
||||||
List<URL> resources = resourceLoader.getResources("/myresource");
|
List<URL> resources = resourceLoader.getResources("/myresource");
|
||||||
Assertions.assertThat(resources).isEmpty();
|
Assertions.assertThat(resources).isEmpty();
|
||||||
@@ -232,7 +232,7 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private PluginWrapper createPluginWrapper(File directory)
|
private InstalledPlugin createPluginWrapper(File directory)
|
||||||
{
|
{
|
||||||
return createPluginWrapper(directory.toPath());
|
return createPluginWrapper(directory.toPath());
|
||||||
}
|
}
|
||||||
@@ -245,9 +245,9 @@ public class DefaultUberWebResourceLoaderTest extends WebResourceLoaderTestBase
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private PluginWrapper createPluginWrapper(Path directory)
|
private InstalledPlugin createPluginWrapper(Path directory)
|
||||||
{
|
{
|
||||||
return new PluginWrapper(null, null, new PathWebResourceLoader(directory),
|
return new InstalledPlugin(null, null, new PathWebResourceLoader(directory),
|
||||||
directory);
|
directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmp(PLUGIN_A);
|
copySmp(PLUGIN_A);
|
||||||
|
|
||||||
PluginWrapper plugin = collectAndGetFirst();
|
InstalledPlugin plugin = collectAndGetFirst();
|
||||||
|
|
||||||
assertThat(plugin.getId(), is(PLUGIN_A.id));
|
assertThat(plugin.getId(), is(PLUGIN_A.id));
|
||||||
}
|
}
|
||||||
@@ -145,15 +145,15 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmps(PLUGIN_A, PLUGIN_B);
|
copySmps(PLUGIN_A, PLUGIN_B);
|
||||||
|
|
||||||
Set<PluginWrapper> plugins = collectPlugins();
|
Set<InstalledPlugin> plugins = collectPlugins();
|
||||||
|
|
||||||
assertThat(plugins, hasSize(2));
|
assertThat(plugins, hasSize(2));
|
||||||
|
|
||||||
PluginWrapper a = findPlugin(plugins, PLUGIN_A.id);
|
InstalledPlugin a = findPlugin(plugins, PLUGIN_A.id);
|
||||||
|
|
||||||
assertNotNull(a);
|
assertNotNull(a);
|
||||||
|
|
||||||
PluginWrapper b = findPlugin(plugins, PLUGIN_B.id);
|
InstalledPlugin b = findPlugin(plugins, PLUGIN_B.id);
|
||||||
|
|
||||||
assertNotNull(b);
|
assertNotNull(b);
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmp(PLUGIN_A);
|
copySmp(PLUGIN_A);
|
||||||
|
|
||||||
PluginWrapper plugin = collectAndGetFirst();
|
InstalledPlugin plugin = collectAndGetFirst();
|
||||||
ClassLoader cl = plugin.getClassLoader();
|
ClassLoader cl = plugin.getClassLoader();
|
||||||
|
|
||||||
// load parent class
|
// load parent class
|
||||||
@@ -216,9 +216,9 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmps(PLUGIN_A, PLUGIN_B);
|
copySmps(PLUGIN_A, PLUGIN_B);
|
||||||
|
|
||||||
Set<PluginWrapper> plugins = collectPlugins();
|
Set<InstalledPlugin> plugins = collectPlugins();
|
||||||
|
|
||||||
PluginWrapper plugin = findPlugin(plugins, PLUGIN_B.id);
|
InstalledPlugin plugin = findPlugin(plugins, PLUGIN_B.id);
|
||||||
ClassLoader cl = plugin.getClassLoader();
|
ClassLoader cl = plugin.getClassLoader();
|
||||||
|
|
||||||
// load parent class
|
// load parent class
|
||||||
@@ -247,7 +247,7 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmp(PLUGIN_A);
|
copySmp(PLUGIN_A);
|
||||||
|
|
||||||
PluginWrapper plugin = collectAndGetFirst();
|
InstalledPlugin plugin = collectAndGetFirst();
|
||||||
WebResourceLoader wrl = plugin.getWebResourceLoader();
|
WebResourceLoader wrl = plugin.getWebResourceLoader();
|
||||||
|
|
||||||
assertNotNull(wrl);
|
assertNotNull(wrl);
|
||||||
@@ -269,7 +269,7 @@ public class PluginProcessorTest
|
|||||||
{
|
{
|
||||||
copySmp(PLUGIN_F_1_0_0);
|
copySmp(PLUGIN_F_1_0_0);
|
||||||
|
|
||||||
PluginWrapper plugin = collectAndGetFirst();
|
InstalledPlugin plugin = collectAndGetFirst();
|
||||||
|
|
||||||
assertThat(plugin.getId(), is(PLUGIN_F_1_0_0.id));
|
assertThat(plugin.getId(), is(PLUGIN_F_1_0_0.id));
|
||||||
copySmp(PLUGIN_F_1_0_1);
|
copySmp(PLUGIN_F_1_0_1);
|
||||||
@@ -302,9 +302,9 @@ public class PluginProcessorTest
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private PluginWrapper collectAndGetFirst() throws IOException
|
private InstalledPlugin collectAndGetFirst() throws IOException
|
||||||
{
|
{
|
||||||
Set<PluginWrapper> plugins = collectPlugins();
|
Set<InstalledPlugin> plugins = collectPlugins();
|
||||||
|
|
||||||
assertThat(plugins, hasSize(1));
|
assertThat(plugins, hasSize(1));
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ public class PluginProcessorTest
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private Set<PluginWrapper> collectPlugins() throws IOException
|
private Set<InstalledPlugin> collectPlugins() throws IOException
|
||||||
{
|
{
|
||||||
return processor.collectPlugins(PluginProcessorTest.class.getClassLoader());
|
return processor.collectPlugins(PluginProcessorTest.class.getClassLoader());
|
||||||
}
|
}
|
||||||
@@ -368,14 +368,14 @@ public class PluginProcessorTest
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private PluginWrapper findPlugin(Iterable<PluginWrapper> plugin,
|
private InstalledPlugin findPlugin(Iterable<InstalledPlugin> plugin,
|
||||||
final String id)
|
final String id)
|
||||||
{
|
{
|
||||||
return Iterables.find(plugin, new Predicate<PluginWrapper>()
|
return Iterables.find(plugin, new Predicate<InstalledPlugin>()
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(PluginWrapper input)
|
public boolean apply(InstalledPlugin input)
|
||||||
{
|
{
|
||||||
return id.equals(input.getId());
|
return id.equals(input.getId());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user