Methods Summary |
---|
public static javax.naming.Context | getGemstoneInitialContext()
Properties p = new Properties();
// Uncomment if you have the com.gemstone.* classes available
//p.put(com.gemstone.naming.Defaults.NAME_SERVICE_HOST,"localhost");
String port = System.getProperty("com.gemstone.naming.NameServicePort",
"10200");
// Uncomment if you have the com.gemstone.* classes available
//p.put(com.gemstone.naming.Defaults.NAME_SERVICE_PORT, port);
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.gemstone.naming.GsCtxFactory");
return new InitialContext(p);
|
public static javax.naming.Context | getInitialContext()
Properties p = new Properties();
// ... Specify the JNDI properties specific to the vendor.
//return new javax.naming.InitialContext(p);
return getJ2EERIInitialContext();
|
public static javax.naming.Context | getJ2EERIInitialContext()
return new javax.naming.InitialContext();
|
public static javax.naming.Context | getWeblogicInitialContext()
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.TengahInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7001");
return new javax.naming.InitialContext(p);
|
public static void | main(java.lang.String[] args)
try {
Context jndiContext = getInitialContext();
CabinHome home = (CabinHome)jndiContext.lookup("CabinHome");
Cabin cabin_1 = home.create(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShip(1);
cabin_1.setBedCount(3);
CabinPK pk = new CabinPK();
pk.id = 1;
Cabin cabin_2 = home.findByPrimaryKey(pk);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShip());
System.out.println(cabin_2.getBedCount());
} catch (java.rmi.RemoteException re){re.printStackTrace();}
catch (javax.naming.NamingException ne){ne.printStackTrace();}
catch (javax.ejb.CreateException ce){ce.printStackTrace();}
catch (javax.ejb.FinderException fe){fe.printStackTrace();}
|