FileDocCategorySizeDatePackage
Client.javaAPI DocJBoss 4.2.12145Fri Jul 13 20:55:24 BST 2007org.jboss.tutorial.entity.client

Client

public class Client extends Object
Comment
author
Bill Burke
version
$Revision: 57207 $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

      InitialContext ctx = new InitialContext();
      ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCartBean/remote");

      System.out.println("Buying 2 memory sticks");
      cart.buy("Memory stick", 2, 500.00);
      System.out.println("Buying a laptop");
      cart.buy("Laptop", 1, 2000.00);

      System.out.println("Print cart:");
      Order order = cart.getOrder();
      System.out.println("Total: $" + order.getTotal());
      for (LineItem item : order.getLineItems())
      {
         System.out.println(item.getQuantity() + "     " + item.getProduct() + "     " + item.getSubtotal());
      }

      System.out.println("Checkout");
      cart.checkout();