package com.wiley.compbooks.brose.chapter9.any;

import java.util.Calendar;
import org.omg.CORBA.*;
import com.wiley.compbooks.brose.chapter9.HelloWorld.*;

class GoodDayImpl 
    extends GoodDayPOA 
{

    private String location;

    /**  constructor */

    GoodDayImpl( String location ) 
    {
        this.location = location;
    }


    public Any hello( AnyHolder any_time)
        throws SystemException 
    {
        // get location time of the server
        Calendar date = Calendar.getInstance();

	// create time-structure assign hour and minute to it
	Time struct_time = new Time( (short) date.get(Calendar.HOUR),
				     (short) date.get(Calendar.MINUTE));

        // create an any and shuffle structure into it
        any_time.value = _orb().create_any();
	TimeHelper.insert( any_time.value, struct_time );

	// create an any and shuffle location into it
	Any any_location = _orb().create_any();
	any_location.insert_string( location );

        return any_location;
    }
}
