Exemple #1
0
  private void retrieveAndVerifyAuctions(List<String> params) {
    if (params.size() == 0) return;
    try {
      if (params.size() > 1) {
        XMLElement auctionList = new XMLElement("auctions");
        for (String id : params) {
          XMLElement xmlized = EntryFactory.getInstance().retrieveAuctionXML(id);
          if (xmlized != null) auctionList.addChild(xmlized);
        }
        JConfig.log().logMessage(auctionList.toString());
      } else {
        StringBuffer auctionXML =
            EntryFactory.getInstance().retrieveAuctionXMLString(params.get(0));
        if (auctionXML != null) {
          JConfig.log().logMessage(auctionXML.toString());
          XMLElement xmlized = new XMLElement();
          xmlized.parseString(auctionXML.toString());

          if (JConfig.debugging() && mTestQuantity) {
            AuctionEntry ae2 = EntryFactory.getInstance().constructEntry();
            ae2.fromXML(xmlized);
            JConfig.log().logDebug("ae2.quantity == " + ae2.getQuantity());
          }
        }
      }
    } catch (Exception dumpMe) {
      JConfig.log()
          .handleException("Failure during serialization or deserialization of an auction", dumpMe);
    }
  }
Exemple #2
0
 private void buildAuctionEntryFromFile(String fname) {
   StringBuffer sb = new StringBuffer(StringTools.cat(fname));
   try {
     long start = System.currentTimeMillis();
     AuctionInfo ai = mEbay.doParse(sb);
     AuctionEntry ae = EntryFactory.getInstance().constructEntry();
     ae.setAuctionInfo(ai);
     System.out.println("Took: " + (System.currentTimeMillis() - start));
     JConfig.log().logMessage(ae.toXML().toString());
   } catch (Exception e) {
     JConfig.log().handleException("Failed to load auction from file: " + fname, e);
   }
 }
Exemple #3
0
  public static void main(String[] args) {
    JConfig.setLogger(new ErrorManagement());
    ActiveRecord.disableDatabase();
    AuctionEntry.addObserver(EntryFactory.getInstance());
    AuctionEntry.addObserver(
        new Observer<AuctionEntry>() {
          public void afterCreate(AuctionEntry o) {
            EntryCorral.getInstance().putWeakly(o);
          }
        });
    JBTool tool = new JBTool(args);

    tool.execute();
    System.exit(0);
  }