FileDocCategorySizeDatePackage
Client_122c.javaAPI DocExample1849Wed May 29 18:19:18 BST 2002com.titan.clients

Client_122c

public class Client_122c extends Object
Lists available cabins for a specific Cruise having a desired number of beds Uses command-line parameters: java com.titan.clients.Client_127

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

		return new InitialContext();
    
public static voidmain(java.lang.String[] args)



		if (args.length != 2) {
			System.out.println("Usage: java com.titan.clients.Client_122c <cruiseID> <bedCount>");
			System.exit(-1);
		}

		Integer cruiseID = new Integer(args[0]);
		int bedCount = new Integer(args[1]).intValue();

		Context jndiContext = getInitialContext();
		Object obj = jndiContext.lookup("TravelAgentHomeRemote");
		TravelAgentHomeRemote tahome = (TravelAgentHomeRemote) 
			javax.rmi.PortableRemoteObject.narrow(obj, TravelAgentHomeRemote.class);

		// Start the Stateful session bean
		System.out.println("Starting TravelAgent Session...");
		TravelAgentRemote tagent = tahome.create(null);

		// Set the other bean parameters in agent bean
		System.out.println("Setting Cruise information in TravelAgent..");
		tagent.setCruiseID(cruiseID);

		String[] results = tagent.listAvailableCabins(bedCount);

		System.out.println("Ending TravelAgent Session...");
		tagent.remove();

		System.out.println("Result of listAvailableCabins:");
		for (int kk=0; kk<results.length; kk++) {
			System.out.println(results[kk]);
		}