Package gov.usgs.earthquake.indexer
Class DefaultIndexerModule
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.indexer.DefaultIndexerModule
-
- All Implemented Interfaces:
IndexerModule,Configurable
- Direct Known Subclasses:
DYFIIndexerModule,MTIndexerModule,OriginIndexerModule,ShakeMapIndexerModule,TectonicSummaryIndexerModule
public class DefaultIndexerModule extends DefaultConfigurable implements IndexerModule
Default implementation of the IndexerModule interface, implements ANSS Authoritative Region logic. Provides a basic level of support for any type of product. Creates a ProductSummary using the ProductSummary(product) constructor, which copies all properties, and links from the product.
-
-
Field Summary
Fields Modifier and Type Field Description static longANSS_CONTRIBUTOR_WEIGHTWeight added when product author has an authoritative region.static longAUTHORITATIVE_EVENT_WEIGHTWeight added when product refers to an authoritative event.static longAUTHORITATIVE_WEIGHTWeight added when product author is in its authoritative region.static longDEFAULT_PREFERRED_WEIGHTInitial preferred weight.static java.lang.StringIGNORE_REGIONS_PROPERTYProperty for ignoreRegionsstatic longNEIC_CONTRIBUTOR_WEIGHTWeight added when product author is NEIC.static longSAME_SOURCE_WEIGHTWeight added when product source is same as event source.-
Fields inherited from interface gov.usgs.earthquake.indexer.IndexerModule
LEVEL_DEFAULT, LEVEL_SUPPORTED, LEVEL_UNSUPPORTED
-
-
Constructor Summary
Constructors Constructor Description DefaultIndexerModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(Config config)Process configuration settings.java.lang.StringgetBaseProductType(java.lang.String type)Remove "internal-" prefix and "-scenario" suffix from product type".java.util.List<java.lang.String>getIgnoreRegions()protected longgetPreferredWeight(ProductSummary summary)Calculate the preferred weight for a product summary.ProductSummarygetProductSummary(Product product)Create a ProductSummary from a Product.SignatureVerifiergetSignatureVerifier()intgetSupportLevel(Product product)This module provides a default level of support for any type of product.voidsetSignatureVerifier(SignatureVerifier signatureVerifier)-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName, shutdown, startup
-
-
-
-
Field Detail
-
IGNORE_REGIONS_PROPERTY
public static final java.lang.String IGNORE_REGIONS_PROPERTY
Property for ignoreRegions- See Also:
- Constant Field Values
-
DEFAULT_PREFERRED_WEIGHT
public static final long DEFAULT_PREFERRED_WEIGHT
Initial preferred weight.- See Also:
- Constant Field Values
-
SAME_SOURCE_WEIGHT
public static final long SAME_SOURCE_WEIGHT
Weight added when product source is same as event source.- See Also:
- Constant Field Values
-
AUTHORITATIVE_WEIGHT
public static final long AUTHORITATIVE_WEIGHT
Weight added when product author is in its authoritative region.- See Also:
- Constant Field Values
-
AUTHORITATIVE_EVENT_WEIGHT
public static final long AUTHORITATIVE_EVENT_WEIGHT
Weight added when product refers to an authoritative event.- See Also:
- Constant Field Values
-
ANSS_CONTRIBUTOR_WEIGHT
public static final long ANSS_CONTRIBUTOR_WEIGHT
Weight added when product author has an authoritative region.- See Also:
- Constant Field Values
-
NEIC_CONTRIBUTOR_WEIGHT
public static final long NEIC_CONTRIBUTOR_WEIGHT
Weight added when product author is NEIC.- See Also:
- Constant Field Values
-
-
Method Detail
-
configure
public void configure(Config config) throws java.lang.Exception
Description copied from class:DefaultConfigurableProcess configuration settings. Called before startup().- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classDefaultConfigurable- Parameters:
config- the Config object with settings.- Throws:
java.lang.Exception- if configuration exceptions occur.
-
getProductSummary
public ProductSummary getProductSummary(Product product) throws java.lang.Exception
Create a ProductSummary from a Product. Uses the ProductSummary(Product) constructor, which copies product information. Checks whether product is within its authoritative region, and if so boosts preferredWeight by AUTHORITATIVE_WEIGHT.- Specified by:
getProductSummaryin interfaceIndexerModule- Parameters:
product- the product to summarize.- Returns:
- ProductSummary for Product object.
- Throws:
java.lang.Exception- if error occurs
-
getPreferredWeight
protected long getPreferredWeight(ProductSummary summary) throws java.lang.Exception
Calculate the preferred weight for a product summary. This method is called after creating a product summary, but before returning the created summary. It's return value is used to assign the product summary preferred weight. Within each type of product, the summary with the largest preferred weight is considered preferred.- Parameters:
summary- the summary to calculate a preferred weight.- Returns:
- the absolute preferred weight.
- Throws:
java.lang.Exception- if error occurs
-
getBaseProductType
public java.lang.String getBaseProductType(java.lang.String type)
Remove "internal-" prefix and "-scenario" suffix from product type".- Parameters:
type- product type.- Returns:
- base product type (without any known prefix or suffix).
-
getIgnoreRegions
public java.util.List<java.lang.String> getIgnoreRegions()
- Returns:
- ignoreRegions
-
getSupportLevel
public int getSupportLevel(Product product)
This module provides a default level of support for any type of product.- Specified by:
getSupportLevelin interfaceIndexerModule- Parameters:
product- the product to test.- Returns:
- IndexerModule.LEVEL_DEFAULT.
-
getSignatureVerifier
public SignatureVerifier getSignatureVerifier()
- Returns:
- signatureVerifier
-
setSignatureVerifier
public void setSignatureVerifier(SignatureVerifier signatureVerifier)
- Parameters:
signatureVerifier- to set
-
-