use of com.netflix.metacat.common.dto.CatalogDto in project metacat by Netflix.
the class CatalogServiceImpl method get.
/**
* {@inheritDoc}
*/
@Nonnull
@Override
public CatalogDto get(@Nonnull final QualifiedName name) {
final MetacatCatalogConfig config = connectorManager.getCatalogConfig(name);
final CatalogDto result = new CatalogDto();
result.setName(name);
result.setType(config.getType());
final ConnectorContext context = converterUtil.toConnectorContext(MetacatContextManager.getContext());
result.setDatabases(connectorManager.getDatabaseService(name.getCatalogName()).listNames(context, name, null, null, null).stream().map(QualifiedName::getDatabaseName).filter(s -> config.getSchemaBlacklist().isEmpty() || !config.getSchemaBlacklist().contains(s)).filter(s -> config.getSchemaWhitelist().isEmpty() || config.getSchemaWhitelist().contains(s)).sorted(String.CASE_INSENSITIVE_ORDER).collect(Collectors.toList()));
userMetadataService.populateMetadata(result);
return result;
}
use of com.netflix.metacat.common.dto.CatalogDto in project metacat by Netflix.
the class ElasticSearchMetacatRefresh method _processCatalogs.
@SuppressWarnings("checkstyle:methodname")
private ListenableFuture<Void> _processCatalogs(final List<String> catalogNames) {
log.info("Start: Full refresh of catalogs: {}", catalogNames);
final List<ListenableFuture<CatalogDto>> getCatalogFutures = catalogNames.stream().map(catalogName -> service.submit(() -> {
CatalogDto result = null;
try {
result = getCatalog(catalogName);
} catch (Exception e) {
log.error("Failed to retrieve catalog: {}", catalogName);
elasticSearchUtil.log("ElasticSearchMetacatRefresh.getCatalog", ElasticSearchDoc.Type.catalog.name(), catalogName, null, e.getMessage(), e, true);
}
return result;
})).collect(Collectors.toList());
return Futures.transformAsync(Futures.successfulAsList(getCatalogFutures), input -> {
final List<ListenableFuture<Void>> processCatalogFutures = input.stream().filter(NOT_NULL).map(catalogDto -> {
final List<QualifiedName> databaseNames = getDatabaseNamesToRefresh(catalogDto);
return _processDatabases(catalogDto.getName(), databaseNames);
}).filter(NOT_NULL).collect(Collectors.toList());
return Futures.transform(Futures.successfulAsList(processCatalogFutures), Functions.constant(null));
});
}
Aggregations