use of com.thinkbiganalytics.kylo.catalog.ConnectorPluginManager in project kylo by Teradata.
the class CatalogMetadataConfig method doPluginSyncAction.
private void doPluginSyncAction(ConnectorPluginManager pluginMgr, MetadataAccess metadata) {
metadata.commit(() -> {
List<ConnectorPlugin> plugins = pluginMgr.getPlugins();
Map<String, Connector> connectorMap = connectorProvider().findAll(true).stream().collect(Collectors.toMap(Connector::getPluginId, c -> c));
for (ConnectorPlugin plugin : plugins) {
Connector connector = connectorMap.get(plugin.getId());
ConnectorPluginDescriptor descr = plugin.getDescriptor();
if (connector != null) {
connectorMap.get(plugin.getId()).setActive(true);
connectorMap.remove(plugin.getId());
} else {
String title = descr.getTitle();
connector = connectorProvider().create(plugin.getId(), title);
}
connector.setIconColor(descr.getColor());
connector.setIcon(descr.getIcon());
if (StringUtils.isNotBlank(descr.getFormat())) {
connector.getSparkParameters().setFormat(descr.getFormat());
}
}
// least one data source, or removed if they don't.
for (Connector connector : connectorMap.values()) {
if (connector.getDataSources().isEmpty()) {
connectorProvider().deleteById(connector.getId());
} else {
connector.setActive(false);
}
}
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.kylo.catalog.ConnectorPluginManager in project kylo by Teradata.
the class TestSpringConfiguration method connectorPluginManager.
@Bean
public ConnectorPluginManager connectorPluginManager() {
ConnectorPluginDescriptor descr = new ConnectorPluginDescriptor("dummy", "Dummy Connector", "jdbc");
ConnectorPlugin plugin = Mockito.mock(ConnectorPlugin.class);
Mockito.when(plugin.getDescriptor()).thenReturn(descr);
ConnectorPluginManager mgr = Mockito.mock(ConnectorPluginManager.class);
Mockito.when(mgr.getPlugin(anyString())).thenReturn(Optional.of(plugin));
return mgr;
}
use of com.thinkbiganalytics.kylo.catalog.ConnectorPluginManager in project kylo by Teradata.
the class TemporaryConnectorPluginConfig method connectorPluginManager.
@Bean
public ConnectorPluginManager connectorPluginManager(Optional<List<ConnectorPlugin>> plugins) {
List<ConnectorPlugin> list = plugins.orElse(Collections.emptyList());
ConnectorPluginManager mgr = new DefaultConnectorPluginManager();
list.forEach(plugin -> mgr.register(plugin));
return mgr;
}
Aggregations