コード例 #1
0
  public void save() {
    String outPath = JConfig.queryConfiguration("auctions.savepath");
    if (outPath != null && outPath.length() != 0) {
      if (JConfig.queryConfiguration("store.auctionHTML", "true").equals("true")) {
        String filePath =
            outPath + System.getProperty("file.separator") + getIdentifier() + ".html.gz";

        if (mLoadedPage != null) {
          mLoadedPage.save(filePath);
        }
      }
    }
    mLoadedPage = null;
  }
コード例 #2
0
 File getContentFile() {
   File fp = null;
   String outPath = JConfig.queryConfiguration("auctions.savepath");
   if (outPath != null && outPath.length() != 0) {
     String filePath =
         outPath + System.getProperty("file.separator") + getIdentifier() + ".html.gz";
     fp = new File(filePath);
   }
   return fp;
 }
コード例 #3
0
  protected StringBuffer getContent() {
    StringBuffer sb;

    if (mLoadedPage != null) {
      StringBuffer outSB = mLoadedPage.getUncompressedData(false);
      if (outSB == null) outSB = new StringBuffer("mLoadedPage.getUncompressedData is null");
      sb = outSB;
    } else {
      JConfig.log().logDebug("mLoadedPage is null, returning the 'real' cached copy!");
      GZip gz = getRealContent();
      if (gz != null) {
        sb = gz.getUncompressedData();
        JConfig.log().logDebug("Turned the uncompressed data into a StringBuffer!");
        if (sb == null) JConfig.log().logDebug(" Failed to uncompress for id " + getIdentifier());
      } else {
        sb = new StringBuffer("Error getting real content.");
      }
    }
    return (sb);
  }
コード例 #4
0
  private GZip loadFile(File fp) {
    GZip localZip = new GZip();

    if (fp.exists()) {
      //  Okay, I don't allow loading auction data that's over 512K.  Duh.
      if (fp.length() < 512 * 1024) {
        try {
          JConfig.log().logDebug("Loading from backing page (file is " + fp.length() + " bytes)!");
          localZip.load(fp);
        } catch (IOException ioe) {
          JConfig.log().handleException("Couldn't read " + fp.getName(), ioe);
          return null;
        }

        return localZip;
      } else {
        JConfig.log().logDebug("Can't load " + fp.getName() + ", file is too large.");
      }
    }
    return null;
  }
コード例 #5
0
 @SuppressWarnings({"unchecked"})
 public static List<AuctionInfo> findLostAuctions() {
   List<AuctionInfo> resultSet;
   try {
     resultSet =
         (List<AuctionInfo>)
             findAllBySQL(
                 AuctionInfo.class,
                 "SELECT * FROM auctions WHERE identifier NOT IN (SELECT DISTINCT(identifier) FROM entries)");
   } catch (Exception e) {
     JConfig.log().handleDebugException("Failed to find lost auctions.", e);
     resultSet = null;
   }
   return resultSet;
 }
コード例 #6
0
  void setRealContent(byte[] changedContent, boolean final_data) {
    String outPath = JConfig.queryConfiguration("auctions.savepath");

    if (changedContent != null) {
      mLoadedPage = new GZip();
      mLoadedPage.setData(changedContent);

      if (outPath != null && outPath.length() != 0) {
        if (final_data) {
          String filePath =
              outPath + System.getProperty("file.separator") + getIdentifier() + ".html.gz";
          mLoadedPage.save(filePath);
          mLoadedPage = null;
        }
      }
    }
  }