Package gov.usgs.earthquake.product.io
Interface ProductHandler
-
- All Known Implementing Classes:
BinaryProductHandler,DirectoryProductHandler,FilterProductHandler,JsonProductHandler,ObjectProductHandler,ProductDigest,XmlProductHandler,ZipProductHandler
public interface ProductHandlerA 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Free any resources associated with this handler.voidonBeginProduct(ProductId id, java.lang.String status, java.net.URL trackerURL)A new product is being output.voidonContent(ProductId id, java.lang.String path, Content content)Product content.voidonEndProduct(ProductId id)A product is finished being output.voidonLink(ProductId id, java.lang.String relation, java.net.URI href)A product link.voidonProperty(ProductId id, java.lang.String name, java.lang.String value)A product property value.voidonSignature(ProductId id, java.lang.String signature)Product signature.voidonSignatureVersion(ProductId id, CryptoUtils.Version version)Product signature version.
-
-
-
Method Detail
-
onBeginProduct
void onBeginProduct(ProductId id, java.lang.String status, java.net.URL trackerURL) throws java.lang.Exception
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.trackerURL- a location to send status updates.- Throws:
java.lang.Exception- if error occurs
-
onProperty
void onProperty(ProductId id, java.lang.String name, java.lang.String value) throws java.lang.Exception
A product property value. Products have zero or more properties.- Parameters:
id- which product.name- the property name.value- the property value.- Throws:
java.lang.Exception- if error occurs
-
onLink
void onLink(ProductId id, java.lang.String relation, java.net.URI href) throws java.lang.Exception
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:
java.lang.Exception- if error occurs
-
onContent
void onContent(ProductId id, java.lang.String path, Content content) throws java.lang.Exception
Product content. Products have one or more Contents.- Parameters:
id- which product.path- path to content within product.content- the product content.- Throws:
java.lang.Exception- if error occurs
-
onSignatureVersion
void onSignatureVersion(ProductId id, CryptoUtils.Version version) throws java.lang.Exception
Product signature version.- Parameters:
id- which product.version- product version- Throws:
java.lang.Exception- if error occurs
-
onSignature
void onSignature(ProductId id, java.lang.String signature) throws java.lang.Exception
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:
java.lang.Exception- if error occurs
-
onEndProduct
void onEndProduct(ProductId id) throws java.lang.Exception
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:
java.lang.Exception- if error occurs
-
close
void close()
Free any resources associated with this handler.
-
-