FileDocCategorySizeDatePackage
Client_41.javaAPI DocExample2091Sat Nov 24 13:49:28 GMT 2001com.titan.clients

Client_41

public class Client_41 extends Object

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 javax.naming.InitialContext(p);
            return new InitialContext();
    
public static voidmain(java.lang.String[] args)

        try {
            Context jndiContext = getInitialContext();
            Object ref = jndiContext.lookup("CabinHomeRemote");
            CabinHomeRemote home = (CabinHomeRemote)
				PortableRemoteObject.narrow(ref,CabinHomeRemote.class);   
           
            if ( ref != null )
            {
                System.out.println(" Found Cabin Home");
            }
            CabinRemote cabin_1 = home.create(new Integer(1));
            cabin_1.setName("Master Suite");
            cabin_1.setDeckLevel(1);
            cabin_1.setShipId(1);
            cabin_1.setBedCount(3);

                
            Integer pk = new Integer(1);
            
            CabinRemote cabin_2 = home.findByPrimaryKey(pk);
            System.out.println(cabin_2.getName());
            System.out.println(cabin_2.getDeckLevel());
            System.out.println(cabin_2.getShipId());
            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();}
          
          System.exit(0);