try{
Context jndiContext = getInitialContext();
// Obtain a list of all the cabins for ship 1 with 3 bed count
TravelAgentHome agentHome =
(TravelAgentHome)jndiContext.lookup("TravelAgentHome");
TravelAgent agent = agentHome.create();
String list [] = agent.listCabins(1,3);
System.out.println("1st List: Before deleting cabin number 30");
for(int i = 0; i < list.length; i++){
System.out.println(list[i]);
}
// obtain the CabinHome and remove cabin 30. Rerun the same cabin list.
CabinHome c_home = (CabinHome)jndiContext.lookup("CabinHome");
CabinPK pk = new CabinPK();
pk.id = 30;
c_home.remove(pk);
list = agent.listCabins(1,3);
System.out.println("2nd List: After deleting cabin number 30");
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();}