package demo.hello;

import java.io.*;
import org.omg.CORBA.*;

public class Client 
{
    public static void main(String args[]) 
    {
        try 
	{
            // initiliaze the ORB.
            ORB orb = ORB.init( args, null );

            // get object reference from command-line argument
            org.omg.CORBA.Object obj = orb.string_to_object( args[0] );

            // and narrowed it to HelloWorld.GoodDay
            GoodDay goodDay = GoodDayHelper.narrow( obj );

            // check if stringified IOR is of the right type
            if( goodDay == null ) 
	    {
                 System.err.println("stringified IOR is not of type GoodDay");
                 System.exit( 1 );
            }

            // invoke the operation and print the result
            System.out.println( goodDay.hello() );
        }
        // catch CORBA system exceptions
        catch(SystemException ex) 
	{
            System.err.println(ex);
        }
    }
}

