mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
renamed Plugin to InstalledPluginDescriptor and added PluginDescriptor interface
This commit is contained in:
@@ -36,7 +36,7 @@ package sonia.scm.plugin;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for a {@link Plugin}. The wrapper holds the directory,
|
* Wrapper for a {@link InstalledPluginDescriptor}. The wrapper holds the directory,
|
||||||
* {@link ClassLoader} and {@link WebResourceLoader} of a plugin.
|
* {@link ClassLoader} and {@link WebResourceLoader} of a plugin.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -53,7 +53,7 @@ public final class InstalledPlugin
|
|||||||
* @param webResourceLoader web resource loader
|
* @param webResourceLoader web resource loader
|
||||||
* @param directory plugin directory
|
* @param directory plugin directory
|
||||||
*/
|
*/
|
||||||
public InstalledPlugin(Plugin plugin, ClassLoader classLoader,
|
public InstalledPlugin(InstalledPluginDescriptor plugin, ClassLoader classLoader,
|
||||||
WebResourceLoader webResourceLoader, Path directory)
|
WebResourceLoader webResourceLoader, Path directory)
|
||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -103,7 +103,7 @@ public final class InstalledPlugin
|
|||||||
*
|
*
|
||||||
* @return plugin
|
* @return plugin
|
||||||
*/
|
*/
|
||||||
public Plugin getPlugin()
|
public InstalledPluginDescriptor getPlugin()
|
||||||
{
|
{
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ public final class InstalledPlugin
|
|||||||
private final Path directory;
|
private final Path directory;
|
||||||
|
|
||||||
/** plugin */
|
/** plugin */
|
||||||
private final Plugin plugin;
|
private final InstalledPluginDescriptor plugin;
|
||||||
|
|
||||||
/** plugin web resource loader */
|
/** plugin web resource loader */
|
||||||
private final WebResourceLoader webResourceLoader;
|
private final WebResourceLoader webResourceLoader;
|
||||||
|
|||||||
@@ -54,14 +54,14 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public final class Plugin extends ScmModule
|
public final class InstalledPluginDescriptor extends ScmModule implements PluginDescriptor
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Plugin() {}
|
InstalledPluginDescriptor() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
@@ -74,7 +74,7 @@ public final class Plugin extends ScmModule
|
|||||||
* @param childFirstClassLoader
|
* @param childFirstClassLoader
|
||||||
* @param dependencies
|
* @param dependencies
|
||||||
*/
|
*/
|
||||||
public Plugin(int scmVersion, PluginInformation information,
|
public InstalledPluginDescriptor(int scmVersion, PluginInformation information,
|
||||||
PluginResources resources, PluginCondition condition,
|
PluginResources resources, PluginCondition condition,
|
||||||
boolean childFirstClassLoader, Set<String> dependencies)
|
boolean childFirstClassLoader, Set<String> dependencies)
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ public final class Plugin extends ScmModule
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Plugin other = (Plugin) obj;
|
final InstalledPluginDescriptor other = (InstalledPluginDescriptor) obj;
|
||||||
|
|
||||||
return Objects.equal(scmVersion, other.scmVersion)
|
return Objects.equal(scmVersion, other.scmVersion)
|
||||||
&& Objects.equal(condition, other.condition)
|
&& Objects.equal(condition, other.condition)
|
||||||
@@ -161,6 +161,7 @@ public final class Plugin extends ScmModule
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public PluginCondition getCondition()
|
public PluginCondition getCondition()
|
||||||
{
|
{
|
||||||
return condition;
|
return condition;
|
||||||
@@ -174,6 +175,7 @@ public final class Plugin extends ScmModule
|
|||||||
*
|
*
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Set<String> getDependencies()
|
public Set<String> getDependencies()
|
||||||
{
|
{
|
||||||
if (dependencies == null)
|
if (dependencies == null)
|
||||||
@@ -190,6 +192,7 @@ public final class Plugin extends ScmModule
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public PluginInformation getInformation()
|
public PluginInformation getInformation()
|
||||||
{
|
{
|
||||||
return information;
|
return information;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package sonia.scm.plugin;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface PluginDescriptor {
|
||||||
|
|
||||||
|
PluginInformation getInformation();
|
||||||
|
|
||||||
|
PluginCondition getCondition();
|
||||||
|
|
||||||
|
Set<String> getDependencies();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ public final class Plugins
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context = JAXBContext.newInstance(Plugin.class, ScmModule.class);
|
context = JAXBContext.newInstance(InstalledPluginDescriptor.class, ScmModule.class);
|
||||||
}
|
}
|
||||||
catch (JAXBException ex)
|
catch (JAXBException ex)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ public final class Plugins
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Plugin parsePluginDescriptor(Path path)
|
public static InstalledPluginDescriptor parsePluginDescriptor(Path path)
|
||||||
{
|
{
|
||||||
return parsePluginDescriptor(Files.asByteSource(path.toFile()));
|
return parsePluginDescriptor(Files.asByteSource(path.toFile()));
|
||||||
}
|
}
|
||||||
@@ -104,15 +104,15 @@ public final class Plugins
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Plugin parsePluginDescriptor(ByteSource data)
|
public static InstalledPluginDescriptor parsePluginDescriptor(ByteSource data)
|
||||||
{
|
{
|
||||||
Preconditions.checkNotNull(data, "data parameter is required");
|
Preconditions.checkNotNull(data, "data parameter is required");
|
||||||
|
|
||||||
Plugin plugin;
|
InstalledPluginDescriptor plugin;
|
||||||
|
|
||||||
try (InputStream stream = data.openStream())
|
try (InputStream stream = data.openStream())
|
||||||
{
|
{
|
||||||
plugin = (Plugin) context.createUnmarshaller().unmarshal(stream);
|
plugin = (InstalledPluginDescriptor) context.createUnmarshaller().unmarshal(stream);
|
||||||
}
|
}
|
||||||
catch (JAXBException ex)
|
catch (JAXBException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public final class SmpArchive
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public Plugin getPlugin() throws IOException
|
public InstalledPluginDescriptor getPlugin() throws IOException
|
||||||
{
|
{
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
{
|
{
|
||||||
@@ -245,9 +245,9 @@ public final class SmpArchive
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private Plugin createPlugin() throws IOException
|
private InstalledPluginDescriptor createPlugin() throws IOException
|
||||||
{
|
{
|
||||||
Plugin p = null;
|
InstalledPluginDescriptor p = null;
|
||||||
NonClosingZipInputStream zis = null;
|
NonClosingZipInputStream zis = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -412,5 +412,5 @@ public final class SmpArchive
|
|||||||
private final ByteSource archive;
|
private final ByteSource archive;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Plugin plugin;
|
private InstalledPluginDescriptor plugin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class SmpArchiveTest
|
|||||||
public void testGetPlugin() throws IOException
|
public void testGetPlugin() throws IOException
|
||||||
{
|
{
|
||||||
File archive = createArchive("sonia.sample", "1.0");
|
File archive = createArchive("sonia.sample", "1.0");
|
||||||
Plugin plugin = SmpArchive.create(archive).getPlugin();
|
InstalledPluginDescriptor plugin = SmpArchive.create(archive).getPlugin();
|
||||||
|
|
||||||
assertNotNull(plugin);
|
assertNotNull(plugin);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package sonia.scm.api.v2.resources;
|
|||||||
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
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.Plugin;
|
import sonia.scm.plugin.InstalledPluginDescriptor;
|
||||||
import sonia.scm.plugin.PluginInformation;
|
import sonia.scm.plugin.PluginInformation;
|
||||||
import sonia.scm.plugin.PluginManager;
|
import sonia.scm.plugin.PluginManager;
|
||||||
import sonia.scm.plugin.PluginPermissions;
|
import sonia.scm.plugin.PluginPermissions;
|
||||||
@@ -83,7 +83,7 @@ public class AvailablePluginResource {
|
|||||||
if (plugin.isPresent()) {
|
if (plugin.isPresent()) {
|
||||||
return Response.ok(mapper.map(plugin.get())).build();
|
return Response.ok(mapper.map(plugin.get())).build();
|
||||||
} else {
|
} else {
|
||||||
throw notFound(entity(Plugin.class, name));
|
throw notFound(entity(InstalledPluginDescriptor.class, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package sonia.scm.api.v2.resources;
|
|||||||
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
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.Plugin;
|
import sonia.scm.plugin.InstalledPluginDescriptor;
|
||||||
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;
|
||||||
@@ -83,7 +83,7 @@ public class InstalledPluginResource {
|
|||||||
if (pluginDto.isPresent()) {
|
if (pluginDto.isPresent()) {
|
||||||
return Response.ok(pluginDto.get()).build();
|
return Response.ok(pluginDto.get()).build();
|
||||||
} else {
|
} else {
|
||||||
throw notFound(entity(Plugin.class, name));
|
throw notFound(entity(InstalledPluginDescriptor.class, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import sonia.scm.SCMContext;
|
|||||||
import sonia.scm.lifecycle.classloading.ClassLoaderLifeCycle;
|
import sonia.scm.lifecycle.classloading.ClassLoaderLifeCycle;
|
||||||
import sonia.scm.migration.UpdateException;
|
import sonia.scm.migration.UpdateException;
|
||||||
import sonia.scm.plugin.DefaultPluginLoader;
|
import sonia.scm.plugin.DefaultPluginLoader;
|
||||||
import sonia.scm.plugin.Plugin;
|
import sonia.scm.plugin.InstalledPluginDescriptor;
|
||||||
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;
|
||||||
@@ -105,7 +105,7 @@ public final class PluginBootstrap {
|
|||||||
PluginIndexEntry entry) throws IOException {
|
PluginIndexEntry entry) throws IOException {
|
||||||
URL url = context.getResource(PLUGIN_DIRECTORY.concat(entry.getName()));
|
URL url = context.getResource(PLUGIN_DIRECTORY.concat(entry.getName()));
|
||||||
SmpArchive archive = SmpArchive.create(url);
|
SmpArchive archive = SmpArchive.create(url);
|
||||||
Plugin plugin = archive.getPlugin();
|
InstalledPluginDescriptor plugin = archive.getPlugin();
|
||||||
|
|
||||||
File directory = PluginsInternal.createPluginDirectory(pluginDirectory, plugin);
|
File directory = PluginsInternal.createPluginDirectory(pluginDirectory, plugin);
|
||||||
File checksumFile = PluginsInternal.getChecksumFile(directory);
|
File checksumFile = PluginsInternal.getChecksumFile(directory);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
JAXBContext context = JAXBContext.newInstance(ScmModule.class,
|
JAXBContext context = JAXBContext.newInstance(ScmModule.class,
|
||||||
Plugin.class);
|
InstalledPluginDescriptor.class);
|
||||||
|
|
||||||
modules = getInstalled(parent, context, PATH_MODULECONFIG);
|
modules = getInstalled(parent, context, PATH_MODULECONFIG);
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ public class DefaultPluginLoader implements PluginLoader
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Iterable<Plugin> unwrap()
|
private Iterable<InstalledPluginDescriptor> unwrap()
|
||||||
{
|
{
|
||||||
return PluginsInternal.unwrap(installedPlugins);
|
return PluginsInternal.unwrap(installedPlugins);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
|
|
||||||
for (InstalledPlugin wrapper : pluginLoader.getInstalledPlugins())
|
for (InstalledPlugin wrapper : pluginLoader.getInstalledPlugins())
|
||||||
{
|
{
|
||||||
Plugin plugin = wrapper.getPlugin();
|
InstalledPluginDescriptor plugin = wrapper.getPlugin();
|
||||||
PluginInformation info = plugin.getInformation();
|
PluginInformation info = plugin.getInformation();
|
||||||
|
|
||||||
if ((info != null) && info.isValid())
|
if ((info != null) && info.isValid())
|
||||||
@@ -192,7 +192,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
plugin.setState(PluginState.INSTALLED);
|
plugin.setState(PluginState.INSTALLED);
|
||||||
|
|
||||||
// ugly workaround
|
// ugly workaround
|
||||||
Plugin newPlugin = new Plugin();
|
InstalledPluginDescriptor newPlugin = new InstalledPluginDescriptor();
|
||||||
|
|
||||||
// TODO check
|
// TODO check
|
||||||
// newPlugin.setInformation(plugin);
|
// newPlugin.setInformation(plugin);
|
||||||
@@ -220,8 +220,8 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
new ZipUnArchiver().extractArchive(packageStream, tempDirectory);
|
new ZipUnArchiver().extractArchive(packageStream, tempDirectory);
|
||||||
|
|
||||||
Plugin plugin = JAXB.unmarshal(new File(tempDirectory, "plugin.xml"),
|
InstalledPluginDescriptor plugin = JAXB.unmarshal(new File(tempDirectory, "plugin.xml"),
|
||||||
Plugin.class);
|
InstalledPluginDescriptor.class);
|
||||||
|
|
||||||
PluginCondition condition = plugin.getCondition();
|
PluginCondition condition = plugin.getCondition();
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
PluginPermissions.manage().check();
|
PluginPermissions.manage().check();
|
||||||
|
|
||||||
Plugin plugin = installedPlugins.get(id);
|
InstalledPluginDescriptor plugin = installedPlugins.get(id);
|
||||||
|
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
{
|
{
|
||||||
@@ -457,7 +457,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
|
|
||||||
Set<PluginInformation> infoSet = new LinkedHashSet<>();
|
Set<PluginInformation> infoSet = new LinkedHashSet<>();
|
||||||
|
|
||||||
for (Plugin plugin : installedPlugins.values())
|
for (InstalledPluginDescriptor plugin : installedPlugins.values())
|
||||||
{
|
{
|
||||||
infoSet.add(plugin.getInformation());
|
infoSet.add(plugin.getInformation());
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
boolean core = false;
|
boolean core = false;
|
||||||
|
|
||||||
for (Plugin installedPlugin : installedPlugins.values())
|
for (InstalledPluginDescriptor installedPlugin : installedPlugins.values())
|
||||||
{
|
{
|
||||||
PluginInformation installed = installedPlugin.getInformation();
|
PluginInformation installed = installedPlugin.getInformation();
|
||||||
|
|
||||||
@@ -715,5 +715,5 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
private final SCMContextProvider context;
|
private final SCMContextProvider context;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private final Map<String, Plugin> installedPlugins;
|
private final Map<String, InstalledPluginDescriptor> installedPlugins;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public final class ExplodedSmp implements Comparable<ExplodedSmp>
|
|||||||
* @param path
|
* @param path
|
||||||
* @param plugin
|
* @param plugin
|
||||||
*/
|
*/
|
||||||
ExplodedSmp(Path path, Plugin plugin)
|
ExplodedSmp(Path path, InstalledPluginDescriptor plugin)
|
||||||
{
|
{
|
||||||
logger.trace("create exploded scm for plugin {} and dependencies {}", plugin.getInformation().getName(), plugin.getDependencies());
|
logger.trace("create exploded scm for plugin {} and dependencies {}", plugin.getInformation().getName(), plugin.getDependencies());
|
||||||
this.path = path;
|
this.path = path;
|
||||||
@@ -163,7 +163,7 @@ public final class ExplodedSmp implements Comparable<ExplodedSmp>
|
|||||||
*
|
*
|
||||||
* @return plugin descriptor
|
* @return plugin descriptor
|
||||||
*/
|
*/
|
||||||
public Plugin getPlugin()
|
public InstalledPluginDescriptor getPlugin()
|
||||||
{
|
{
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
@@ -202,5 +202,5 @@ public final class ExplodedSmp implements Comparable<ExplodedSmp>
|
|||||||
private final Path path;
|
private final Path path;
|
||||||
|
|
||||||
/** plugin object */
|
/** plugin object */
|
||||||
private final Plugin plugin;
|
private final InstalledPluginDescriptor plugin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.context = JAXBContext.newInstance(Plugin.class);
|
this.context = JAXBContext.newInstance(InstalledPluginDescriptor.class);
|
||||||
}
|
}
|
||||||
catch (JAXBException ex)
|
catch (JAXBException ex)
|
||||||
{
|
{
|
||||||
@@ -371,7 +371,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
ClassLoader classLoader;
|
ClassLoader classLoader;
|
||||||
URL[] urlArray = urls.toArray(new URL[urls.size()]);
|
URL[] urlArray = urls.toArray(new URL[urls.size()]);
|
||||||
Plugin plugin = smp.getPlugin();
|
InstalledPluginDescriptor plugin = smp.getPlugin();
|
||||||
|
|
||||||
String id = plugin.getInformation().getName(false);
|
String id = plugin.getInformation().getName(false);
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ public final class PluginProcessor
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Plugin createPlugin(ClassLoader classLoader, Path descriptor)
|
private InstalledPluginDescriptor createPlugin(ClassLoader classLoader, Path descriptor)
|
||||||
{
|
{
|
||||||
ClassLoader ctxcl = Thread.currentThread().getContextClassLoader();
|
ClassLoader ctxcl = Thread.currentThread().getContextClassLoader();
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ public final class PluginProcessor
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (Plugin) context.createUnmarshaller().unmarshal(
|
return (InstalledPluginDescriptor) context.createUnmarshaller().unmarshal(
|
||||||
descriptor.toFile());
|
descriptor.toFile());
|
||||||
}
|
}
|
||||||
catch (JAXBException ex)
|
catch (JAXBException ex)
|
||||||
@@ -486,7 +486,7 @@ public final class PluginProcessor
|
|||||||
{
|
{
|
||||||
ClassLoader cl = createClassLoader(classLoader, smp);
|
ClassLoader cl = createClassLoader(classLoader, smp);
|
||||||
|
|
||||||
Plugin plugin = createPlugin(cl, descriptor);
|
InstalledPluginDescriptor plugin = createPlugin(cl, descriptor);
|
||||||
|
|
||||||
WebResourceLoader resourceLoader = createWebResourceLoader(directory);
|
WebResourceLoader resourceLoader = createWebResourceLoader(directory);
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public final class PluginTree
|
|||||||
|
|
||||||
for (ExplodedSmp smp : smpOrdered)
|
for (ExplodedSmp smp : smpOrdered)
|
||||||
{
|
{
|
||||||
Plugin plugin = smp.getPlugin();
|
InstalledPluginDescriptor plugin = smp.getPlugin();
|
||||||
|
|
||||||
if (plugin.getScmVersion() != SCM_VERSION)
|
if (plugin.getScmVersion() != SCM_VERSION)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public final class PluginsInternal
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static File createPluginDirectory(File parent, Plugin plugin)
|
public static File createPluginDirectory(File parent, InstalledPluginDescriptor plugin)
|
||||||
{
|
{
|
||||||
PluginInformation info = plugin.getInformation();
|
PluginInformation info = plugin.getInformation();
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ public final class PluginsInternal
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Iterable<Plugin> unwrap(Iterable<InstalledPlugin> wrapped)
|
public static Iterable<InstalledPluginDescriptor> 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<InstalledPlugin, Plugin>
|
private static class Unwrap implements Function<InstalledPlugin, InstalledPluginDescriptor>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,7 +200,7 @@ public final class PluginsInternal
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Plugin apply(InstalledPlugin wrapper)
|
public InstalledPluginDescriptor apply(InstalledPlugin wrapper)
|
||||||
{
|
{
|
||||||
return wrapper.getPlugin();
|
return wrapper.getPlugin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import sonia.scm.plugin.Plugin;
|
import sonia.scm.plugin.InstalledPluginDescriptor;
|
||||||
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;
|
||||||
@@ -106,7 +106,7 @@ class InstalledPluginResourceTest {
|
|||||||
pluginInformation.setVersion("2.0.0");
|
pluginInformation.setVersion("2.0.0");
|
||||||
pluginInformation.setName("pluginName");
|
pluginInformation.setName("pluginName");
|
||||||
pluginInformation.setState(PluginState.INSTALLED);
|
pluginInformation.setState(PluginState.INSTALLED);
|
||||||
Plugin plugin = new Plugin(2, pluginInformation, null, null, false, null);
|
InstalledPluginDescriptor plugin = new InstalledPluginDescriptor(2, pluginInformation, null, null, false, null);
|
||||||
InstalledPlugin installedPlugin = new InstalledPlugin(plugin, null, null, null);
|
InstalledPlugin installedPlugin = new InstalledPlugin(plugin, null, null, null);
|
||||||
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(installedPlugin));
|
when(pluginLoader.getInstalledPlugins()).thenReturn(Collections.singletonList(installedPlugin));
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public class UIRootResourceTest {
|
|||||||
InstalledPlugin wrapper = mock(InstalledPlugin.class);
|
InstalledPlugin wrapper = mock(InstalledPlugin.class);
|
||||||
when(wrapper.getId()).thenReturn(id);
|
when(wrapper.getId()).thenReturn(id);
|
||||||
|
|
||||||
Plugin plugin = mock(Plugin.class);
|
InstalledPluginDescriptor plugin = mock(InstalledPluginDescriptor.class);
|
||||||
when(wrapper.getPlugin()).thenReturn(plugin);
|
when(wrapper.getPlugin()).thenReturn(plugin);
|
||||||
when(plugin.getResources()).thenReturn(pluginResources);
|
when(plugin.getResources()).thenReturn(pluginResources);
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class ExplodedSmpTest
|
|||||||
info.setName(name);
|
info.setName(name);
|
||||||
info.setVersion(version);
|
info.setVersion(version);
|
||||||
|
|
||||||
Plugin plugin = new Plugin(2, info, null, null, false,
|
InstalledPluginDescriptor plugin = new InstalledPluginDescriptor(2, info, null, null, false,
|
||||||
Sets.newSet(dependencies));
|
Sets.newSet(dependencies));
|
||||||
|
|
||||||
return new ExplodedSmp(null, plugin);
|
return new ExplodedSmp(null, plugin);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class PluginTreeTest
|
|||||||
{
|
{
|
||||||
PluginCondition condition = new PluginCondition("999",
|
PluginCondition condition = new PluginCondition("999",
|
||||||
new ArrayList<String>(), "hit");
|
new ArrayList<String>(), "hit");
|
||||||
Plugin plugin = new Plugin(2, createInfo("a", "1"), null, condition,
|
InstalledPluginDescriptor plugin = new InstalledPluginDescriptor(2, createInfo("a", "1"), null, condition,
|
||||||
false, null);
|
false, null);
|
||||||
ExplodedSmp smp = createSmp(plugin);
|
ExplodedSmp smp = createSmp(plugin);
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ public class PluginTreeTest
|
|||||||
@Test(expected = PluginException.class)
|
@Test(expected = PluginException.class)
|
||||||
public void testScmVersion() throws IOException
|
public void testScmVersion() throws IOException
|
||||||
{
|
{
|
||||||
Plugin plugin = new Plugin(1, createInfo("a", "1"), null, null, false,
|
InstalledPluginDescriptor plugin = new InstalledPluginDescriptor(1, createInfo("a", "1"), null, null, false,
|
||||||
null);
|
null);
|
||||||
ExplodedSmp smp = createSmp(plugin);
|
ExplodedSmp smp = createSmp(plugin);
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ public class PluginTreeTest
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private ExplodedSmp createSmp(Plugin plugin) throws IOException
|
private ExplodedSmp createSmp(InstalledPluginDescriptor plugin) throws IOException
|
||||||
{
|
{
|
||||||
return new ExplodedSmp(tempFolder.newFile().toPath(), plugin);
|
return new ExplodedSmp(tempFolder.newFile().toPath(), plugin);
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ public class PluginTreeTest
|
|||||||
*/
|
*/
|
||||||
private ExplodedSmp createSmp(String name) throws IOException
|
private ExplodedSmp createSmp(String name) throws IOException
|
||||||
{
|
{
|
||||||
return createSmp(new Plugin(2, createInfo(name, "1.0.0"), null, null,
|
return createSmp(new InstalledPluginDescriptor(2, createInfo(name, "1.0.0"), null, null,
|
||||||
false, null));
|
false, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ public class PluginTreeTest
|
|||||||
dependencySet.add(d);
|
dependencySet.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin plugin = new Plugin(2, createInfo(name, "1"), null, null,
|
InstalledPluginDescriptor plugin = new InstalledPluginDescriptor(2, createInfo(name, "1"), null, null,
|
||||||
false, dependencySet);
|
false, dependencySet);
|
||||||
|
|
||||||
return createSmp(plugin);
|
return createSmp(plugin);
|
||||||
|
|||||||
Reference in New Issue
Block a user