use of ddf.catalog.event.EventException in project ddf by codice.
the class RegistryStorePublisher method registryPublish.
void registryPublish(RegistryStore registryStore, String publish) {
if (registryStore.getRegistryId().isEmpty()) {
LOGGER.info(String.format("RegistryStore missing id. Unable to complete %s request.", publish));
return;
}
executor.schedule(() -> {
try {
Security security = Security.getInstance();
Optional<Metacard> registryIdentityMetacardOpt = security.runAsAdminWithException(() -> federationAdminService.getLocalRegistryIdentityMetacard());
if (registryIdentityMetacardOpt.isPresent()) {
Metacard registryIdentityMetacard = registryIdentityMetacardOpt.get();
String localRegistryId = RegistryUtility.getRegistryId(registryIdentityMetacard);
if (localRegistryId == null) {
throw new EventException();
}
security.runAsAdminWithException(() -> {
if (publish.equals(PUBLISH)) {
registryPublicationService.publish(localRegistryId, registryStore.getRegistryId());
} else {
registryPublicationService.unpublish(localRegistryId, registryStore.getRegistryId());
}
return null;
});
}
} catch (Exception e) {
LOGGER.debug("Failed to {} registry configuration to {}", publish, ((RegistryStoreImpl) registryStore).getId());
}
}, 3, TimeUnit.SECONDS);
}
use of ddf.catalog.event.EventException in project ddf by codice.
the class ExceptionsTest method testEventException.
@Test
public void testEventException() {
EventException ee = new EventException();
assertNotNull(ee);
ee = new EventException(msg);
assertEquals(ee.getMessage(), msg);
ee = new EventException(testCause);
assertEquals(ee.getCause(), testCause);
ee = new EventException(msg, testCause);
assertEquals(ee.getMessage(), msg);
assertEquals(ee.getCause(), testCause);
}
Aggregations