use of org.osgi.framework.ServiceEvent in project ddf by codice.
the class RegistryStorePublisher method handleEvent.
@Override
public void handleEvent(Event event) {
if (((ServiceEvent) event.getProperty(EventConstants.EVENT)).getType() != ServiceEvent.MODIFIED) {
return;
}
String pid = event.getProperty(Constants.SERVICE_PID).toString();
Boolean previousAutoPush = registryStoreMap.get(pid);
if (previousAutoPush == null) {
return;
}
BundleContext bundleContext = getBundleContext();
if (bundleContext == null) {
return;
}
RegistryStore registryStore = (RegistryStore) bundleContext.getService(((ServiceEvent) event.getProperty(EventConstants.EVENT)).getServiceReference());
if (!previousAutoPush && registryStore.isAutoPush()) {
registryPublish(registryStore, PUBLISH);
registryStoreMap.put(pid, true);
} else if (previousAutoPush && !registryStore.isAutoPush()) {
registryPublish(registryStore, UNPUBLISH);
registryStoreMap.put(pid, false);
}
}
Aggregations