Clean up queueing so that the majority of queued events are strings. This allows putting them in a persistent queue store. The default 'enqueue' is string-only now. Classes that want object-enqueueing can cast to PlainMessageQueue and call enqueueObject. Syntactic vinegar.
Make many relatively simple value objects that get passed around in queues implement the bean specification, so they can be passed around as XML instead. (This is done with 'enqueueBean', a terrible name, but dequeued objects are automatically unmarshalled back into the correct objects.)
Everything that passed around an AuctionEntry object to a queue now just passes the identifier, and the queue processor gets the entry from EntryCorral. There may be a better way to do this, but for now, this works.
The TimeQueueManager does unpleasant things to manage the differences between different kinds of payloads that need to be delivered. Possibly wrong things, also.
Canceling and setting snipes go directly to the server, instead of being queued, since it's not a long-running operation. (Lowering the number of moving parts in sniping operations.)
Thumbnail lookup and handling just involves a String URL, which is turned into real URL in the manager. This allows the thumbnail manager to be the only one that actually downloads the images, instead of the ebayAuction object.
The code to clear out multiple TIMECHECK operations is removed.
There is a custom Searcher serialize/deserialize method that calls on SearchManager.getSearchById() to only load the right item. Theoretically I could do this for enqueuing AuctionEntry objects (on deserialize, pull them from EntryCorral) also, but...not right now.
I hate making huge checkins like this, but once I started making deep changes to the queueing infrastructure, I couldn't check it in until it was all at least stable and working.
- ~
- jbidwatcher
- trunk
- test
- com
- jbidwatcher
- auction
- MockAuctionServerInterface.java
| MockAuctionServerInterface.java |
|---|
mrs 1 package com.jbidwatcher.auction; mrs 2 mrs 3 import com.jbidwatcher.util.Currency; mrs 4 mrs 5 import java.util.TimeZone; mrs 6 import java.net.URL; mrs 7 import java.io.FileNotFoundException; mrs 8 mrs 9 /** mrs 10 * Created by IntelliJ IDEA. mrs 11 * User: mrs mrs 12 * Date: Jan 16, 2009 mrs 13 * Time: 4:26:26 AM mrs 14 * To change this template use File | Settings | File Templates. mrs 15 */ mrs 16 class MockAuctionServerInterface implements AuctionServerInterface { mrs 17 MockAuctionInfo mMock; mrs 18 mrs 19 public MockAuctionServerInterface(MockAuctionInfo mai) { mrs 20 mMock = mai; mrs 21 } mrs 22 mrs 23 public int buy(AuctionEntry ae, int quantity) { mrs 24 return 0; mrs 25 } mrs 26 mrs 27 public int bid(AuctionEntry inEntry, Currency inBid, int inQuantity) { mrs 28 return 0; mrs 29 } mrs 30 mrs 31 public String extractIdentifierFromURLString(String urlStyle) { mrs 32 return mMock.getIdentifier(); mrs 33 } mrs 34 mrs 35 public Currency getMinimumBidIncrement(Currency currentBid, int bidCount) { mrs 36 return null; mrs 37 } mrs 38 mrs 39 public String getBrowsableURLFromItem(String itemID) { mrs 40 return "http://test.host/" + itemID; mrs 41 } mrs 42 mrs 43 public String getTime() { mrs 44 return null; mrs 45 } mrs 46 mrs 47 public AuctionInfo create(String itemId) { mrs 48 return mMock; mrs 49 } mrs 50 mrs 51 public String getName() { mrs 52 return "mock"; mrs 53 } mrs 54 mrs 55 public long getServerTimeDelta() { mrs 56 return 0; mrs 57 } mrs 58 mrs 59 public TimeZone getOfficialServerTimeZone() { mrs 60 return null; mrs 61 } mrs 62 mrs 63 public AuctionInfo reload(AuctionEntry inEntry) { mrs 64 return mMock; mrs 65 } mrs 66 mrs 67 public long getPageRequestTime() { mrs 68 return 0; mrs 69 } mrs 70 mrs 71 public long getAdjustedTime() { mrs 72 return 0; mrs 73 } mrs 74 mrs 75 public void reloadTime() { } mrs 76 mrs 77 public boolean validate(String username, String password) { mrs 78 return true; mrs 79 } mrs 80 mrs 81 public boolean isDefaultUser() { mrs 82 return false; mrs 83 } mrs 84 mrs 85 public String getStringURLFromItem(String identifier) { mrs 86 return "http://test.host/" + identifier; mrs 87 } mrs 88 mrs 89 public StringBuffer getAuction(URL url) throws FileNotFoundException { mrs 90 throw new FileNotFoundException("Mocks don't have files"); mrs 91 } mrs 92 mrs 93 public boolean isCurrentUser(String checkUser) { mrs 94 return false; mrs 95 } mrs 96 mrs 97 public boolean isHighDutch(EntryInterface entry) { mrs 98 return false; mrs 99 } mrs 100 mrs 101 public void updateHighBid(AuctionEntry eEntry) { } mrs 102 mrs 103 public String stripId(String source) { mrs 104 return mMock.getIdentifier(); mrs 105 } mrs 106 mrs 107 public void setSnipe(AuctionEntry snipeOn) { } mrs 108 mrs 109 public void cancelSnipe(EntryInterface snipeCancel) { } mrs 110 }
Check out the code: svn co jbidwatcher/trunk/test/com/jbidwatcher/auction/MockAuctionServerInterface.java
