Search in sources :

Example 6 with SourceMonitor

use of ddf.catalog.source.SourceMonitor in project ddf by codice.

the class RegistryStorePublisher method bindRegistryStore.

public void bindRegistryStore(ServiceReference<RegistryStore> reference) {
    BundleContext bundleContext = getBundleContext();
    if (reference == null || bundleContext == null || bundleContext.getService(reference) == null) {
        return;
    }
    RegistryStore registryStore = bundleContext.getService(reference);
    Boolean previousState = registryStoreMap.put(registryStore.getConfigurationPid(), registryStore.isAutoPush());
    SourceMonitor storeRegisteredSourceMonitor = new SourceMonitor() {

        @Override
        public void setAvailable() {
            if (registryStore.isAutoPush()) {
                registryPublish(registryStore, PUBLISH);
            }
        }

        @Override
        public void setUnavailable() {
        }
    };
    if (registryStore.isAvailable(storeRegisteredSourceMonitor) && registryStore.isAutoPush()) {
        if (previousState == null || !previousState) {
            registryPublish(registryStore, PUBLISH);
        }
    }
}
Also used : RegistryStore(org.codice.ddf.registry.api.internal.RegistryStore) SourceMonitor(ddf.catalog.source.SourceMonitor) BundleContext(org.osgi.framework.BundleContext)

Example 7 with SourceMonitor

use of ddf.catalog.source.SourceMonitor in project ddf by codice.

the class WfsSource method availabilityChanged.

private void availabilityChanged(boolean isAvailable) {
    if (isAvailable) {
        LOGGER.debug("WFS source {} is available.", getId());
    } else {
        LOGGER.debug("WFS source {} is unavailable.", getId());
    }
    for (SourceMonitor monitor : this.sourceMonitors) {
        if (isAvailable) {
            LOGGER.debug("Notifying source monitor that WFS source {} is available.", getId());
            monitor.setAvailable();
        } else {
            LOGGER.debug("Notifying source monitor that WFS source {} is unavailable.", getId());
            monitor.setUnavailable();
        }
    }
}
Also used : SourceMonitor(ddf.catalog.source.SourceMonitor)

Aggregations

SourceMonitor (ddf.catalog.source.SourceMonitor)7 SourceResponse (ddf.catalog.operation.SourceResponse)2 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)2 Response (javax.ws.rs.core.Response)2 ResourceResponse (ddf.catalog.operation.ResourceResponse)1 ResourceNotFoundException (ddf.catalog.resource.ResourceNotFoundException)1 ResourceNotSupportedException (ddf.catalog.resource.ResourceNotSupportedException)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 IOException (java.io.IOException)1 Date (java.util.Date)1 WebClient (org.apache.cxf.jaxrs.client.WebClient)1 RegistryStore (org.codice.ddf.registry.api.internal.RegistryStore)1 Test (org.junit.Test)1 BundleContext (org.osgi.framework.BundleContext)1