use of org.eclipse.vorto.plugin.importer.ImporterPluginInfo in project vorto by eclipse.
the class PluginConfiguration method registerPlugins.
@PostConstruct
public void registerPlugins() throws Exception {
if (this.pluginsJson == null) {
return;
}
Plugin[] plugins = new ObjectMapper().readValue(Base64.getDecoder().decode(this.pluginsJson.getBytes()), Plugin[].class);
if (plugins != null && plugins.length > 0) {
Arrays.stream(plugins).forEach(plugin -> {
if (plugin.getPluginType().equals(PluginType.generator)) {
GeneratorPluginConfiguration config = GeneratorPluginConfiguration.of(plugin.getKey(), plugin.getApiVersion(), plugin.getEndpoint(), plugin.getPluginVersion());
if (plugin.getTag() != null) {
config.setTags(new String[] { plugin.getTag() });
}
generatorPluginService.registerPlugin(config);
} else {
ImporterPluginInfo info = new ImporterPluginInfo(plugin.getKey(), plugin.getName(), plugin.getDescription(), plugin.getVendor(), plugin.getFileType());
this.importerPluginService.registerImporter(createImporter(info, plugin.getEndpoint()));
}
});
}
}
Aggregations