Package gov.usgs.earthquake.product.io
Class DirectoryProductHandler
- java.lang.Object
-
- gov.usgs.earthquake.product.io.ObjectProductHandler
-
- gov.usgs.earthquake.product.io.DirectoryProductHandler
-
- All Implemented Interfaces:
ProductHandler
public class DirectoryProductHandler extends ObjectProductHandler
Store a product to a Directory. Product attributes are stored to a file named "product.xml". All ProductOutput methods are passed to an ObjectProductOutput object, except files with non-empty paths. Files are stored in the directory, and all other product attributes are stored using the product xml format to a file name "product.xml".
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PRODUCT_XML_FILENAME
The file where product attributes are stored.
-
Constructor Summary
Constructors Constructor Description DirectoryProductHandler(java.io.File directory)
Construct a new DirectoryProductHandler object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onContent(ProductId id, java.lang.String path, Content content)
Extract content when path isn't empty.void
onEndProduct(ProductId id)
Store all except product contents to product.xml.-
Methods inherited from class gov.usgs.earthquake.product.io.ObjectProductHandler
close, getProduct, getProduct, onBeginProduct, onLink, onProperty, onSignature, onSignatureVersion
-
-
-
-
Field Detail
-
PRODUCT_XML_FILENAME
public static final java.lang.String PRODUCT_XML_FILENAME
The file where product attributes are stored.- See Also:
- Constant Field Values
-
-
Method Detail
-
onContent
public void onContent(ProductId id, java.lang.String path, Content content) throws java.lang.Exception
Extract content when path isn't empty.- Specified by:
onContent
in interfaceProductHandler
- Overrides:
onContent
in classObjectProductHandler
- Parameters:
id
- which product.path
- path to content within product.content
- the product content.- Throws:
java.lang.Exception
- if error occurs
-
onEndProduct
public void onEndProduct(ProductId id) throws java.lang.Exception
Store all except product contents to product.xml.- Specified by:
onEndProduct
in interfaceProductHandler
- Overrides:
onEndProduct
in classObjectProductHandler
- Parameters:
id
- which product.- Throws:
java.lang.Exception
- if error occurs
-
-