Package gov.usgs.earthquake.product.io
Interface ProductHandler
- All Known Implementing Classes:
BinaryProductHandler
,DirectoryProductHandler
,FilterProductHandler
,JsonProductHandler
,ObjectProductHandler
,ProductDigest
,XmlProductHandler
,ZipProductHandler
public interface ProductHandler
A Handler for Product events.
Outputs handle a stream of product events so products can be processed using
streams. They usually receive product events via a ProductInput.
ProductInputs should attempt to be ordered for uniform processing:
- onBeginProduct()
- onProperty(), by property name alphabetically
- onLink(), by relation alphabetically, by URI alphabetically
- onContent(), by content path alphabetically.
- onSignature()
- onEndProduct()
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Free any resources associated with this handler.void
onBeginProduct
(ProductId id, String status) A new product is being output.void
Product content.void
A product is finished being output.void
A product link.void
onProperty
(ProductId id, String name, String value) A product property value.void
onSignature
(ProductId id, String signature) Product signature.void
onSignatureHistory
(ProductId id, List<ProductSignature> signatureHistory) Product signature history.void
onSignatureVersion
(ProductId id, CryptoUtils.Version version) Product signature version.
-
Method Details
-
onBeginProduct
A new product is being output. The ProductHandler should expect calls to other on-Methods until the onEndProduct method is called. No calls to other on-Methods will occur before onBeginProduct.- Parameters:
id
- which product.status
- the product's status.- Throws:
Exception
- if error occurs
-
onProperty
A product property value. Products have zero or more properties.- Parameters:
id
- which product.name
- the property name.value
- the property value.- Throws:
Exception
- if error occurs
-
onLink
A product link. Products have zero or more links.- Parameters:
id
- which product.relation
- how the URI is related to this product.href
- the URI that is related to this product.- Throws:
Exception
- if error occurs
-
onContent
Product content. Products have one or more Contents.- Parameters:
id
- which product.path
- path to content within product.content
- the product content.- Throws:
Exception
- if error occurs
-
onSignatureVersion
Product signature version.- Parameters:
id
- which product.version
- product version- Throws:
Exception
- if error occurs
-
onSignature
Product signature. Producers may optionally sign products to confirm they were the producer.- Parameters:
id
- which product.signature
- the product signature, which can be verified using the ProductSigner class.- Throws:
Exception
- if error occurs
-
onSignatureHistory
Product signature history.- Parameters:
id
- which product.signatureHistory
- signature history of product.- Throws:
Exception
- if error occurs
-
onEndProduct
A product is finished being output. The ProductHandler should expect no more calls to other on-Methods, except perhaps onBeginProduct again, after the onEndProduct method is called.- Parameters:
id
- which product.- Throws:
Exception
- if error occurs
-
close
void close()Free any resources associated with this handler.
-