ProductTrackerUpdate.java

  1. /*
  2.  * ProductTrackerUpdate
  3.  */
  4. package gov.usgs.earthquake.distribution;

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

  6. import java.net.URL;
  7. import java.net.InetAddress;

  8. import java.util.Date;

  9. /**
  10.  * Represents a single update sent to a product tracker.
  11.  */
  12. public class ProductTrackerUpdate {

  13.     /** String for products created */
  14.     public static final String PRODUCT_CREATED = "Product Created";
  15.     /** String for products received */
  16.     public static final String PRODUCT_RECEIVED = "Product Received";
  17.     /** String for product exception*/
  18.     public static final String PRODUCT_EXCEPTION = "Exception";
  19.     /** String for notification sent*/
  20.     public static final String NOTIFICATION_SENT = "Notification Sent";
  21.     /** String for notification received*/
  22.     public static final String NOTIFICATION_RECEIVED = "Notification Received";
  23.     /** String for product downloaded*/
  24.     public static final String PRODUCT_DOWNLOADED = "Product Downloaded";
  25.     /** String for product indexed*/
  26.     public static final String PRODUCT_INDEXED = "Product Indexed";

  27.     /** Which ProductTracker stored this update. */
  28.     private URL trackerURL;

  29.     // Assigned by the ProductTracker
  30.     /** A sequence number assigned by the ProductTracker. */
  31.     private Long sequenceNumber;

  32.     /** When the update was received by the tracker. */
  33.     private Date created;

  34.     /** The host that sent the update to the tracker. */
  35.     private InetAddress host;

  36.     // Assigned by the component
  37.     /** Product to which this update refers. */
  38.     private ProductId id;

  39.     /** The software component that is sending the update. */
  40.     private String className;

  41.     /** The update being sent. */
  42.     private String message;

  43.     /**
  44.      * Create a tracker update for submission. Calls other constructor with null
  45.      * arguments for those that are not included.
  46.      *
  47.      * @param trackerURL url of ProductTracker
  48.      * @param id the id of the product being updated
  49.      * @param className which component is sending the update
  50.      * @param message the update being send
  51.      */
  52.     public ProductTrackerUpdate(final URL trackerURL, final ProductId id,
  53.             final String className, final String message) {
  54.         this(trackerURL, null, null, null, id, className, message);
  55.     }

  56.     /**
  57.      * Create a new ProductTrackerUpdate object.
  58.      *
  59.      * @param trackerURL url of ProductTracker
  60.      * @param sequenceNumber assigned by ProductTracker
  61.      * @param created When the update was created
  62.      * @param host Host that sent the update
  63.      * @param id the id of the product being updated
  64.      * @param className which component is sending the update
  65.      * @param message the update being send
  66.      */
  67.     public ProductTrackerUpdate(final URL trackerURL,
  68.             final Long sequenceNumber, final Date created,
  69.             final InetAddress host, final ProductId id, final String className,
  70.             final String message) {
  71.         this.trackerURL = trackerURL;
  72.         this.sequenceNumber = sequenceNumber;
  73.         this.created = created;
  74.         this.host = host;
  75.         this.id = id;
  76.         this.className = className;
  77.         this.message = message;
  78.     }

  79.     /**
  80.      * @return the trackerURL
  81.      */
  82.     public URL getTrackerURL() {
  83.         return trackerURL;
  84.     }

  85.     /**
  86.      * @param trackerURL
  87.      *            the trackerURL to set
  88.      */
  89.     public void setTrackerURL(URL trackerURL) {
  90.         this.trackerURL = trackerURL;
  91.     }

  92.     /**
  93.      * @return the sequenceNumber
  94.      */
  95.     public Long getSequenceNumber() {
  96.         return sequenceNumber;
  97.     }

  98.     /**
  99.      * @param sequenceNumber
  100.      *            the sequenceNumber to set
  101.      */
  102.     public void setSequenceNumber(Long sequenceNumber) {
  103.         this.sequenceNumber = sequenceNumber;
  104.     }

  105.     /**
  106.      * @return the created
  107.      */
  108.     public Date getCreated() {
  109.         return created;
  110.     }

  111.     /**
  112.      * @param created
  113.      *            the created to set
  114.      */
  115.     public void setCreated(Date created) {
  116.         this.created = created;
  117.     }

  118.     /**
  119.      * @return the host
  120.      */
  121.     public InetAddress getHost() {
  122.         return host;
  123.     }

  124.     /**
  125.      * @param host
  126.      *            the host to set
  127.      */
  128.     public void setHost(InetAddress host) {
  129.         this.host = host;
  130.     }

  131.     /**
  132.      * @return the id
  133.      */
  134.     public ProductId getId() {
  135.         return id;
  136.     }

  137.     /**
  138.      * @param id
  139.      *            the id to set
  140.      */
  141.     public void setId(ProductId id) {
  142.         this.id = id;
  143.     }

  144.     /**
  145.      * @return the className
  146.      */
  147.     public String getClassName() {
  148.         return className;
  149.     }

  150.     /**
  151.      * @param className
  152.      *            the className to set
  153.      */
  154.     public void setClassName(String className) {
  155.         this.className = className;
  156.     }

  157.     /**
  158.      * @return the message
  159.      */
  160.     public String getMessage() {
  161.         return message;
  162.     }

  163.     /**
  164.      * @param message
  165.      *            the message to set
  166.      */
  167.     public void setMessage(String message) {
  168.         this.message = message;
  169.     }

  170. }