FileDocCategorySizeDatePackage
Client_127.javaAPI DocExample2025Fri Sep 07 17:00:36 BST 2001com.titan.clients

Client_127

public class Client_127 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()

		Properties p = new Properties();
		p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");  
		p.put(Context.PROVIDER_URL, "t3://localhost:7001");
		return new InitialContext(p);
    
public static voidmain(java.lang.String[] args)



		if (args.length != 2) {
			System.out.println("Usage: java com.titan.clients.Client_127 <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]);
		}