refactor plugin endpoints

This commit is contained in:
Eduard Heimbuch
2019-07-31 10:27:52 +02:00
parent 598a4e6f32
commit a9744d8df1
12 changed files with 210 additions and 107 deletions

View File

@@ -186,8 +186,6 @@ public class DefaultPluginManager implements PluginManager
PluginCenter center = getPluginCenter();
// pluginHandler.install(id);
for (PluginInformation plugin : center.getPlugins())
{
String pluginId = plugin.getId();
@@ -593,10 +591,10 @@ public class DefaultPluginManager implements PluginManager
*/
private PluginCenter getPluginCenter()
{
PluginCenter center = null; // cache.get(PluginCenter.class.getName());
PluginCenter center = cache.get(PluginCenter.class.getName());
// if (center == null)
// {
if (center == null)
{
synchronized (DefaultPluginManager.class)
{
String pluginUrl = configuration.getPluginUrl();
@@ -636,7 +634,7 @@ public class DefaultPluginManager implements PluginManager
}
}
}
// }
}
return center;
}

View File

@@ -57,7 +57,7 @@ public final class PluginCenterDto implements Serializable {
private Dependency dependencies;
@XmlElement(name = "_links")
private Map<String, Object> links;
private Map<String, Link> links;
}
@XmlAccessorType(XmlAccessType.FIELD)
@@ -77,18 +77,10 @@ public final class PluginCenterDto implements Serializable {
private String name;
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "_links")
@Getter
static class Links {
private Link link;
private boolean templated;
}
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
static class Link {
private String url;
private String href;
private boolean templated;
}
}

View File

@@ -24,10 +24,6 @@ public class PluginCenterDtoMapper {
pluginInformation.setCondition(new PluginCondition(condition.getMinVersion(), Collections.singletonList(condition.getOs()), condition.getArch()));
}
if (plugin.getLinks() != null) {
pluginInformation.setLinks(plugin.getLinks());
}
pluginInformationSet.add(pluginInformation);
}
return pluginInformationSet;