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 Details

    • IGNORE_REGIONS_PROPERTY

      public static final String IGNORE_REGIONS_PROPERTY
      Property for ignoreRegions
      See Also:
    • DEFAULT_PREFERRED_WEIGHT

      public static final long DEFAULT_PREFERRED_WEIGHT
      Initial preferred weight.
      See Also:
    • SAME_SOURCE_WEIGHT

      public static final long SAME_SOURCE_WEIGHT
      Weight added when product source is same as event source.
      See Also:
    • AUTHORITATIVE_WEIGHT

      public static final long AUTHORITATIVE_WEIGHT
      Weight added when product author is in its authoritative region.
      See Also:
    • AUTHORITATIVE_EVENT_WEIGHT

      public static final long AUTHORITATIVE_EVENT_WEIGHT
      Weight added when product refers to an authoritative event.
      See Also:
    • ANSS_CONTRIBUTOR_WEIGHT

      public static final long ANSS_CONTRIBUTOR_WEIGHT
      Weight added when product author has an authoritative region.
      See Also:
    • NEIC_CONTRIBUTOR_WEIGHT

      public static final long NEIC_CONTRIBUTOR_WEIGHT
      Weight added when product author is NEIC.
      See Also:
  • Constructor Details

    • DefaultIndexerModule

      public DefaultIndexerModule()
  • Method Details

    • configure

      public void configure(Config config) throws Exception
      Description copied from class: DefaultConfigurable
      Process configuration settings. Called before startup().
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class DefaultConfigurable
      Parameters:
      config - the Config object with settings.
      Throws:
      Exception - if configuration exceptions occur.
    • getProductSummary

      public ProductSummary getProductSummary(Product product) throws 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:
      getProductSummary in interface IndexerModule
      Parameters:
      product - the product to summarize.
      Returns:
      ProductSummary for Product object.
      Throws:
      Exception - if error occurs
    • getPreferredWeight

      protected long getPreferredWeight(ProductSummary summary) throws 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:
      Exception - if error occurs
    • getBaseProductType

      public String getBaseProductType(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 List<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:
      getSupportLevel in interface IndexerModule
      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