Package gov.usgs.earthquake.product.io
Class ObjectProductSource
java.lang.Object
gov.usgs.earthquake.product.io.ObjectProductSource
- All Implemented Interfaces:
ProductSource
Convert a java Product object into events for a ProductHandler.
ObjectProductSource turns a product object into a stream of events for
ProductOutputs.
ObjectProductSources are reuseable for a given product.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free any resources associated with this source.voidCall out's onBeginProduct method for this product.voidCall out's onContent method for each product content.voidCall out's onEndProduct method for product.voidsendLinks(ProductHandler out) Call out's onLink method for each product link.voidCall out's onProperty method for each product property.voidCall out's onSignature method with product signature.voidCall out's onSignatureHistory method with product signature history.voidCall out's onSignature method with product signature.voidstreamTo(ProductHandler out) Send a product object to a ProductOutput.
-
Constructor Details
-
ObjectProductSource
Construct a new ObjectProductSource.- Parameters:
product- the product used for input.
-
-
Method Details
-
streamTo
Send a product object to a ProductOutput. Calls these methods in the following order:- sendBeginProduct
- sendProperties
- sendLinks
- sendContents
- sendSignature
- sendEndProduct
- Specified by:
streamToin interfaceProductSource- Parameters:
out- the ProductOutput that will receive the Product.- Throws:
Exception- if error occurs
-
sendBeginProduct
Call out's onBeginProduct method for this product.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onBeginProduct throws an Exception.
-
sendProperties
Call out's onProperty method for each product property. Calls in alphabetical order by property name.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onProperty throws an Exception.
-
sendLinks
Call out's onLink method for each product link. Calls in alphabetical order by relation name, by URI.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onProperty throws an Exception.
-
sendContents
Call out's onContent method for each product content. Calls alphabetically by content path.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onContent throws an Exception.
-
sendSignatureVersion
Call out's onSignature method with product signature.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onSignature throws an Exception.
-
sendSignature
Call out's onSignature method with product signature.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onSignature throws an Exception.
-
sendSignatureHistory
Call out's onSignatureHistory method with product signature history.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onSignature throws an Exception.
-
sendEndProduct
Call out's onEndProduct method for product.- Parameters:
out- the receiving ProductOutput.- Throws:
Exception- if out.onEndProduct throws an Exception.
-
close
public void close()Free any resources associated with this source.- Specified by:
closein interfaceProductSource
-