Package gov.usgs.earthquake.indexer
Class ExternalPreferredListener
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.product.AbstractListener
-
- gov.usgs.earthquake.indexer.DefaultIndexerListener
-
- gov.usgs.earthquake.indexer.ExternalIndexerListener
-
- gov.usgs.earthquake.indexer.ExternalPreferredListener
-
- All Implemented Interfaces:
IndexerListener
,Configurable
public class ExternalPreferredListener extends ExternalIndexerListener
(Experimental) Notify external processes when preferred product change within events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExternalPreferredListener.PreferredAction
Types of preferred product actions.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PREFERRED_ACTION_ARGUMENT
Argument for Preferred action-
Fields inherited from class gov.usgs.earthquake.indexer.ExternalIndexerListener
AUTO_ARCHIVE_DEFAULT, AUTO_ARCHIVE_PROPERTY, COMMAND_PROPERTY, EVENT_ACTION_ARGUMENT, EVENT_IDS_ARGUMENT, PREFERRED_DEPTH_ARGUMENT, PREFERRED_EVENTSOURCE_ARGUMENT, PREFERRED_EVENTSOURCECODE_ARGUMENT, PREFERRED_ID_ARGUMENT, PREFERRED_LATITUDE_ARGUMENT, PREFERRED_LONGITUDE_ARGUMENT, PREFERRED_MAGNITUDE_ARGUMENT, PREFERRED_ORIGIN_TIME_ARGUMENT, SIGNATURE_ARGUMENT, STORAGE_DIRECTORY_PROPERTY, STORAGE_NAME_PROPERTY
-
Fields inherited from class gov.usgs.earthquake.indexer.DefaultIndexerListener
IGNORE_ARCHIVE_DEFAULT, IGNORE_ARCHIVE_PROPERTY, PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT, PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY, PROCESS_PREFERRED_ONLY_DEFAULT, PROCESS_PREFERRED_ONLY_PROPERTY, PROCESS_UNASSOCIATED_DEFAULT, PROCESS_UNASSOCIATED_PROPERTY
-
Fields inherited from class gov.usgs.earthquake.product.AbstractListener
ATTEMPT_COUNT_PROPERTY, DEFAULT_ATTEMPT_COUNT, DEFAULT_RETRY_DELAY, DEFAULT_TIMEOUT, EXCLUDE_SOURCES_PROPERTY, EXCLUDE_TYPES_PROPERTY, INCLUDE_ACTUALS_PROPERTY, INCLUDE_DEVELOPMENTS_PROPERTY, INCLUDE_INTERNALS_PROPERTY, INCLUDE_SCENARIOS_PROPERTY, INCLUDE_SOURCES_PROPERTY, INCLUDE_TESTS_PROPERTY, INCLUDE_TYPES_PROPERTY, MAX_TRIES_PROPERTY, RETRY_DELAY_PROPERTY, TIMEOUT_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description ExternalPreferredListener()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(IndexerEvent event)
Skip parent class processing, except autoArchiving.static java.util.Map<ProductSummary,ExternalPreferredListener.PreferredAction>
getIndexerChangePreferredActions(IndexerChange change)
Compare preferred products before/after IndexerChange was applied.static java.util.Map<java.lang.String,ProductSummary>
getPreferredProducts(Event event)
Get a map of preferred products from an event.void
onIndexerEvent(IndexerEvent event)
Handle indexer events.-
Methods inherited from class gov.usgs.earthquake.indexer.ExternalIndexerListener
configure, getCommand, getEventArguments, getProductSummaryArguments, getProductSummaryCommand, getProductSummaryCommand, getStorage, isAutoArchive, runProductCommand, setAutoArchive, setCommand, setStorage, shutdown, startup, storeProduct
-
Methods inherited from class gov.usgs.earthquake.indexer.DefaultIndexerListener
accept, getProcessOnlyPreferredProducts, getProcessUnassociatedProducts, isIgnoreArchive, isProcessOnlyWhenEventChanged, setIgnoreArchive, setProcessOnlyPreferredProducts, setProcessOnlyWhenEventChanged, setProcessUnassociatedProducts
-
Methods inherited from class gov.usgs.earthquake.product.AbstractListener
accept, getExcludeSources, getExcludeTypes, getIncludeSources, getIncludeTypes, getMaxTries, getRetryDelay, getTimeout, isIncludeActuals, isIncludeDevelopments, isIncludeInternals, isIncludeScenarios, isIncludeTests, setIncludeActuals, setIncludeDevelopments, setIncludeInternals, setIncludeScenarios, setIncludeTests, setMaxTries, setRetryDelay, setTimeout
-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.usgs.util.Configurable
getName, setName
-
Methods inherited from interface gov.usgs.earthquake.indexer.IndexerListener
getMaxTries, getTimeout
-
-
-
-
Field Detail
-
PREFERRED_ACTION_ARGUMENT
public static final java.lang.String PREFERRED_ACTION_ARGUMENT
Argument for Preferred action- See Also:
- Constant Field Values
-
-
Method Detail
-
accept
public boolean accept(IndexerEvent event)
Skip parent class processing, except autoArchiving.- Overrides:
accept
in classDefaultIndexerListener
- Parameters:
event
- the indexer event that has occurred- Returns:
- whether this external indexer listener handles this product type
-
onIndexerEvent
public void onIndexerEvent(IndexerEvent event) throws java.lang.Exception
Handle indexer events.- Specified by:
onIndexerEvent
in interfaceIndexerListener
- Overrides:
onIndexerEvent
in classExternalIndexerListener
- Parameters:
event
- description of the change.- Throws:
java.lang.Exception
- if error occurs
-
getIndexerChangePreferredActions
public static java.util.Map<ProductSummary,ExternalPreferredListener.PreferredAction> getIndexerChangePreferredActions(IndexerChange change)
Compare preferred products before/after IndexerChange was applied.- Parameters:
change
- indexer change to evaluate.- Returns:
- map of preferred products that were changed.
-
getPreferredProducts
public static java.util.Map<java.lang.String,ProductSummary> getPreferredProducts(Event event)
Get a map of preferred products from an event.- Parameters:
event
- the event.- Returns:
- preferred products, or empty hashmap if event is null.
-
-