Class EventProcessorImpl

java.lang.Object
ddf.catalog.pubsub.EventProcessorImpl
All Implemented Interfaces:
ddf.catalog.event.EventProcessor, ddf.catalog.plugin.PostIngestPlugin, org.osgi.service.event.EventHandler
Direct Known Subclasses:
FanoutEventProcessor

public class EventProcessorImpl extends Object implements ddf.catalog.event.EventProcessor, org.osgi.service.event.EventHandler, ddf.catalog.plugin.PostIngestPlugin
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enumeration of metacard Date attributes that can be used for subscriptions.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.osgi.framework.BundleContext
     
    protected ddf.catalog.CatalogFramework
     
    static final String
     
    static final double
     
    protected org.osgi.service.event.EventAdmin
     
    static final String
     
    protected List<ddf.catalog.plugin.PreDeliveryPlugin>
     
    protected List<ddf.catalog.plugin.PreSubscriptionPlugin>
     

    Fields inherited from interface ddf.catalog.event.EventProcessor

    EVENT_METACARD, EVENT_OLD_METACARD, EVENT_TIME, EVENTS_TOPIC_CREATED, EVENTS_TOPIC_DELETED, EVENTS_TOPIC_UPDATED
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    EventProcessorImpl(org.osgi.framework.BundleContext bundleContext, org.osgi.service.event.EventAdmin eventAdmin, List<ddf.catalog.plugin.PreSubscriptionPlugin> preSubscription, List<ddf.catalog.plugin.PreDeliveryPlugin> preDelivery, ddf.catalog.CatalogFramework catalog)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createSubscription(ddf.catalog.event.Subscription subscription)
     
    void
    createSubscription(ddf.catalog.event.Subscription subscription, String subscriptionId)
     
    void
    deleteSubscription(String subscriptionId)
     
    void
     
    void
    handleEvent(org.osgi.service.event.Event event)
    By default the Felix EventAdmin implementation has a timeout of 5000 ms.
    void
     
    void
    notifyCreated(ddf.catalog.data.Metacard newMetacard)
     
    void
    notifyDeleted(ddf.catalog.data.Metacard oldMetacard)
     
    void
    notifyUpdated(ddf.catalog.data.Metacard newMetacard, ddf.catalog.data.Metacard oldMetacard)
     
    protected void
    postEvent(String topic, ddf.catalog.data.Metacard card)
    Posts a Metacard to a given topic
    ddf.catalog.operation.CreateResponse
    process(ddf.catalog.operation.CreateResponse createResponse)
     
    ddf.catalog.operation.DeleteResponse
    process(ddf.catalog.operation.DeleteResponse deleteResponse)
     
    ddf.catalog.operation.UpdateResponse
    process(ddf.catalog.operation.UpdateResponse updateResponse)
     
    static void
    processEntry(ddf.catalog.data.Metacard metacard, String operation, org.osgi.service.event.EventAdmin eventAdmin)
    Processes an entry by adding properties from the metacard to the event.
    void
    updateSubscription(ddf.catalog.event.Subscription subscription, String subscriptionId)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EQUATORIAL_RADIUS_IN_METERS

      public static final double EQUATORIAL_RADIUS_IN_METERS
      See Also:
    • ENTERING

      public static final String ENTERING
      See Also:
    • EXITING

      public static final String EXITING
      See Also:
    • eventAdmin

      protected org.osgi.service.event.EventAdmin eventAdmin
    • bundleContext

      protected org.osgi.framework.BundleContext bundleContext
    • preSubscription

      protected List<ddf.catalog.plugin.PreSubscriptionPlugin> preSubscription
    • preDelivery

      protected List<ddf.catalog.plugin.PreDeliveryPlugin> preDelivery
    • catalog

      protected ddf.catalog.CatalogFramework catalog
  • Constructor Details

    • EventProcessorImpl

      public EventProcessorImpl()
    • EventProcessorImpl

      public EventProcessorImpl(org.osgi.framework.BundleContext bundleContext, org.osgi.service.event.EventAdmin eventAdmin, List<ddf.catalog.plugin.PreSubscriptionPlugin> preSubscription, List<ddf.catalog.plugin.PreDeliveryPlugin> preDelivery, ddf.catalog.CatalogFramework catalog)
  • Method Details

    • processEntry

      public static void processEntry(ddf.catalog.data.Metacard metacard, String operation, org.osgi.service.event.EventAdmin eventAdmin)
      Processes an entry by adding properties from the metacard to the event. Then the eventAdmin is used to post the metacard properties as a single event.
      Parameters:
      metacard - - the metacard to process
      operation - - The type of event PubSubConstants
      eventAdmin - - OSGi EventAdmin service used post events
    • init

      public void init()
    • destroy

      public void destroy()
    • handleEvent

      public void handleEvent(org.osgi.service.event.Event event)
      By default the Felix EventAdmin implementation has a timeout of 5000 ms. Your event handler has to return from the handle event method in this time frame. If it does not, it gets Blacklisted. Therefore, this method processes its events in a separate thread than the EventAdmin who called it.
      Specified by:
      handleEvent in interface org.osgi.service.event.EventHandler
    • createSubscription

      public String createSubscription(ddf.catalog.event.Subscription subscription) throws ddf.catalog.event.InvalidSubscriptionException
      Specified by:
      createSubscription in interface ddf.catalog.event.EventProcessor
      Throws:
      ddf.catalog.event.InvalidSubscriptionException
    • createSubscription

      public void createSubscription(ddf.catalog.event.Subscription subscription, String subscriptionId) throws ddf.catalog.event.InvalidSubscriptionException, ddf.catalog.event.SubscriptionExistsException
      Specified by:
      createSubscription in interface ddf.catalog.event.EventProcessor
      Throws:
      ddf.catalog.event.InvalidSubscriptionException
      ddf.catalog.event.SubscriptionExistsException
    • updateSubscription

      public void updateSubscription(ddf.catalog.event.Subscription subscription, String subscriptionId) throws ddf.catalog.event.SubscriptionNotFoundException
      Specified by:
      updateSubscription in interface ddf.catalog.event.EventProcessor
      Throws:
      ddf.catalog.event.SubscriptionNotFoundException
    • deleteSubscription

      public void deleteSubscription(String subscriptionId) throws ddf.catalog.event.SubscriptionNotFoundException
      Specified by:
      deleteSubscription in interface ddf.catalog.event.EventProcessor
      Throws:
      ddf.catalog.event.SubscriptionNotFoundException
    • notifyCreated

      public void notifyCreated(ddf.catalog.data.Metacard newMetacard)
      Specified by:
      notifyCreated in interface ddf.catalog.event.EventProcessor
    • notifyUpdated

      public void notifyUpdated(ddf.catalog.data.Metacard newMetacard, ddf.catalog.data.Metacard oldMetacard)
      Specified by:
      notifyUpdated in interface ddf.catalog.event.EventProcessor
    • notifyDeleted

      public void notifyDeleted(ddf.catalog.data.Metacard oldMetacard)
      Specified by:
      notifyDeleted in interface ddf.catalog.event.EventProcessor
    • postEvent

      protected void postEvent(String topic, ddf.catalog.data.Metacard card)
      Posts a Metacard to a given topic
      Parameters:
      topic - - The topic to post the event
      card - - The Metacard that will be posted to the topic
    • process

      public ddf.catalog.operation.CreateResponse process(ddf.catalog.operation.CreateResponse createResponse) throws ddf.catalog.plugin.PluginExecutionException
      Specified by:
      process in interface ddf.catalog.plugin.PostIngestPlugin
      Throws:
      ddf.catalog.plugin.PluginExecutionException
    • process

      public ddf.catalog.operation.UpdateResponse process(ddf.catalog.operation.UpdateResponse updateResponse) throws ddf.catalog.plugin.PluginExecutionException
      Specified by:
      process in interface ddf.catalog.plugin.PostIngestPlugin
      Throws:
      ddf.catalog.plugin.PluginExecutionException
    • process

      public ddf.catalog.operation.DeleteResponse process(ddf.catalog.operation.DeleteResponse deleteResponse) throws ddf.catalog.plugin.PluginExecutionException
      Specified by:
      process in interface ddf.catalog.plugin.PostIngestPlugin
      Throws:
      ddf.catalog.plugin.PluginExecutionException