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);
}
}
}
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();
}
}
}
Aggregations