FileDocCategorySizeDatePackage
Client_53.javaAPI DocExample1844Sun Nov 04 14:04:22 GMT 2001com.titan.clients

Client_53

public class Client_53 extends Object
Example of using EJBObject to retrieve home interface.

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

		return new InitialContext();
	
public static voidgetTheEJBHome(com.titan.travelagent.TravelAgentRemote agent)


		// The home interface is out of scope in this method,
		// so it must be obtained from the EJB object.
		Object ref = agent.getEJBHome();
		TravelAgentHomeRemote home = (TravelAgentHomeRemote)
			PortableRemoteObject.narrow(ref,TravelAgentHomeRemote.class);

		// Do something useful with the home interface
		EJBMetaData meta = home.getEJBMetaData();
		System.out.println(meta.getHomeInterfaceClass().getName());
		System.out.println(meta.getRemoteInterfaceClass().getName());
		System.out.println(meta.isSession());
        //System.exit(0);

	
public static voidmain(java.lang.String[] args)

		try {
			Context jndiContext = getInitialContext();  
			Object ref = jndiContext.lookup("TravelAgentHome");
			TravelAgentHomeRemote home = (TravelAgentHomeRemote)
				PortableRemoteObject.narrow(ref,TravelAgentHomeRemote.class);

			// Get a remote reference to the bean (EJB object).
			TravelAgentRemote agent = home.create();
			// Pass the remote reference to some method.
			getTheEJBHome(agent);

        } catch (java.rmi.RemoteException re){re.printStackTrace();}
          catch (Throwable t){t.printStackTrace();}