Search in sources :

Example 41 with CatalogProvider

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;
}
Also used : SourceInfoResponse(ddf.catalog.operation.SourceInfoResponse) Awaitility.await(org.awaitility.Awaitility.await) SourceInfoRequestLocal(ddf.catalog.operation.impl.SourceInfoRequestLocal) Logger(org.slf4j.Logger) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) CatalogFramework(ddf.catalog.CatalogFramework) FederatedSource(ddf.catalog.source.FederatedSource) SourceInfoRequestEnterprise(ddf.catalog.operation.impl.SourceInfoRequestEnterprise) LoggerFactory(org.slf4j.LoggerFactory) IOException(java.io.IOException) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) CatalogProvider(ddf.catalog.source.CatalogProvider) Configuration(org.osgi.service.cm.Configuration) Map(java.util.Map) Optional(java.util.Optional) DictionaryMap(org.codice.ddf.configuration.DictionaryMap) ServiceReference(org.osgi.framework.ServiceReference) SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) CatalogProvider(ddf.catalog.source.CatalogProvider) CatalogFramework(ddf.catalog.CatalogFramework) SourceInfoRequestLocal(ddf.catalog.operation.impl.SourceInfoRequestLocal) SourceInfoResponse(ddf.catalog.operation.SourceInfoResponse)

Aggregations

CatalogProvider (ddf.catalog.source.CatalogProvider)41 Test (org.junit.Test)26 QueryRequest (ddf.catalog.operation.QueryRequest)13 ArrayList (java.util.ArrayList)9 Result (ddf.catalog.data.Result)8 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)8 FederatedSource (ddf.catalog.source.FederatedSource)8 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)8 Metacard (ddf.catalog.data.Metacard)7 QueryResponse (ddf.catalog.operation.QueryResponse)7 CatalogFramework (ddf.catalog.CatalogFramework)6 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)6 Source (ddf.catalog.source.Source)6 ByteSource (com.google.common.io.ByteSource)5 FederationStrategy (ddf.catalog.federation.FederationStrategy)5 Query (ddf.catalog.operation.Query)5 QueryImpl (ddf.catalog.operation.impl.QueryImpl)5 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)4 FederationException (ddf.catalog.federation.FederationException)4 QueryOperations (ddf.catalog.impl.operations.QueryOperations)4