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 TypeMethodDescriptionvoid
close()
Free any resources associated with this source.void
Call out's onBeginProduct method for this product.void
Call out's onContent method for each product content.void
Call out's onEndProduct method for product.void
sendLinks
(ProductHandler out) Call out's onLink method for each product link.void
Call out's onProperty method for each product property.void
Call out's onSignature method with product signature.void
Call out's onSignatureHistory method with product signature history.void
Call out's onSignature method with product signature.void
streamTo
(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:
streamTo
in 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:
close
in interfaceProductSource
-