コード例 #1
0
ファイル: EJBCustomer.java プロジェクト: pobrienjhu/ase_w4156
  /** @param args */
  public static void main(String[] args) {

    try {
      AuctionHouseRemote auctionHouse = doLookup();

      Integer custId = auctionHouse.registerCustomer();

      EJBCustomer customer = new EJBCustomer(auctionHouse, custId.intValue());

      (new Thread(customer)).start();
    } catch (Exception e) {
      System.out.println("Unable to start EJB Customer. Root Cause (" + e.getMessage() + ")");
    }
  }
コード例 #2
0
ファイル: EJBCustomer.java プロジェクト: pobrienjhu/ase_w4156
  private void placeBid(AuctionHouseRemote auctionHouse) throws Exception {
    Scanner scanner = new Scanner(System.in);

    System.out.println("");
    System.out.println("Enter the id of the auction you wish to bid on:");
    int auctionId = scanner.nextInt();
    System.out.println("Enter the price you wish to bid:");
    double bidAmount = scanner.nextDouble();

    auctionHouse.acceptBid(new AuctionBid(auctionId, customerId, bidAmount, new Date()));

    System.out.println("Bid of " + bidAmount + " accepted for auction " + auctionId);
  }
コード例 #3
0
ファイル: EJBCustomer.java プロジェクト: pobrienjhu/ase_w4156
  private void getAuctionListings(AuctionHouseRemote auctionHouse) {
    Collection<Auction> auctions = auctionHouse.getActiveAuctions();

    if (auctions.size() == 0) {
      System.out.println("Nothing for Sale yet!");
      return;
    }

    System.out.println("Current active auctions:");

    for (Auction auction : auctions) {
      System.out.println(
          "	Auction |"
              + auction.getAuctionId()
              + "| for item |"
              + auction.getItem().getItemName()
              + "| condition: |"
              + auction.getItemCondition()
              + "| current price: |"
              + auction.getCurrentPrice()
              + "|");
    }
  }