use of ddf.catalog.source.SourceUnavailableException in project ddf by codice.
the class CatalogBundle method isFederatedSourceReady.
private boolean isFederatedSourceReady(String id) throws InvalidSyntaxException {
CatalogFramework framework = getService(CatalogFramework.class);
FederatedSource source = serviceManager.getServiceReferences(FederatedSource.class, null).stream().map(serviceManager::getService).filter(src -> id.equals(src.getId())).findFirst().orElse(null);
if (source != null && framework != null) {
SourceInfoRequestEnterprise request = new SourceInfoRequestEnterprise(true);
try {
SourceInfoResponse sources = framework.getSourceInfo(request);
return sources.getSourceInfo().stream().filter(descriptor -> descriptor.getSourceId().equals(source.getId())).map(descriptor -> descriptor.isAvailable() && source.isAvailable()).findFirst().orElse(false);
} catch (SourceUnavailableException ignore) {
}
}
return false;
}
use of ddf.catalog.source.SourceUnavailableException in project ddf by codice.
the class DuplicationValidator method query.
private SourceResponse query(Set<Attribute> attributes) {
final Filter filter = filterBuilder.allOf(filterBuilder.anyOf(buildFilters(attributes)));
LOGGER.debug("filter {}", filter);
QueryImpl query = new QueryImpl(filter);
query.setRequestsTotalResultsCount(false);
QueryRequest request = new QueryRequestImpl(query);
SourceResponse response = null;
try {
response = catalogFramework.query(request);
} catch (FederationException | SourceUnavailableException | UnsupportedQueryException e) {
LOGGER.debug("Query failed ", e);
}
return response;
}
Aggregations