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
public class DefaultIndexerListener extends AbstractListener implements IndexerListener
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
Fields Modifier and Type Field Description static java.lang.String
IGNORE_ARCHIVE_DEFAULT
Default state of ignore archivestatic java.lang.String
IGNORE_ARCHIVE_PROPERTY
Property for Ignore archivestatic java.lang.String
PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT
Default state of process only when event changestatic java.lang.String
PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY
Property for process only when event changestatic java.lang.String
PROCESS_PREFERRED_ONLY_DEFAULT
Default state of process preferred onlystatic java.lang.String
PROCESS_PREFERRED_ONLY_PROPERTY
Property for process preferred onlystatic java.lang.String
PROCESS_UNASSOCIATED_DEFAULT
Default state of process unassociatedstatic java.lang.String
PROCESS_UNASSOCIATED_PROPERTY
Property for process unassociated-
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 DefaultIndexerListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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
configure(Config config)
Read the include and exclude types from config.boolean
getProcessOnlyPreferredProducts()
boolean
getProcessUnassociatedProducts()
boolean
isIgnoreArchive()
boolean
isProcessOnlyWhenEventChanged()
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 Detail
-
PROCESS_PREFERRED_ONLY_PROPERTY
public static final java.lang.String PROCESS_PREFERRED_ONLY_PROPERTY
Property for process preferred only- See Also:
- Constant Field Values
-
PROCESS_PREFERRED_ONLY_DEFAULT
public static final java.lang.String PROCESS_PREFERRED_ONLY_DEFAULT
Default state of process preferred only- See Also:
- Constant Field Values
-
PROCESS_UNASSOCIATED_PROPERTY
public static final java.lang.String PROCESS_UNASSOCIATED_PROPERTY
Property for process unassociated- See Also:
- Constant Field Values
-
PROCESS_UNASSOCIATED_DEFAULT
public static final java.lang.String PROCESS_UNASSOCIATED_DEFAULT
Default state of process unassociated- See Also:
- Constant Field Values
-
PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY
public static final java.lang.String PROCESS_ONLY_WHEN_EVENT_CHANGE_PROPERTY
Property for process only when event change- See Also:
- Constant Field Values
-
PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT
public static final java.lang.String PROCESS_ONLY_WHEN_EVENT_CHANGE_DEFAULT
Default state of process only when event change- See Also:
- Constant Field Values
-
IGNORE_ARCHIVE_PROPERTY
public static final java.lang.String IGNORE_ARCHIVE_PROPERTY
Property for Ignore archive- See Also:
- Constant Field Values
-
IGNORE_ARCHIVE_DEFAULT
public static final java.lang.String IGNORE_ARCHIVE_DEFAULT
Default state of ignore archive- See Also:
- Constant Field Values
-
-
Method Detail
-
onIndexerEvent
public void onIndexerEvent(IndexerEvent event) throws java.lang.Exception
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:
java.lang.Exception
- if error occurs
-
accept
public boolean accept(IndexerEvent change) throws java.lang.Exception
- Parameters:
change
- the indexer event that has occurred- Returns:
- whether this external indexer listener handles this product type
- Throws:
java.lang.Exception
- if error occurs
-
accept
public boolean accept(IndexerEvent event, IndexerChange change) throws java.lang.Exception
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:
java.lang.Exception
- if error occurs
-
configure
public void configure(Config config) throws java.lang.Exception
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:
java.lang.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
-
-