/*
 *
 * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the proprietary information of Sun Microsystems, Inc.  
 * Use is subject to license terms.
 * 
 */

package ejb.stations;

import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.sql.Timestamp;



public class TidalStationsClient {

   public static void main(String[] args) {

       try {



            Properties props = new Properties(); 
            props.put(Context.DNS_URL, "130.159.78.177:1050");
            Context initial = new InitialContext(props);



           //Context initial = new InitialContext();

           Object objref = initial.lookup("TidalStationsEJB");

           TidalStationsHome home = 
               (TidalStationsHome)PortableRemoteObject.narrow(objref, 
                                            TidalStationsHome.class);


            System.out.println(initial.getEnvironment());

/**
            Timestamp t1 = new Timestamp(System.currentTimeMillis());
            Timestamp t2 = new Timestamp(System.currentTimeMillis()*2);

            TidalStations felix = home.create("cat","type","set","staNam",t1,t2,"datTab");


            felix = home.findByPrimaryKey("staNam");

            System.out.println("Station name : " + felix.getStationName());
            System.out.println("Start date   : " + felix.getStartDate().toString());
            System.out.println("End date     : " + felix.getEndDate().toString());
            System.out.println("Data table   : " + felix.getDataTable());

            felix.remove();



           Collection c = home.findAll();
           Iterator i=c.iterator();

           while (i.hasNext()) {
                TidalStations t = (TidalStations)i.next();
                System.out.println("Station name : " + t.getStationName());
                System.out.println("Start date   : " + t.getStartDate().toString());
                System.out.println("End date     : " + t.getEndDate().toString());
                System.out.println("Data table   : " + t.getDataTable());
           }

**/

       } //try


       catch (Exception ex) {

           System.err.println("Caught an exception." );
           ex.printStackTrace();

       } //catch (Exception ex)

   }//public static void main(String[] args)

} 
