1 package com.jbidwatcher.auction; 2 3 import com.jbidwatcher.util.Currency; 4 5 import java.util.TimeZone; 6 import java.net.URL; 7 import java.io.FileNotFoundException; 8 9 /** 10 * User: Morgan 11 * Date: Feb 20, 2007 12 * Time: 1:10:47 AM 13 * To change this template use File | Settings | File Templates. 14 */ 15 public interface AuctionServerInterface { 16 int BID_ERROR_UNKNOWN=-1; 17 int BID_ERROR_CANNOT=1; 18 int BID_ERROR_AMOUNT=2; 19 int BID_ERROR_OUTBID=3; 20 int BID_WINNING=4; 21 int BID_SELFWIN=5; 22 // int BID_DUTCH_CONFIRMED=6; -- This is obsolete. 23 int BID_ERROR_MULTI=7; 24 int BID_ERROR_TOO_LOW=8; 25 int BID_ERROR_ENDED=9; 26 int BID_ERROR_BANNED=10; 27 int BID_ERROR_RESERVE_NOT_MET=11; 28 int BID_ERROR_CONNECTION=12; 29 int BID_ERROR_TOO_LOW_SELF = 13; // You can't bid that low against yourself... 30 int BID_ERROR_AUCTION_GONE = 14; // Auction vanished between bid creation and submission. 31 int BID_ERROR_NOT_BIN = 15; // Trying to 'Buy' an item that isn't a BIN/Fixed Price listing. 32 int BID_BOUGHT_ITEM = 16; // Successfully bought an item via BIN. 33 int BID_ERROR_ACCOUNT_SUSPENDED = 17; // Your account has been (!) suspended, you can't bid. 34 int BID_ERROR_CANT_SIGN_IN = 18; // We tried to get bid pages, but it kept asking for login. 35 int BID_ERROR_WONT_SHIP = 19; // You are registered in a country to which the seller doesn't ship. 36 int BID_ERROR_REQUIREMENTS_NOT_MET = 20; // This seller has set buyer requirements for this item and only sells to buyers who meet those requirements. 37 int BID_ERROR_SELLER_CANT_BID=21; // Sellers can not bid on their own items 38 int BID_NOT_AVAILABLE_FOR_PURCHASE=22; // Item is not available for purchase (generally on eBay US). 39 String UPDATE_LOGIN_COOKIE = "Update login cookie"; 40 buy(String auctionId, int quantity)41 int buy(String auctionId, int quantity); 42 extractIdentifierFromURLString(String urlStyle)43 String extractIdentifierFromURLString(String urlStyle); 44 bid(String auctionId, Currency inBid, int inQuantity)45 int bid(String auctionId, Currency inBid, int inQuantity); 46 getMinimumBidIncrement(Currency currentBid, int bidCount)47 Currency getMinimumBidIncrement(Currency currentBid, int bidCount); 48 49 /** 50 * @brief Get the URL (in String form that a browser can view with) for a given item ID on this auction server. 51 * 52 * @param itemID - The item to retrieve the URL for. 53 * 54 * @return - A String with the full URL of the item description on the auction server. 55 */ getBrowsableURLFromItem(String itemID)56 String getBrowsableURLFromItem(String itemID); 57 getTime()58 String getTime(); 59 60 /** 61 * @brief Load an auction from the server based on item ID, and return it. 62 * 63 * @param itemId - The auction item id to load and create. 64 * 65 * @return - The underlying 'AuctionInfo' object that contains all 66 * the basic accessors for auction data. 67 */ create(String itemId)68 AuctionInfo create(String itemId); 69 70 /** 71 * @brief Get the human-readable auction site name for this server. 72 * 73 * @return - A String with the human-readable auction site name. 74 */ getName()75 String getName(); 76 77 /** 78 * @brief Get the specific site name for this AuctionServer instance. 79 * 80 * @return - A String with the site name this server refers to; generally associated with the string bundle being used by the server. 81 */ getFriendlyName()82 String getFriendlyName(); 83 84 /** 85 * @brief Returns the difference in time between the local machine's 86 * normalized time, and the auction site's normalized time. 87 * 88 * @return The amount of milliseconds off the server time is from 89 * local time. 90 */ getServerTimeDelta()91 long getServerTimeDelta(); 92 93 /** 94 * @brief Retrieve what time zone the server is in. 95 * 96 * @return - The time zone of the auction server. 97 */ getOfficialServerTimeZone()98 TimeZone getOfficialServerTimeZone(); 99 reload(String auctionId)100 void reload(String auctionId); 101 102 /** 103 * @brief Returns the amount of time it takes to retrieve a page 104 * from the auction server. 105 * 106 * @return The amount of milliseconds it takes to get a simple page 107 * from the auction server. 108 */ getPageRequestTime()109 long getPageRequestTime(); 110 getAdjustedTime()111 public long getAdjustedTime(); 112 reloadTime()113 void reloadTime(); 114 validate(String username, String password)115 public boolean validate(String username, String password); 116 isDefaultUser()117 boolean isDefaultUser(); 118 getStringURLFromItem(String identifier)119 String getStringURLFromItem(String identifier); 120 getAuction(URL url)121 StringBuffer getAuction(URL url) throws FileNotFoundException; 122 isCurrentUser(String checkUser)123 boolean isCurrentUser(String checkUser); 124 updateHighBid(String auctionId)125 void updateHighBid(String auctionId); 126 stripId(String source)127 String stripId(String source); 128 setSnipe(String auctionId)129 void setSnipe(String auctionId); 130 cancelSnipe(String identifier)131 void cancelSnipe(String identifier); 132 } 133