FileDocCategorySizeDatePackage
Client_1.javaAPI DocExample1410Tue Dec 14 12:25:46 GMT 1999com.titan.travelagent

Client_1

public class Client_1 extends Object

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

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


         
        try {
           Context jndiContext = getInitialContext();
           Object obj = jndiContext.lookup("ejb/TravelAgentHome");
           TravelAgentHome home = (TravelAgentHome) javax.rmi.PortableRemoteObject.narrow(obj, TravelAgentHome.class);

           TravelAgent reserve = home.create();
        
           // Get a list of all cabins on ship 1 with a bed count of 3.
           String list [] = reserve.listCabins(SHIP_ID,BED_COUNT);
        
           for(int i = 0; i < list.length; i++){
              System.out.println(list[i]);
           }
        
        } catch(java.rmi.RemoteException re){re.printStackTrace();}
          catch(Throwable t){t.printStackTrace();}