FileDocCategorySizeDatePackage
Client_5.javaAPI DocExample1799Sun Mar 07 08:38:24 GMT 1999com.titan.travelagent

Client_5

public class Client_5 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static javax.naming.ContextgetInitialContext()

    Properties p = new Properties();
    // ... specify the JNDI properties specific to the vendor
    return new InitialContext(p);
  
public static voidmain(java.lang.String[] args)

        try{


            Context jndiContext = getInitialContext();
            CustomerHome ch = (CustomerHome)jndiContext.lookup("CustomerHome");


            CustomerPK pk = new CustomerPK();
            pk.id = 1;
            Customer customer = ch.findByPrimaryKey(pk);

            TravelAgentHome home = (TravelAgentHome)jndiContext.lookup("TravelagentHome");

            TravelAgent agent = home.create(customer);

            agent.setCruiseID(1);
            String list [] = agent.listAvailableCabins(2);

            for(int i = 0; i < list.length; i++){
                System.out.println(list[i]);
            }

            agent.setCabinID(1);
            GregorianCalendar gc = new GregorianCalendar();
            gc.set(1999,10,31);
            CreditCard card = new CreditCard(83872938749209l,gc.getTime() , CreditCard.VISA);
            Ticket t = agent.bookPassage(card,27999.99d);
            System.out.println(t);



        }catch(java.rmi.RemoteException re)
           {
             System.out.println("RemoteException thrown");
             re.printStackTrace();
             if(re.detail != null)
                re.detail.printStackTrace();
           }
        catch(Throwable t)
           {
            t.printStackTrace();
           }