File Source: PingQueueEntry.java

         /* 
    P/P   *  Method: void readObject(ObjectInputStream)
          * 
          *  Preconditions:
          *    Param_1 != null
          * 
          *  Presumptions:
          *    init'ed(org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED)
          * 
          *  Postconditions:
          *    Param_0.pcDetachedState == org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED
          *    (soft) init'ed(Param_0.pcDetachedState)
          */
     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   * contributor license agreements.  The ASF licenses this file to You
     4   * under the Apache License, Version 2.0 (the "License"); you may not
     5   * use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *   http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.  For additional information regarding
    15   * copyright in this work, please see the NOTICE file in the top level
    16   * directory of this distribution.
    17   */
    18  
    19  package org.apache.roller.weblogger.pojos;
    20  
    21  import java.io.Serializable;
    22  import java.sql.Timestamp;
    23  import org.apache.commons.lang.builder.EqualsBuilder;
    24  import org.apache.commons.lang.builder.HashCodeBuilder;
    25  import org.apache.roller.util.UUIDGenerator;
    26  
    27  
    28  /**
    29   * Ping queue entry.  Each instance of this class represents an entry on the ping queue. The entry indicates when it was
    30   * added to the queue, which configuration to apply for the ping, and the number of ping attempts that have been made
    31   * for this entry so far.
    32   * 
    33   * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
    34   */
    35  public class PingQueueEntry implements Serializable {
    36      
    37      private String id = UUIDGenerator.generateUUID();
    38      private Timestamp entryTime = null;
    39      private PingTarget pingTarget = null;
    40      private Weblog website = null;
    41      private int attempts = 0;
    42  
    43      public static final long serialVersionUID = -1468021030819538243L;
    44  
    45      
    46      /**
    47       * Default constructor.  Leaves all fields at Java-specified default values.
    48       */
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.PingQueueEntry()
              * 
              *  Postconditions:
              *    this.attempts == 0
              *    this.entryTime == null
              *    this.pingTarget == null
              *    this.website == null
              *    init'ed(this.id)
              */
    49      public PingQueueEntry() {
    50      }
    51  
    52      /**
    53       * Construct with all members
    54       *
    55       * @param id         unique id of this entry
    56       * @param entryTime  timestamp of first entry onto queue
    57       * @param pingTarget target site to ping
    58       * @param website    website originating the ping
    59       * @param attempts   number of prior ping attempts
    60       */
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.PingQueueEntry(String, Timestamp, PingTarget, Weblog, int)
              * 
              *  Postconditions:
              *    this.attempts == attempts
              *    init'ed(this.attempts)
              *    this.entryTime == entryTime
              *    init'ed(this.entryTime)
              *    init'ed(this.id)
              *    this.pingTarget == pingTarget
              *    init'ed(this.pingTarget)
              *    this.website == website
              *    init'ed(this.website)
              */
    61      public PingQueueEntry(String id, Timestamp entryTime, PingTarget pingTarget, Weblog website, int attempts) {
    62          //this.id = id;
    63          this.entryTime = entryTime;
    64          this.pingTarget = pingTarget;
    65          this.website = website;
    66          this.attempts = attempts;
    67      }
    68  
    69      /**
    70       * Get the unique id (primary key) of this object.
    71       *
    72       * @return the unique id of this object.
    73       */
    74      public String getId() {
                 /* 
    P/P           *  Method: String pcgetId()
                  * 
                  *  Preconditions:
                  *    init'ed(this.id)
                  * 
                  *  Postconditions:
                  *    return_value == this.id
                  *    init'ed(return_value)
                  */
    75          return id;
    76      }
    77  
    78      /**
    79       * Set the unique id (primary key) of this object.
    80       *
    81       * @param id
    82       */
    83      public void setId(String id) {
                 /* 
    P/P           *  Method: void pcsetId(String)
                  * 
                  *  Postconditions:
                  *    this.id == Param_1
                  *    init'ed(this.id)
                  */
    84          this.id = id;
    85      }
    86  
    87      /**
    88       * Get the entry time.  Get the time this entry was first added to the queue.
    89       *
    90       * @return the time the entry was first added to the queue.
    91       */
    92      public Timestamp getEntryTime() {
                 /* 
    P/P           *  Method: Timestamp pcgetEntryTime()
                  * 
                  *  Preconditions:
                  *    init'ed(this.entryTime)
                  * 
                  *  Postconditions:
                  *    return_value == this.entryTime
                  *    init'ed(return_value)
                  */
    93          return entryTime;
    94      }
    95  
    96      /**
    97       * Set the entry time.
    98       *
    99       * @param entryTime the time the entry was first added to the queue.
   100       */
   101      public void setEntryTime(Timestamp entryTime) {
                 /* 
    P/P           *  Method: void pcsetEntryTime(Timestamp)
                  * 
                  *  Postconditions:
                  *    this.entryTime == Param_1
                  *    init'ed(this.entryTime)
                  */
   102          this.entryTime = entryTime;
   103      }
   104  
   105      /**
   106       * Get the ping target.  Get the target to ping.
   107       *
   108       * @return the ping target to ping.
   109       */
   110      public PingTarget getPingTarget() {
                 /* 
    P/P           *  Method: PingTarget pcgetPingTarget()
                  * 
                  *  Preconditions:
                  *    init'ed(this.pingTarget)
                  * 
                  *  Postconditions:
                  *    return_value == this.pingTarget
                  *    init'ed(return_value)
                  */
   111          return pingTarget;
   112      }
   113  
   114      /**
   115       * Set the ping target.
   116       *
   117       * @param pingTarget target to ping.
   118       */
   119      public void setPingTarget(PingTarget pingTarget) {
                 /* 
    P/P           *  Method: void pcsetPingTarget(PingTarget)
                  * 
                  *  Postconditions:
                  *    this.pingTarget == Param_1
                  *    init'ed(this.pingTarget)
                  */
   120          this.pingTarget = pingTarget;
   121      }
   122  
   123      /**
   124       * Get the website originating the ping.
   125       *
   126       * @return the website originating the ping.
   127       */
   128      public Weblog getWebsite() {
                 /* 
    P/P           *  Method: Weblog pcgetWebsite()
                  * 
                  *  Preconditions:
                  *    init'ed(this.website)
                  * 
                  *  Postconditions:
                  *    return_value == this.website
                  *    init'ed(return_value)
                  */
   129          return website;
   130      }
   131  
   132      /**
   133       * Set the website originating the ping.
   134       *
   135       * @param website the website originating the ping.
   136       */
   137      public void setWebsite(Weblog website) {
                 /* 
    P/P           *  Method: void pcsetWebsite(Weblog)
                  * 
                  *  Postconditions:
                  *    this.website == Param_1
                  *    init'ed(this.website)
                  */
   138          this.website = website;
   139      }
   140  
   141      /**
   142       * Get the number of ping attempts that have been made for this queue entry.
   143       *
   144       * @return the number of ping attempts that have been made for this queue entry.
   145       */
   146      public int getAttempts() {
                 /* 
    P/P           *  Method: int pcgetAttempts()
                  * 
                  *  Preconditions:
                  *    init'ed(this.attempts)
                  * 
                  *  Postconditions:
                  *    return_value == this.attempts
                  *    init'ed(return_value)
                  */
   147          return attempts;
   148      }
   149  
   150      /**
   151       * Set the number of failures that have occurred for this queue entry.
   152       *
   153       * @param attempts
   154       */
   155      public void setAttempts(int attempts) {
                 /* 
    P/P           *  Method: void pcsetAttempts(int)
                  * 
                  *  Postconditions:
                  *    this.attempts == Param_1
                  *    init'ed(this.attempts)
                  */
   156          this.attempts = attempts;
   157      }
   158  
   159      /**
   160       * Increment the number of failures for this queue entry.
   161       *
   162       * @return the new value.
   163       */
   164      public int incrementAttempts() {
                 /* 
    P/P           *  Method: int incrementAttempts()
                  * 
                  *  Preconditions:
                  *    this.attempts <= 232-2
                  * 
                  *  Postconditions:
                  *    return_value == old this.attempts + 1
                  *    return_value >= -231+1
                  *    this.attempts == return_value
                  */
   165          return ++attempts;
   166      }
   167  
   168      //------------------------------------------------------- Good citizenship
   169  
   170      public String toString() {
                 /* 
    P/P           *  Method: String toString()
                  * 
                  *  Preconditions:
                  *    init'ed(this.attempts)
                  *    init'ed(this.entryTime)
                  *    init'ed(this.id)
                  * 
                  *  Postconditions:
                  *    java.lang.StringBuffer:toString(...)._tainted == this.id._tainted
                  *    init'ed(java.lang.StringBuffer:toString(...)._tainted)
                  *    return_value == &java.lang.StringBuffer:toString(...)
                  */
   171          StringBuffer buf = new StringBuffer();
   172          buf.append("{");
   173          buf.append(this.id);
   174          buf.append(", ").append(this.entryTime);
   175          buf.append(", ").append(this.attempts);
   176          buf.append("}");
   177          return buf.toString();
   178      }
   179      
   180      public boolean equals(Object other) {
                 /* 
    P/P           *  Method: bool equals(Object)
                  * 
                  *  Preconditions:
                  *    (soft) init'ed(other.entryTime)
                  *    (soft) init'ed(other.pcStateManager)
                  *    (soft) init'ed(other.website)
                  *    (soft) pcInheritedFieldCount <= 232-5
                  *    (soft) init'ed(this.entryTime)
                  *    (soft) init'ed(this.pcStateManager)
                  *    (soft) init'ed(this.website)
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.EqualsBuilder:append(...)@184 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  * 
                  *  Test Vectors:
                  *    other == this: {0}, {1}
                  */
   181          if (other == this) return true;
   182          if (other instanceof PingQueueEntry != true) return false;
   183          PingQueueEntry o = (PingQueueEntry)other;
   184          return new EqualsBuilder()
   185              .append(getEntryTime(), o.getEntryTime()) 
   186              .append(getWebsite(), o.getWebsite()) 
   187              .isEquals();
   188      }
   189      
   190      public int hashCode() { 
                 /* 
    P/P           *  Method: int hashCode()
                  * 
                  *  Preconditions:
                  *    init'ed(this.entryTime)
                  *    init'ed(this.pcStateManager)
                  *    init'ed(this.website)
                  *    (soft) pcInheritedFieldCount <= 232-5
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.HashCodeBuilder:append(...)@191 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
   191          return new HashCodeBuilder()
   192              .append(getEntryTime())
   193              .append(getWebsite())
   194              .toHashCode();
   195      }
   196      
   197  }
+  198  Other Messages








SofCheck Inspector Build Version : 2.18479
PingQueueEntry.java 2009-Jan-02 14:25:10
PingQueueEntry.class 2009-Sep-04 03:12:38