Package gov.usgs.earthquake.indexer
Class ArchivePolicy
- java.lang.Object
-
- gov.usgs.util.DefaultConfigurable
-
- gov.usgs.earthquake.indexer.ArchivePolicy
-
- All Implemented Interfaces:
Configurable
- Direct Known Subclasses:
ProductArchivePolicy
public class ArchivePolicy extends DefaultConfigurable
A policy for the Indexer to clean up Events in its ProductIndex. The policy is created by configuration parameters and generates a ProductIndexQuery. Any product/event matching the product index query is archived. Generally, archiving means the data for that product/event is removed from the index as well as the storage. Upon archiving, an EVENT_ARCHIVED type of IndexerEvent is sent to interested listeners. All archive policies run in their own thread (one thread separate from indexing for all archive policies, not one each) and execute at configured intervals.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ARCHIVE_EVENT_SOURCE_PROPERTY
Property for archive event sourcestatic java.lang.String
ARCHIVE_MAX_AGE_PROPERTY
Deprecated.static java.lang.String
ARCHIVE_MAX_DEPTH_PROPERTY
Property for archive maximum depthstatic java.lang.String
ARCHIVE_MAX_EVENT_AGE_PROPERTY
Property for archive maximum event agestatic java.lang.String
ARCHIVE_MAX_EVENT_TIME_PROPERTY
Property for archive maximum event timestatic java.lang.String
ARCHIVE_MAX_LAT_PROPERTY
Property for archive maximum latitudestatic java.lang.String
ARCHIVE_MAX_LNG_PROPERTY
Property for archive maximum longitudestatic java.lang.String
ARCHIVE_MAX_MAG_PROPERTY
Property for archive maximum magstatic java.lang.String
ARCHIVE_MIN_AGE_PROPERTY
Deprecated.static java.lang.String
ARCHIVE_MIN_DEPTH_PROPERTY
Property for archive minimum depthstatic java.lang.String
ARCHIVE_MIN_EVENT_AGE_PROPERTY
Property for archive minimum event agestatic java.lang.String
ARCHIVE_MIN_EVENT_TIME_PROPERTY
Property for archive minimum event timestatic java.lang.String
ARCHIVE_MIN_LAT_PROPERTY
Property for archive minimum latitudestatic java.lang.String
ARCHIVE_MIN_LNG_PROPERTY
Property for archive minimum longitudestatic java.lang.String
ARCHIVE_MIN_MAG_PROPERTY
Property for archive minimum magprotected java.lang.String
eventSource
Configured parameter var for eventSourceprotected java.lang.Long
maxAge
Deprecated.protected java.math.BigDecimal
maxDepth
Configured parameter var for maxDepthprotected java.lang.Long
maxEventAge
Configured parameter var for maxEventAgeprotected java.lang.Long
maxEventTime
Configured parameter var for maxEventTimeprotected java.math.BigDecimal
maxLat
Configured parameter var for maxLatprotected java.math.BigDecimal
maxLng
Configured parameter var for maxLngprotected java.math.BigDecimal
maxMag
Configured parameter var for maxMagprotected java.lang.Long
minAge
Deprecated.protected java.math.BigDecimal
minDepth
Configured parameter var for minDepthprotected java.lang.Long
minEventAge
Configured parameter var for minEventAgeprotected java.lang.Long
minEventTime
Configured parameter var for minEventTimeprotected java.math.BigDecimal
minLat
Configured parameter var for minLatprotected java.math.BigDecimal
minLng
Configured parameter var for minLngprotected java.math.BigDecimal
minMag
Configured parameter var for minMag
-
Constructor Summary
Constructors Constructor Description ArchivePolicy()
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
configure(Config config)
Process configuration settings.java.lang.String
getEventSource()
ProductIndexQuery
getIndexQuery()
java.lang.Long
getMaxAge()
Deprecated.java.math.BigDecimal
getMaxDepth()
java.lang.Long
getMaxEventAge()
java.lang.Long
getMaxEventTime()
java.math.BigDecimal
getMaxLat()
java.math.BigDecimal
getMaxLng()
java.math.BigDecimal
getMaxMag()
java.lang.Long
getMinAge()
Deprecated.java.math.BigDecimal
getMinDepth()
java.lang.Long
getMinEventAge()
java.lang.Long
getMinEventTime()
java.math.BigDecimal
getMinLat()
java.math.BigDecimal
getMinLng()
java.math.BigDecimal
getMinMag()
boolean
isValidPolicy()
protected java.math.BigDecimal
parseBigDecimal(Config config, java.lang.String name)
Gets the property 'name' from config and returns a BigDecimal of itprotected java.lang.Long
parseDateOrLong(Config config, java.lang.String name)
Gets the property 'name' from config and returns a Date/Long of itprotected java.lang.Long
parseLong(Config config, java.lang.String name)
Gets the property 'name' from config and returns a Long of itvoid
setEventSource(java.lang.String eventSource)
void
setMaxAge(java.lang.Long maxAge)
Deprecated.void
setMaxDepth(java.math.BigDecimal maxDepth)
void
setMaxEventAge(java.lang.Long maxEventAge)
void
setMaxEventTime(java.lang.Long maxEventTime)
void
setMaxLat(java.math.BigDecimal maxLat)
void
setMaxLng(java.math.BigDecimal maxLng)
void
setMaxMag(java.math.BigDecimal maxMag)
void
setMinAge(java.lang.Long minAge)
Deprecated.void
setMinDepth(java.math.BigDecimal minDepth)
void
setMinEventAge(java.lang.Long minEventAge)
void
setMinEventTime(java.lang.Long minEventTime)
void
setMinLat(java.math.BigDecimal minLat)
void
setMinLng(java.math.BigDecimal minLng)
void
setMinMag(java.math.BigDecimal minMag)
void
shutdown()
Stop any processing/background threads.void
startup()
Start any processing/background threads.-
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
-
-
-
Field Detail
-
ARCHIVE_MIN_AGE_PROPERTY
public static final java.lang.String ARCHIVE_MIN_AGE_PROPERTY
Deprecated.- See Also:
- Constant Field Values
-
ARCHIVE_MAX_AGE_PROPERTY
public static final java.lang.String ARCHIVE_MAX_AGE_PROPERTY
Deprecated.- See Also:
- Constant Field Values
-
ARCHIVE_MIN_EVENT_AGE_PROPERTY
public static final java.lang.String ARCHIVE_MIN_EVENT_AGE_PROPERTY
Property for archive minimum event age- See Also:
- Constant Field Values
-
ARCHIVE_MAX_EVENT_AGE_PROPERTY
public static final java.lang.String ARCHIVE_MAX_EVENT_AGE_PROPERTY
Property for archive maximum event age- See Also:
- Constant Field Values
-
ARCHIVE_MIN_EVENT_TIME_PROPERTY
public static final java.lang.String ARCHIVE_MIN_EVENT_TIME_PROPERTY
Property for archive minimum event time- See Also:
- Constant Field Values
-
ARCHIVE_MAX_EVENT_TIME_PROPERTY
public static final java.lang.String ARCHIVE_MAX_EVENT_TIME_PROPERTY
Property for archive maximum event time- See Also:
- Constant Field Values
-
ARCHIVE_MIN_MAG_PROPERTY
public static final java.lang.String ARCHIVE_MIN_MAG_PROPERTY
Property for archive minimum mag- See Also:
- Constant Field Values
-
ARCHIVE_MAX_MAG_PROPERTY
public static final java.lang.String ARCHIVE_MAX_MAG_PROPERTY
Property for archive maximum mag- See Also:
- Constant Field Values
-
ARCHIVE_MIN_LAT_PROPERTY
public static final java.lang.String ARCHIVE_MIN_LAT_PROPERTY
Property for archive minimum latitude- See Also:
- Constant Field Values
-
ARCHIVE_MAX_LAT_PROPERTY
public static final java.lang.String ARCHIVE_MAX_LAT_PROPERTY
Property for archive maximum latitude- See Also:
- Constant Field Values
-
ARCHIVE_MIN_LNG_PROPERTY
public static final java.lang.String ARCHIVE_MIN_LNG_PROPERTY
Property for archive minimum longitude- See Also:
- Constant Field Values
-
ARCHIVE_MAX_LNG_PROPERTY
public static final java.lang.String ARCHIVE_MAX_LNG_PROPERTY
Property for archive maximum longitude- See Also:
- Constant Field Values
-
ARCHIVE_MIN_DEPTH_PROPERTY
public static final java.lang.String ARCHIVE_MIN_DEPTH_PROPERTY
Property for archive minimum depth- See Also:
- Constant Field Values
-
ARCHIVE_MAX_DEPTH_PROPERTY
public static final java.lang.String ARCHIVE_MAX_DEPTH_PROPERTY
Property for archive maximum depth- See Also:
- Constant Field Values
-
ARCHIVE_EVENT_SOURCE_PROPERTY
public static final java.lang.String ARCHIVE_EVENT_SOURCE_PROPERTY
Property for archive event source- See Also:
- Constant Field Values
-
minAge
protected java.lang.Long minAge
Deprecated.
-
maxAge
protected java.lang.Long maxAge
Deprecated.
-
minEventAge
protected java.lang.Long minEventAge
Configured parameter var for minEventAge
-
maxEventAge
protected java.lang.Long maxEventAge
Configured parameter var for maxEventAge
-
minEventTime
protected java.lang.Long minEventTime
Configured parameter var for minEventTime
-
maxEventTime
protected java.lang.Long maxEventTime
Configured parameter var for maxEventTime
-
minMag
protected java.math.BigDecimal minMag
Configured parameter var for minMag
-
maxMag
protected java.math.BigDecimal maxMag
Configured parameter var for maxMag
-
minLat
protected java.math.BigDecimal minLat
Configured parameter var for minLat
-
maxLat
protected java.math.BigDecimal maxLat
Configured parameter var for maxLat
-
minLng
protected java.math.BigDecimal minLng
Configured parameter var for minLng
-
maxLng
protected java.math.BigDecimal maxLng
Configured parameter var for maxLng
-
minDepth
protected java.math.BigDecimal minDepth
Configured parameter var for minDepth
-
maxDepth
protected java.math.BigDecimal maxDepth
Configured parameter var for maxDepth
-
eventSource
protected java.lang.String eventSource
Configured parameter var for eventSource
-
-
Method Detail
-
configure
public void configure(Config config) throws java.lang.Exception
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultConfigurable
- Parameters:
config
- the Config object with settings.- Throws:
java.lang.Exception
- if configuration exceptions occur.
-
shutdown
public void shutdown() throws java.lang.Exception
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
startup
public void startup() throws java.lang.Exception
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
getIndexQuery
public ProductIndexQuery getIndexQuery()
- Returns:
- a ProductIndexQuery
-
isValidPolicy
public boolean isValidPolicy()
- Returns:
- boolean if the policy is valid
-
parseBigDecimal
protected java.math.BigDecimal parseBigDecimal(Config config, java.lang.String name)
Gets the property 'name' from config and returns a BigDecimal of it- Parameters:
config
- Config filename
- name of property from config- Returns:
- BigDecimal of property
-
parseDateOrLong
protected java.lang.Long parseDateOrLong(Config config, java.lang.String name)
Gets the property 'name' from config and returns a Date/Long of it- Parameters:
config
- Config filename
- name of property from config- Returns:
- Date/Long of property
-
parseLong
protected java.lang.Long parseLong(Config config, java.lang.String name)
Gets the property 'name' from config and returns a Long of it- Parameters:
config
- Config filename
- name of property from config- Returns:
- Long of property
-
getMinAge
public java.lang.Long getMinAge()
Deprecated.- Returns:
- minAge
-
setMinAge
public void setMinAge(java.lang.Long minAge)
Deprecated.- Parameters:
minAge
- to set
-
getMaxAge
public java.lang.Long getMaxAge()
Deprecated.- Returns:
- maxAge
-
setMaxAge
public void setMaxAge(java.lang.Long maxAge)
Deprecated.- Parameters:
maxAge
- to set
-
getMinEventAge
public java.lang.Long getMinEventAge()
- Returns:
- minEventAge
-
setMinEventAge
public void setMinEventAge(java.lang.Long minEventAge)
- Parameters:
minEventAge
- to set
-
getMaxEventAge
public java.lang.Long getMaxEventAge()
- Returns:
- maxEventAge
-
setMaxEventAge
public void setMaxEventAge(java.lang.Long maxEventAge)
- Parameters:
maxEventAge
- to set
-
getMinEventTime
public java.lang.Long getMinEventTime()
- Returns:
- minEventTime
-
setMinEventTime
public void setMinEventTime(java.lang.Long minEventTime)
- Parameters:
minEventTime
- to set
-
getMaxEventTime
public java.lang.Long getMaxEventTime()
- Returns:
- maxEventTime
-
setMaxEventTime
public void setMaxEventTime(java.lang.Long maxEventTime)
- Parameters:
maxEventTime
- to set
-
getMinMag
public java.math.BigDecimal getMinMag()
- Returns:
- minMag
-
setMinMag
public void setMinMag(java.math.BigDecimal minMag)
- Parameters:
minMag
- to set
-
getMaxMag
public java.math.BigDecimal getMaxMag()
- Returns:
- maxMag
-
setMaxMag
public void setMaxMag(java.math.BigDecimal maxMag)
- Parameters:
maxMag
- to set
-
getMinLat
public java.math.BigDecimal getMinLat()
- Returns:
- minLat
-
setMinLat
public void setMinLat(java.math.BigDecimal minLat)
- Parameters:
minLat
- to set
-
getMaxLat
public java.math.BigDecimal getMaxLat()
- Returns:
- maxLat
-
setMaxLat
public void setMaxLat(java.math.BigDecimal maxLat)
- Parameters:
maxLat
- to set
-
getMinLng
public java.math.BigDecimal getMinLng()
- Returns:
- minLng
-
setMinLng
public void setMinLng(java.math.BigDecimal minLng)
- Parameters:
minLng
- to set
-
getMaxLng
public java.math.BigDecimal getMaxLng()
- Returns:
- maxLng
-
setMaxLng
public void setMaxLng(java.math.BigDecimal maxLng)
- Parameters:
maxLng
- to set
-
getMinDepth
public java.math.BigDecimal getMinDepth()
- Returns:
- minDepth
-
setMinDepth
public void setMinDepth(java.math.BigDecimal minDepth)
- Parameters:
minDepth
- to set
-
getMaxDepth
public java.math.BigDecimal getMaxDepth()
- Returns:
- maxDepth
-
setMaxDepth
public void setMaxDepth(java.math.BigDecimal maxDepth)
- Parameters:
maxDepth
- to set
-
getEventSource
public java.lang.String getEventSource()
- Returns:
- eventSource
-
setEventSource
public void setEventSource(java.lang.String eventSource)
- Parameters:
eventSource
- to set
-
-