Package org.archive.wayback.core

Examples of org.archive.wayback.core.Timestamp


    req.setRequestUrl(url.toString());
    req.put(WaybackConstants.REQUEST_TYPE,
        WaybackConstants.REQUEST_CLOSEST_QUERY);
    req.put(WaybackConstants.REQUEST_EXACT_DATE,
        Timestamp.currentTimestamp().getDateStr());
    Timestamp earliest = null;
    if(bUseOlder) {
      earliest = Timestamp.earliestTimestamp();
    } else {
      Date d = new Date(System.currentTimeMillis() - maxCacheMS);
      earliest = new Timestamp(d);
    }
    req.put(WaybackConstants.REQUEST_START_DATE,earliest.getDateStr());
    // for now, assume all live web requests are only satisfiable by the
    // exact host -- no massaging.
    req.put(WaybackConstants.REQUEST_EXACT_HOST_ONLY,
        WaybackConstants.REQUEST_YES);
    return req;
View Full Code Here


    return req;
  }
 
  private boolean isForgedFailRecentEnough(SearchResult result) {
    String captureDate = result.get(WaybackConstants.RESULT_CAPTURE_DATE);
    Timestamp t = new Timestamp(captureDate);
    long maxAge = System.currentTimeMillis() - maxFailedCacheMS;
    long failAge = t.getDate().getTime();
    if(failAge > maxAge) {
      return true;
    }
    return false;
  }
View Full Code Here

    public TimestampComparator(Timestamp wanted) {
      wantedSSE = wanted.sse();
    }
    private int searchResultToDistance(SearchResult sr) {
      String dateStr = sr.get(WaybackConstants.RESULT_CAPTURE_DATE);
      Timestamp ts = new Timestamp(dateStr);
      return Math.abs(wantedSSE - ts.sse());
    }
View Full Code Here

   * @param wbRequest
   * @return ArrayList of ResultsPartition objects
   */
  public static ArrayList<ResultsPartition> get(SearchResults results,
      WaybackRequest wbRequest) {
    Timestamp startTS = Timestamp.parseBefore(results.getFilter(
        WaybackConstants.REQUEST_START_DATE));
    Timestamp endTS = Timestamp.parseAfter(results.getFilter(
        WaybackConstants.REQUEST_END_DATE));
   
    String rsd = startTS.getDateStr();
    String red = endTS.getDateStr();

    Date startDate = startTS.getDate();
    Date endDate = endTS.getDate();

    long msSpanned = endDate.getTime() - startDate.getTime();
    int secsSpanned = (int) Math.ceil(msSpanned / 1000);

    ResultsPartitioner partitioner = null;
View Full Code Here

  /**
   * @param timestamp
   * @return Date for the timestamp string
   */
  public Date timestampToDate(String timestamp) {
    return new Timestamp(timestamp).getDate();
  }
View Full Code Here

  /**
   * @param result
   * @return Date representing captureDate of SearchResult result
   */
  public Date resultToDate(SearchResult result) {
    Timestamp t = new Timestamp(result.get(
        WaybackConstants.RESULT_CAPTURE_DATE));
    return t.getDate();
  }
View Full Code Here

TOP

Related Classes of org.archive.wayback.core.Timestamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.