Description
This juggler creates a time limited archive of products. If there are multiple inputs it merges them before adding them to the archive. While it merges the inputs, it makes sure that it does not add duplicate items to the archive. Products are automatically removed from the archive after a specified productLifetime, if deleteExpired is true.In some circumstances you may wish to output an HTML index-like page that captures the archived product. See passAsHTMLIndex
Configuration Variables
deleteExpiredThis attribute controls whether the Products will be deleted from the archive after they have expired. The default setting is false so that expired files will not be deleted from the product archive even after productLifetime has expired.Note: The only two acceptable values are either true or false.
productLifetime
The number of days that must pass before products in the archive are considered to be expired. The default setting is 7 days.Product
Product is null if the product archive is empty. The archive will be empty if any of the following conditions occur:
- If the Archiver juggler is running for the first time and has no sources, or has sources that don't contribute any product.
- If the Archiver juggler has deleted all of the product from its archive due to expiration and has no sources, or has sources that don't contribute any product.
Otherwise, if the product is not null, then it will be a ContainerProduct (e.g. VectorProduct, HashtableProduct). This juggler will never return a BasicProduct without first wrapping it in a ContainerProduct.
How it works
The juggler merges input products with those in the archive. If the deleteExpired configuration variable is set to true, the juggler will perform a filtering operation to delete expired products from its persistent archive.The following steps are performed by each instance of the juggler to create the product which this juggler outputs:
1) The juggler creates a single persistent root that points to the composite product archive which it creates.2) This juggler merges newly retrieved Product with the composite product pointed to by the persistent root. This juggler restores its archived product after a shutdown by overriding setPersistentProduct() and getPersistentProduct().
3) If a product has a root (i.e. getRoot() does not return null), then no attempt is made to merge it with other products having the same id and description. Instead, it is just added to the archive without checking to see if it could actually be merged with an existing product in the archive. The reason for not attempting to merge products which have roots with each other is to prevent broken or missing links in the index page pointed to by the root.
4) This juggler makes sure that duplicate products are not added to the archive. The juggler determines if products are duplicates by using certain comparison operations which are defined below for each product type.
5) The following comparison operations are used when determining when two products are equal:
- ContainerProducts such as VectorProduct or HashtableProduct are considered to be equal when their ids and descriptions are equal.
- BasicProducts are considered to be equal when their ids, descriptions, and content are equal.
- Strings are considered to be equal if the String.equals() function returns true.
- URLs are considered to be equal if the URL.equals() function returns true.
- FileRefs are considered to be equal if their sourceNames are equal and they have the same modification date. The sourceName of a FileRef is the original filename of a file which includes the full path as part of the filename.
6) This juggler tags incoming products with its own unique date archived tag so that it knows when the product was first added to the archive. Using the date when the product was first added to the archive and the product lifetime which the juggler is configured with, the date when products should expire can be calculated.
7) This juggler only pays attention to its own unique date archived tag on products. All other expiration dates and tags are ignored. This means that a product can remain in the archive even if its lifetime outside the archive is over, as long as the juggler determines that it has not outlived its lifetime in the archive.The following algorithm is used to determine whether products can be merged with others already in the archive, or whether they will simply be added to the archive:
1) First, the top-level subproducts in the incoming composite product created by calling the PassThru juggler are compared to the top-level subproducts in the archive. If the id and description of the top-level subproducts from the new composite product match the id and description of the top-level subproducts in the archive, then these products will be merged. Otherwise, if there are no matches between the id and description of the top-level subproducts in the new composite product and the top-level subproducts in the archive, then these products will just be added to the archive.2) While merging top-level subproducts, the algorithm is applied recursively so that if the top-level subproducts in the new composite product are ContainerProducts, then their contents will also be checked to see if they can be merged with other products having the same id and description at a lower level of the product tree of the archive.
Note: For products to be merged with each other, they must have the same id and description, and the same location in the product tree.
3) If a product has a root, then it will never be merged with any other product even if it has a matching id and description. Instead, it will just be added to the archive. This prevents broken or missing links in the index page pointed to by the root.
4) If there are new BasicProducts which have matching ids, descriptions, and content with the BasicProducts already in the archive, then the BasicProducts already in the archive are left alone and the new BasicProducts are just thrown away.
5) However, if the new BasicProducts do not have matching ids, descriptions, and content with the BasicProducts already in the archive, then the new BasicProducts are added to the archive.
Revised: 30 Nov 1998