Search in sources :

Example 1 with SubscriptionNotFoundException

use of ddf.catalog.event.SubscriptionNotFoundException in project ddf by codice.

the class ExceptionsTest method testSubscriptionNotFoundException.

@Test
public void testSubscriptionNotFoundException() {
    SubscriptionNotFoundException snfe = new SubscriptionNotFoundException(msg);
    assertEquals(snfe.getMessage(), msg);
    snfe = new SubscriptionNotFoundException(testCause);
    assertEquals(snfe.getCause(), testCause);
    snfe = new SubscriptionNotFoundException(msg, testCause);
    assertEquals(snfe.getMessage(), msg);
    assertEquals(snfe.getCause(), testCause);
}
Also used : SubscriptionNotFoundException(ddf.catalog.event.SubscriptionNotFoundException) Test(org.junit.Test)

Example 2 with SubscriptionNotFoundException

use of ddf.catalog.event.SubscriptionNotFoundException in project ddf by codice.

the class EventProcessorImpl method updateSubscription.

@Override
public void updateSubscription(Subscription subscription, String subscriptionId) throws SubscriptionNotFoundException {
    String methodName = "updateSubscription";
    LOGGER.debug("ENTERING: {}", methodName);
    try {
        deleteSubscription(subscriptionId);
        createSubscription(subscription, subscriptionId);
        LOGGER.debug("Updated {}", subscriptionId);
    } catch (Exception e) {
        LOGGER.info("Could not update subscription", e);
        throw new SubscriptionNotFoundException(e);
    }
    LOGGER.debug("EXITING: {}", methodName);
}
Also used : SubscriptionNotFoundException(ddf.catalog.event.SubscriptionNotFoundException) SubscriptionNotFoundException(ddf.catalog.event.SubscriptionNotFoundException) SubscriptionExistsException(ddf.catalog.event.SubscriptionExistsException) PluginExecutionException(ddf.catalog.plugin.PluginExecutionException) InvalidSubscriptionException(ddf.catalog.event.InvalidSubscriptionException)

Example 3 with SubscriptionNotFoundException

use of ddf.catalog.event.SubscriptionNotFoundException in project ddf by codice.

the class EventProcessorImpl method deleteSubscription.

@Override
public void deleteSubscription(String subscriptionId) throws SubscriptionNotFoundException {
    String methodName = "deleteSubscription";
    LOGGER.debug("ENTERING: {}", methodName);
    try {
        LOGGER.debug("Removing subscription: {}", subscriptionId);
        ServiceRegistration sr = (ServiceRegistration) existingSubscriptions.get(subscriptionId);
        if (sr != null) {
            sr.unregister();
            LOGGER.debug("Removal complete");
            existingSubscriptions.remove(subscriptionId);
        } else {
            LOGGER.debug("Unable to find existing subscription: {}.  May already be deleted.", subscriptionId);
        }
    } catch (Exception e) {
        LOGGER.debug("Could not delete subscription for {}", subscriptionId);
        LOGGER.info("Exception deleting subscription", e);
    }
    LOGGER.debug("EXITING: " + methodName);
}
Also used : SubscriptionNotFoundException(ddf.catalog.event.SubscriptionNotFoundException) SubscriptionExistsException(ddf.catalog.event.SubscriptionExistsException) PluginExecutionException(ddf.catalog.plugin.PluginExecutionException) InvalidSubscriptionException(ddf.catalog.event.InvalidSubscriptionException) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

SubscriptionNotFoundException (ddf.catalog.event.SubscriptionNotFoundException)3 InvalidSubscriptionException (ddf.catalog.event.InvalidSubscriptionException)2 SubscriptionExistsException (ddf.catalog.event.SubscriptionExistsException)2 PluginExecutionException (ddf.catalog.plugin.PluginExecutionException)2 Test (org.junit.Test)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1