public class EventProcessorImpl extends Object implements EventProcessor, org.osgi.service.event.EventHandler, PostIngestPlugin
| Modifier and Type | Class and Description |
|---|---|
static class |
EventProcessorImpl.DateType
Enumeration of metacard Date attributes that can be used for subscriptions.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.osgi.framework.BundleContext |
bundleContext |
protected CatalogFramework |
catalog |
static double |
EQUATORIAL_RADIUS_IN_METERS |
protected org.osgi.service.event.EventAdmin |
eventAdmin |
protected List<PreDeliveryPlugin> |
preDelivery |
protected List<PreSubscriptionPlugin> |
preSubscription |
EVENT_METACARD, EVENT_OLD_METACARD, EVENT_TIME, EVENTS_TOPIC_CREATED, EVENTS_TOPIC_DELETED, EVENTS_TOPIC_UPDATED| Constructor and Description |
|---|
EventProcessorImpl() |
EventProcessorImpl(org.osgi.framework.BundleContext bundleContext,
org.osgi.service.event.EventAdmin eventAdmin,
List<PreSubscriptionPlugin> preSubscription,
List<PreDeliveryPlugin> preDelivery,
CatalogFramework catalog) |
| Modifier and Type | Method and Description |
|---|---|
String |
createSubscription(Subscription subscription)
Create a
Subscription with an automatically-generated id. |
void |
createSubscription(Subscription subscription,
String subscriptionId)
Register a
Subscription with this CatalogFramework. |
void |
deleteSubscription(String subscriptionId)
Deletes the subscription associated with the given id.
|
void |
destroy() |
void |
handleEvent(org.osgi.service.event.Event event)
By default the Felix EventAdmin implementation has a timeout of 5000 ms.
|
void |
init() |
void |
notifyCreated(Metacard newMetacard)
|
void |
notifyDeleted(Metacard oldMetacard)
|
void |
notifyUpdated(Metacard newMetacard,
Metacard oldMetacard)
|
protected void |
postEvent(String topic,
Metacard card,
Metacard oldCard)
Posts a Metacard to a given topic
|
CreateResponse |
process(CreateResponse createResponse)
Processes the
CreateResponse. |
DeleteResponse |
process(DeleteResponse deleteResponse)
Processes the
DeleteResponse. |
UpdateResponse |
process(UpdateResponse updateResponse)
Processes the
UpdateResponse. |
static void |
processEntry(Metacard metacard,
String operation,
org.osgi.service.event.EventAdmin eventAdmin)
Processes an entry by adding properties from the metacard to the event.
|
void |
updateSubscription(Subscription subscription,
String subscriptionId)
Updates the subscription associated with the given id.
|
public static final double EQUATORIAL_RADIUS_IN_METERS
protected org.osgi.service.event.EventAdmin eventAdmin
protected org.osgi.framework.BundleContext bundleContext
protected List<PreSubscriptionPlugin> preSubscription
protected List<PreDeliveryPlugin> preDelivery
protected CatalogFramework catalog
public EventProcessorImpl()
public EventProcessorImpl(org.osgi.framework.BundleContext bundleContext,
org.osgi.service.event.EventAdmin eventAdmin,
List<PreSubscriptionPlugin> preSubscription,
List<PreDeliveryPlugin> preDelivery,
CatalogFramework catalog)
public static void processEntry(Metacard metacard, String operation, org.osgi.service.event.EventAdmin eventAdmin)
metacard - - the metacard to processoperation - - The type of event PubSubConstantseventAdmin - - OSGi EventAdmin service used post eventspublic void init()
public void destroy()
public void handleEvent(org.osgi.service.event.Event event)
handleEvent in interface org.osgi.service.event.EventHandlerpublic String createSubscription(Subscription subscription) throws InvalidSubscriptionException
EventProcessorSubscription with an automatically-generated id.createSubscription in interface EventProcessorsubscription - the Subscription to registerString an id for the registered Subscription that can be used later by
calling #unsubscribe(String)InvalidSubscriptionException - if this EventProcessor can not support the Filter of the provided Subscription.EventProcessor.createSubscription(Subscription, String)public void createSubscription(Subscription subscription, String subscriptionId) throws InvalidSubscriptionException, SubscriptionExistsException
EventProcessorSubscription with this CatalogFramework.
Note: Subscriptions are transient, not durable, i.e., only maintained in
memory and will be lost if DDF is shutdown.
Durability must be implemented by the client bundle (typically an endpoint - refer to DurableSubscription for an example).
Note: A Subscription can also be registered using the whiteboard
model:
To register a Subscription via the whiteboard model, simply register any implementation
of Subscription with OSGi registry under the interface Subscription. To
unregister the Subscription, simply unregister the service that was originally
registered. Subscriptions registered in this manner do not get a subscription id and
cannot be unsubscribed via the EventProcessor Implementations of this method
must call the PreSubscriptionPlugin.process(Subscription)
method for each
createSubscription in interface EventProcessorsubscription - the Subscription to registersubscriptionId - the desired idInvalidSubscriptionException - if this EventProcessor can not support the Filter of the provided Subscription.SubscriptionExistsException - if a subscription with this ID already existspublic void updateSubscription(Subscription subscription, String subscriptionId) throws SubscriptionNotFoundException
EventProcessorupdateSubscription in interface EventProcessorsubscription - the subscription to updatesubscriptionId - the subscription id to identify the subscriptionSubscriptionNotFoundException - if the subscription was not foundpublic void deleteSubscription(String subscriptionId) throws SubscriptionNotFoundException
EventProcessordeleteSubscription in interface EventProcessorsubscriptionId - the subscription id to identify the subscription to deleteSubscriptionNotFoundException - if the subscription was not foundpublic void notifyCreated(Metacard newMetacard)
EventProcessorEventProcessor that a Metacard (or equivalent) has been created in
a RemoteSource.
Implementations of this method must:
PreDeliveryPlugin.processCreate(Metacard) method for
all of the registered PreDeliveryPlugins
DeliveryMethod.created(Metacard) method of the DeliveryMethod of
matching Subscriptions with the new Metacard created.
notifyCreated in interface EventProcessornewMetacard - the newly created MetacardRemoteSource,
FederatedSource,
ConnectedSourcepublic void notifyUpdated(Metacard newMetacard, Metacard oldMetacard)
EventProcessorEventProcessor that a Metacard (or equivalent) has been updated in
a RemoteSource.
Implementations of this method must:
PreDeliveryPlugin.processUpdateHit(ddf.catalog.operation.Update)
method of all registered PreDeliveryPlugins when a Metacard has been updated and the new version matches a Subscription
Call PreDeliveryPlugin.processUpdateMiss(ddf.catalog.operation.Update)
method of all registered PreDeliveryPlugins when a Metacard has been updated and the new version matches a Subscription but the old
version does not
DeliveryMethod with the updated Metacard.
notifyUpdated in interface EventProcessornewMetacard - the new version of the MetacardoldMetacard - the previous version of the Metacard (optional, pass null if
not relevant)FederatedSource,
RemoteSource,
ConnectedSourcepublic void notifyDeleted(Metacard oldMetacard)
EventProcessorEventProcessor that a Metacard (or equivalent) has been deleted in
a RemoteSource.
Implementations of this method must:
Metacard is fully populated) call all active matching
Subscriptions associated DeliveryMethod.deleted(Metacard) with the Metacard that was deleted.
Metacard only has Metacard.getId(), call all
active Subscriptions.
notifyDeleted in interface EventProcessoroldMetacard - the deleted MetacardRemoteSource,
FederatedSource,
ConnectedSourceprotected void postEvent(String topic, Metacard card, Metacard oldCard)
topic - - The topic to post the eventcard - - The Metacard that will be posted to the topicpublic CreateResponse process(CreateResponse createResponse) throws PluginExecutionException
PostIngestPluginCreateResponse.process in interface PostIngestPlugincreateResponse - the CreateResponse to processCreateResponse to pass to the next PostIngestPlugin, or if this is the last PostIngestPlugin to be calledPluginExecutionException - thrown when an error occurs during processingpublic UpdateResponse process(UpdateResponse updateResponse) throws PluginExecutionException
PostIngestPluginUpdateResponse.process in interface PostIngestPluginupdateResponse - the UpdateResponse to processUpdateResponse to pass to the next PostIngestPlugin, or if this is the last PostIngestPlugin to be calledPluginExecutionException - thrown when an error occurs during processingpublic DeleteResponse process(DeleteResponse deleteResponse) throws PluginExecutionException
PostIngestPluginDeleteResponse.process in interface PostIngestPlugindeleteResponse - the DeleteResponse to processDeleteResponse to pass to the next PostIngestPlugin, or if this is the last PostIngestPlugin to be calledPluginExecutionException - thrown when an error occurs during processingThis work is licensed under a Creative Commons Attribution 4.0 International License.