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:
  1. onBeginProduct()
  2. onProperty(), by property name alphabetically
  3. onLink(), by relation alphabetically, by URI alphabetically
  4. onContent(), by content path alphabetically.
  5. onSignature()
  6. onEndProduct()
Typically a ProductHandler is used to output a single product, although there is no explicit requirement preventing reuse.
  • Method Details

    • onBeginProduct

      void onBeginProduct(ProductId id, String status) throws 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.
      Throws:
      Exception - if error occurs
    • onProperty

      void onProperty(ProductId id, String name, String value) throws Exception
      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

      void onLink(ProductId id, String relation, URI href) throws 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:
      Exception - if error occurs
    • onContent

      void onContent(ProductId id, String path, Content content) throws Exception
      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

      void onSignatureVersion(ProductId id, CryptoUtils.Version version) throws Exception
      Product signature version.
      Parameters:
      id - which product.
      version - product version
      Throws:
      Exception - if error occurs
    • onSignature

      void onSignature(ProductId id, String signature) throws 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:
      Exception - if error occurs
    • onSignatureHistory

      void onSignatureHistory(ProductId id, List<ProductSignature> signatureHistory) throws Exception
      Product signature history.
      Parameters:
      id - which product.
      signatureHistory - signature history of product.
      Throws:
      Exception - if error occurs
    • onEndProduct

      void onEndProduct(ProductId id) throws 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:
      Exception - if error occurs
    • close

      void close()
      Free any resources associated with this handler.