StorageEvent.java

  1. package gov.usgs.earthquake.distribution;

  2. import gov.usgs.earthquake.product.ProductId;

  3. import java.util.EventObject;

  4. public class StorageEvent extends EventObject {

  5.     /** Enumeration of <code>StorageEventType</code>s **/
  6.     public static enum StorageEventType {
  7.         /** StorageEventType enum for stored */
  8.         PRODUCT_STORED,
  9.         /** StorageEventType enum for removed */
  10.         PRODUCT_REMOVED
  11.     }

  12.     /** Variable of StorageEventType, for the PRODUCT_STORED enum */
  13.     public static final StorageEventType PRODUCT_STORED = StorageEventType.PRODUCT_STORED;
  14.     /** Variable of StorageEventType, for the PRODUCT_REMOVED enum */
  15.     public static final StorageEventType PRODUCT_REMOVED = StorageEventType.PRODUCT_REMOVED;

  16.     private static final long serialVersionUID = 0x019A1A8BL;
  17.     /** The product ID */
  18.     private ProductId id = null;
  19.     /** The StorageEventType */
  20.     private StorageEventType type = null;

  21.     /**
  22.      * Construct a new StorageEvent
  23.      * @param storage ProductStorage
  24.      * @param id ProductId
  25.      * @param type StorageEventType
  26.      */
  27.     public StorageEvent(ProductStorage storage, ProductId id,
  28.             StorageEventType type) {
  29.         super(storage);
  30.         this.id = id;
  31.         this.type = type;
  32.     }

  33.     /** @return ProductStorage */
  34.     public ProductStorage getProductStorage() {
  35.         return (ProductStorage) getSource();
  36.     }

  37.     /** @return Product ID */
  38.     public ProductId getProductId() {
  39.         return id;
  40.     }

  41.     /** @return StorageEventType */
  42.     public StorageEventType getType() {
  43.         return type;
  44.     }
  45. }