use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class CatalogBundle method isCatalogProviderReady.
private boolean isCatalogProviderReady() {
CatalogProvider provider = getService(CatalogProvider.class);
CatalogFramework framework = getService(CatalogFramework.class);
if (framework != null && provider != null) {
SourceInfoRequestLocal sourceInfoRequestEnterprise = new SourceInfoRequestLocal(true);
try {
SourceInfoResponse sources = framework.getSourceInfo(sourceInfoRequestEnterprise);
return sources.getSourceInfo().stream().filter(descriptor -> descriptor.getSourceId().equals(provider.getId())).map(descriptor -> descriptor.isAvailable() && provider.isAvailable()).findFirst().orElse(false);
} catch (SourceUnavailableException ignored) {
}
}
return false;
}
Aggregations