introduce Plugin interface

This commit is contained in:
Sebastian Sdorra
2019-08-20 08:10:30 +02:00
parent 1a01216f62
commit 0aaec1174a
9 changed files with 32 additions and 18 deletions

View File

@@ -77,7 +77,7 @@ public class InstalledPluginResource {
PluginPermissions.read().check();
Optional<PluginDto> pluginDto = pluginLoader.getInstalledPlugins()
.stream()
.filter(plugin -> name.equals(plugin.getPlugin().getInformation().getName()))
.filter(plugin -> name.equals(plugin.getDescriptor().getInformation().getName()))
.map(mapper::map)
.findFirst();
if (pluginDto.isPresent()) {

View File

@@ -21,7 +21,7 @@ public abstract class PluginDtoMapper {
private ResourceLinks resourceLinks;
public PluginDto map(InstalledPlugin plugin) {
return map(plugin.getPlugin().getInformation());
return map(plugin.getDescriptor().getInformation());
}
public abstract PluginDto map(PluginInformation plugin);

View File

@@ -27,7 +27,7 @@ public class UIPluginDtoMapper {
public UIPluginDto map(InstalledPlugin plugin) {
UIPluginDto dto = new UIPluginDto(
plugin.getPlugin().getInformation().getName(),
plugin.getDescriptor().getInformation().getName(),
getScriptResources(plugin)
);
@@ -41,7 +41,7 @@ public class UIPluginDtoMapper {
}
private Set<String> getScriptResources(InstalledPlugin wrapper) {
Set<String> scriptResources = wrapper.getPlugin().getResources().getScriptResources();
Set<String> scriptResources = wrapper.getDescriptor().getResources().getScriptResources();
if (scriptResources != null) {
return scriptResources.stream()
.map(this::addContextPath)

View File

@@ -86,7 +86,7 @@ public class UIPluginResource {
}
private boolean filter(InstalledPlugin plugin) {
return plugin.getPlugin().getResources() != null;
return plugin.getDescriptor().getResources() != null;
}
}

View File

@@ -131,7 +131,7 @@ public class DefaultPluginManager implements PluginManager
for (InstalledPlugin wrapper : pluginLoader.getInstalledPlugins())
{
InstalledPluginDescriptor plugin = wrapper.getPlugin();
InstalledPluginDescriptor plugin = wrapper.getDescriptor();
PluginInformation info = plugin.getInformation();
if ((info != null) && info.isValid())

View File

@@ -202,7 +202,7 @@ public final class PluginsInternal
@Override
public InstalledPluginDescriptor apply(InstalledPlugin wrapper)
{
return wrapper.getPlugin();
return wrapper.getDescriptor();
}
}
}