Пример #1
0
int main(int argc, char* argv[]) {
    EchoApp_Echo echo_service = CORBA_OBJECT_NIL;
    CosNaming_NamingContext name_service = CORBA_OBJECT_NIL;

    gchar *id[] = {"EchoApp", "Echo", NULL};

    CORBA_Environment ev[1];
    CORBA_exception_init(ev);

    client_init(&argc, argv, &global_orb, ev);
    etk_abort_if_exception(ev, "init failed");

    g_print("Resolving service reference from name-service with id\"%s\"\n", id[0]);

    name_service = etk_get_name_service(global_orb, ev);
    etk_abort_if_exception(ev, "failed resolving name-service");

    echo_service = (EchoApp_Echo)etk_name_service_resolve(name_service, id, ev);
    etk_abort_if_exception(ev, "failed resolving name service at name-service");

    client_run(echo_service, ev);
    etk_abort_if_exception(ev, "service not reachable");

    client_cleanup(global_orb, echo_service, ev);
    etk_abort_if_exception(ev, "cleanup failed");

    exit(0);
}
Пример #2
0
int
main (int argc, char *argv[])
{
	CORBA_Object servant = CORBA_OBJECT_NIL;
	
	CORBA_char filename[] = "/tmp/test-ldata.ior";

	CORBA_Environment  ev[1];
	CORBA_exception_init(ev);
	
	server_init (&argc, argv, &global_orb, &root_poa, ev);
	etk_abort_if_exception(ev, "failed ORB init");

	servant = server_activate_service (global_orb, root_poa, ev);
	etk_abort_if_exception(ev, "failed activating service");

	g_print ("Writing service reference to: %s\n\n", filename);

	etk_export_object_to_file (global_orb, 
				   servant, 
				   filename, 
				   ev);
	etk_abort_if_exception(ev, "failed exporting IOR");
	
	server_run (global_orb, ev);
	etk_abort_if_exception(ev, "failed entering main loop");

	server_cleanup (global_orb, root_poa, servant, ev);
	etk_abort_if_exception(ev, "failed cleanup");

	exit (0);
}
static gpointer
server_in_background (BackgroundData *data)
{
	int    argc = data->argc;
	char **argv = data->argv;

	CORBA_Object servant = CORBA_OBJECT_NIL;
	
	CORBA_char filename[] = "calculator.ref";

	CORBA_Environment  ev[1];
	CORBA_exception_init(ev);
	
	server_init (&argc, argv, &global_orb, &default_poa, ev);
	etk_abort_if_exception(ev, "failed ORB init");

	servant = server_activate_service (global_orb, default_poa, ev);
	etk_abort_if_exception(ev, "failed activating service");

	g_print ("Writing service reference to: %s\n\n", filename);

	etk_export_object_to_file (global_orb, 
				   servant, 
				   filename, 
				   ev);
	etk_abort_if_exception(ev, "failed exporting IOR");
	
	server_run (global_orb, ev);
	etk_abort_if_exception(ev, "failed entering main loop");

	server_cleanup (global_orb, default_poa, servant, ev);
	etk_abort_if_exception(ev, "failed cleanup");

	g_thread_exit (NULL);
}
Пример #4
0
/*
 * main 
 */
int
main(int argc, char* argv[])
         
{
        CORBA_char        filename[] = "account.ref";
        CORBA_long        amount=0;

	Account service = CORBA_OBJECT_NIL;

        CORBA_Environment ev[1];
        CORBA_exception_init(ev);

	client_init (&argc, argv, &global_orb, ev);
	etk_abort_if_exception(ev, "init failed");

        if (argc<2) g_error ("usage: %s <amount>", argv[0]);

        amount  = atoi(argv[1]);

	g_print ("Reading service reference from file \"%s\"\n", filename);

	service = (Account) etk_import_object_from_file (global_orb,
							 filename,
							 ev);
        etk_abort_if_exception(ev, "import service failed");

	client_run (service, amount, ev);
        etk_abort_if_exception(ev, "service not reachable");
 
	client_cleanup (global_orb, service, ev);
        etk_abort_if_exception(ev, "cleanup failed");
 
        exit (0);
}
Пример #5
0
int
main(int argc, char* argv[])
{
	CORBA_char filename[] = "/tmp/test-atspi.ior";
        Accessibility_Role data;
	int i;
        struct timeval start, end;
        long d_secs;
        long d_usec;
        
	Accessibility_Accessible service = CORBA_OBJECT_NIL;

        CORBA_Environment ev[1];
        CORBA_exception_init(ev);

	client_init (&argc, argv, &global_orb, ev);
	etk_abort_if_exception(ev, "init failed");

	g_print ("Reading service reference from file \"%s\"\n", filename);

	service = (Accessibility_Accessible) etk_import_object_from_file (global_orb,
							   filename,
							   ev);
        etk_abort_if_exception(ev, "import service failed");


        gettimeofday(&start, NULL);
	for (i=0; i<NUM_CALLS; i++)
	  {
            data = Accessibility_Accessible_getRole(service, ev);
	  }
        gettimeofday(&end, NULL);
        d_secs = end.tv_sec - start.tv_sec;
        d_usec = end.tv_usec - start.tv_usec;
        printf("\nGetRole : %f\n", (float) d_secs + ((float) d_usec / 1000000.0));
 
	client_cleanup (global_orb, service, ev);
        etk_abort_if_exception(ev, "cleanup failed");
 
        exit (0);
}
Пример #6
0
static
void
client_shutdown (int sig)
{
        CORBA_Environment  local_ev[1];
        CORBA_exception_init(local_ev);
 
        if (global_orb != CORBA_OBJECT_NIL)
        {
                CORBA_ORB_shutdown (global_orb, FALSE, local_ev);
                etk_abort_if_exception (local_ev, "caught exception");
        }
}