Package gov.usgs.earthquake.indexer
Interface ProductIndex
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
ExtentIndex
,JDBCProductIndex
An index of products.
The Indexer uses a ProductIndex to store received Products, and associate
them together into Events.
The transaction methods are used when one product results in several changes
to the database. For instance, add a ProductSummary then add an association
to an event.
-
Method Summary
Modifier and TypeMethodDescriptionaddAssociation
(Event event, ProductSummary summary) Associate an Event and ProductSummary that are already in the index.Add an event to the index.addProductSummary
(ProductSummary summary) Add a product summary to the index.void
If the index supports transactions, begin a transaction.void
If the index supports transactions, and beginTransaction was previously called, commit the pending transaction.void
eventsUpdated
(List<Event> events) An opportunity for the ProductIndex to update summary information it may or may not store for efficient event searches.getEvents
(ProductIndexQuery query) Get events in this index.getProducts
(ProductIndexQuery query) Get products in this index.Get products in this index that aren't associated to any event.boolean
hasProduct
(ProductId id) Check whether index has product.removeAssociation
(Event event, ProductSummary summary) Remove an association between and Event and ProductSummary.removeEvent
(Event event) Remove an event from the index.removeProductSummary
(ProductSummary summary) Remove a product summary from the index.void
If the index supports transactions, and beginTransaction was previously called, rollback the pending transaction.
-
Method Details
-
beginTransaction
If the index supports transactions, begin a transaction.- Throws:
Exception
- if error occurs
-
commitTransaction
If the index supports transactions, and beginTransaction was previously called, commit the pending transaction.- Throws:
Exception
- if error occurs
-
rollbackTransaction
If the index supports transactions, and beginTransaction was previously called, rollback the pending transaction.- Throws:
Exception
- if error occurs
-
getEvents
Get events in this index.- Parameters:
query
- a description of which events to retrieve.- Returns:
- a list of matching events.
- Throws:
Exception
- if error occurs
-
getProducts
Get products in this index.- Parameters:
query
- a description of which products to retrieve.- Returns:
- a list of matching products.
- Throws:
Exception
- if error occurs
-
hasProduct
Check whether index has product. May be more efficient thangetProducts(ProductIndexQuery)
.- Parameters:
id
- a ProductId- Returns:
- boolean if index has product
- Throws:
Exception
- if error occurs
-
getUnassociatedProducts
Get products in this index that aren't associated to any event.- Parameters:
query
- a description of which products to retrieve.- Returns:
- a list of unassociated products
- Throws:
Exception
- if error occurs
-
addEvent
Add an event to the index.- Parameters:
event
- the event to add.- Returns:
- Copy of event with the eventId attribute set to the id in the database
- Throws:
Exception
- if error occurs
-
removeEvent
Remove an event from the index.- Parameters:
event
- the event to remove.- Returns:
- Copy of the event removed
- Throws:
Exception
- if the event is associated to products.
-
addProductSummary
Add a product summary to the index.- Parameters:
summary
- the summary to add.- Returns:
- Copy of the product summary object with the indexId set to the newly inserted id.
- Throws:
Exception
- if error occurs
-
removeProductSummary
Remove a product summary from the index.- Parameters:
summary
- the summary to remove.- Returns:
- id of removed summary.
- Throws:
Exception
- if error occurs
-
addAssociation
Associate an Event and ProductSummary that are already in the index.- Parameters:
event
- the event.summary
- the summary.- Returns:
- Copy of event with summary added to the products list
- Throws:
Exception
- if error occurs
-
removeAssociation
Remove an association between and Event and ProductSummary.- Parameters:
event
- the event.summary
- the summary.- Returns:
- Copy of event with summary removed from the products list
- Throws:
Exception
- if error occurs
-
eventsUpdated
An opportunity for the ProductIndex to update summary information it may or may not store for efficient event searches. This method is called by the indexer after it has finished updating events during onProduct.- Parameters:
events
- events that may have new preferred attributes.- Throws:
Exception
- if error occurs
-