Package gov.usgs.earthquake.indexer
Class DefaultIndexerListener
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.product.AbstractListener
gov.usgs.earthquake.indexer.DefaultIndexerListener
- All Implemented Interfaces:
IndexerListener
,Configurable
- Direct Known Subclasses:
ExternalIndexerListener
,ReliableIndexerListener
DefaultIndexerListener provides a starting point from which all
IndexerListeners may extend.
As a child-class of the AbstractListener, this may be configured with all of
the parent parameters and also accepts the following:
- command
- (Required) The command to execute. This must be an executable command and may include arguments. Any product-specific arguments are appended at the end of command.
- storage
- (Required) A directory used to store all products. Each product is extracted into a separate directory within this directory and is referenced by the --directory=/path/to/directory argument when command is executed.
- processUnassociated
- (Optional, Default = false) Whether or not to process unassociated products. Valid values are "true" and "false".
- processPreferredOnly
- (Optional, Default = false) Whether or not to process only preferred products of the type accepted by this listener. Valid values are "true" and "false".
- ignoreArchive
- (Optional, Default = false) Whether or not to ignore EVENT_ARCHIVED and PRODUCT_ARCHIVED indexer events. Value values are "true" and "false".
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Default state of ignore archivestatic final String
Property for Ignore archivestatic final String
Default state of process only when event changestatic final String
Property for process only when event changestatic final String
Default state of process preferred onlystatic final String
Property for process preferred onlystatic final String
Default state of process unassociatedstatic final String
Property for process unassociatedFields 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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(IndexerEvent change) boolean
accept
(IndexerEvent event, IndexerChange change) Returns a boolean based on if the preferred event params have changed Returns false if change is an archive indexervoid
Read the include and exclude types from config.boolean
boolean
boolean
boolean
void
onIndexerEvent
(IndexerEvent event) This method is called when the indexer makes a change to the ProductIndex.void
setIgnoreArchive
(boolean ignoreArchive) void
setProcessOnlyPreferredProducts
(boolean processOnlyPreferredProducts) void
setProcessOnlyWhenEventChanged
(boolean processOnlyWhenEventChanged) void
setProcessUnassociatedProducts
(boolean processUnassociatedProducts) 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, shutdown, startup
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, shutdown, startup
Methods inherited from interface gov.usgs.earthquake.indexer.IndexerListener
getMaxTries, getTimeout
-
Field Details
-
PROCESS_PREFERRED_ONLY_PROPERTY
Property for process preferred only- See Also:
-
PROCESS_PREFERRED_ONLY_DEFAULT
Default state of process preferred only- See Also:
-
PROCESS_UNASSOCIATED_PROPERTY
Property for process unassociated- See Also:
-
PROCESS_UNASSOCIATED_DEFAULT
Default state of process unassociated- See Also:
-
PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY
Property for process only when event change- See Also:
-
PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT
Default state of process only when event change- See Also:
-
IGNORE_ARCHIVE_PROPERTY
Property for Ignore archive- See Also:
-
IGNORE_ARCHIVE_DEFAULT
Default state of ignore archive- See Also:
-
-
Constructor Details
-
DefaultIndexerListener
public DefaultIndexerListener()
-
-
Method Details
-
onIndexerEvent
Description copied from interface:IndexerListener
This method is called when the indexer makes a change to the ProductIndex.- Specified by:
onIndexerEvent
in interfaceIndexerListener
- Parameters:
event
- description of the change.- Throws:
Exception
- if error occurs
-
accept
- Parameters:
change
- the indexer event that has occurred- Returns:
- whether this external indexer listener handles this product type
- Throws:
Exception
- if error occurs
-
accept
Returns a boolean based on if the preferred event params have changed Returns false if change is an archive indexer- Parameters:
event
- an IndexerEventchange
- and IndexerChange- Returns:
- boolean
- Throws:
Exception
- if error occurs
-
configure
Description copied from class:AbstractListener
Read the include and exclude types from config.- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractListener
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
getProcessOnlyPreferredProducts
public boolean getProcessOnlyPreferredProducts()- Returns:
- whether only preferred products are processed
-
setProcessOnlyPreferredProducts
public void setProcessOnlyPreferredProducts(boolean processOnlyPreferredProducts) - Parameters:
processOnlyPreferredProducts
- whether to process ony preferred products
-
setProcessUnassociatedProducts
public void setProcessUnassociatedProducts(boolean processUnassociatedProducts) - Parameters:
processUnassociatedProducts
- to set
-
getProcessUnassociatedProducts
public boolean getProcessUnassociatedProducts()- Returns:
- boolean processUnassociatedProducts
-
isProcessOnlyWhenEventChanged
public boolean isProcessOnlyWhenEventChanged()- Returns:
- boolean processOnlyWhenEventChanged
-
setProcessOnlyWhenEventChanged
public void setProcessOnlyWhenEventChanged(boolean processOnlyWhenEventChanged) - Parameters:
processOnlyWhenEventChanged
- to set
-
isIgnoreArchive
public boolean isIgnoreArchive()- Returns:
- ignoreArchive
-
setIgnoreArchive
public void setIgnoreArchive(boolean ignoreArchive) - Parameters:
ignoreArchive
- to set
-