Methods Summary |
---|
public static javax.naming.Context | getInitialContext()
java.util.Properties properties = new java.util.Properties();
properties.put(javax.naming.Context.PROVIDER_URL, "iiop:///");
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext initialContext = new InitialContext(properties);
return initialContext;
|
public static void | getTheEJBHome(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());
|
public static void | main(java.lang.String[] args)
try {
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("TravelAgentHomeRemote");
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();}
|