Search in sources :

Example 1 with ImporterPluginInfo

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()));
            }
        });
    }
}
Also used : GeneratorPluginConfiguration(org.eclipse.vorto.repository.plugin.generator.GeneratorPluginConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ImporterPluginInfo(org.eclipse.vorto.plugin.importer.ImporterPluginInfo) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 PostConstruct (javax.annotation.PostConstruct)1 ImporterPluginInfo (org.eclipse.vorto.plugin.importer.ImporterPluginInfo)1 GeneratorPluginConfiguration (org.eclipse.vorto.repository.plugin.generator.GeneratorPluginConfiguration)1