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 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.