FileDocCategorySizeDatePackage
Client_101.javaAPI DocExample1809Sun Feb 10 09:10:30 GMT 2002com.titan.clients

Client_101

public class Client_101 extends Object

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


                   return new InitialContext();
    
public static voidmain(java.lang.String[] args)


        try {
            Context jndiContext = getInitialContext();
            Object ref = jndiContext.lookup("ShipHomeRemote");
            ShipHomeRemote home = (ShipHomeRemote)
				PortableRemoteObject.narrow(ref,ShipHomeRemote.class);
            System.out.println("Creating Ship 101..");

            ShipRemote ship1 = home.create(new Integer(101),"Edmund Fitzgerald");

			ship1.setTonnage(50000.0);
			ship1.setCapacity(300);
               
            Integer pk = new Integer(101);

           System.out.println("Finding Ship 101 again..");
           ShipRemote ship2 = home.findByPrimaryKey(pk);
           System.out.println(ship2.getName());
           System.out.println(ship2.getTonnage());
           System.out.println(ship2.getCapacity());

          System.out.println("Removing Ship 101..");
          ship2.remove();

        }
        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();}
        catch (javax.ejb.RemoveException re){re.printStackTrace();}
       finally
       {
            System.exit(0);
       }