/**
 * matecomponent_activation_orb_init:
 * @argc: pointer to program's argument count
 * @argv: argument array
 * 
 * Initialize MateComponent Activation's ORB - do this once centrally
 * so it can be easily shared.
 * 
 * Return value: the ORB.
 **/
CORBA_ORB
matecomponent_activation_orb_init (int *argc, char **argv)
{
        CORBA_Context def_ctx;
	CORBA_Environment ev;
	const char *hostname;
	gchar *orb_id;

	CORBA_exception_init (&ev);

#ifdef HAVE_GTHREADS
	orb_id = "matecorba-local-mt-orb";
#else
	orb_id = "matecorba-local-non-threaded-orb";
#endif
	matecomponent_activation_orb = CORBA_ORB_init (argc, argv, orb_id, &ev);
	g_assert (ev._major == CORBA_NO_EXCEPTION);

	matecomponent_activation_init_activation_env ();

	/* Set values in default context */
	CORBA_ORB_get_default_context (matecomponent_activation_orb, &def_ctx, &ev);
        CORBA_Context_create_child (def_ctx, "activation", &matecomponent_activation_context, &ev);
	g_assert (ev._major == CORBA_NO_EXCEPTION);
        CORBA_Object_release ((CORBA_Object) def_ctx, &ev);
	g_assert (ev._major == CORBA_NO_EXCEPTION);

	hostname = matecomponent_activation_hostname_get ();
	CORBA_Context_set_one_value (matecomponent_activation_context, "hostname",
				     (char *) hostname, &ev);
	CORBA_Context_set_one_value (matecomponent_activation_context, "username",
				     (char *) g_get_user_name (), &ev);

	CORBA_exception_free (&ev);

#ifdef MATECOMPONENT_ACTIVATION_DEBUG
	if (getenv ("MATECOMPONENT_ACTIVATION_TRAP_SEGV")) {
#ifdef HAVE_SIGACTION
		struct sigaction sa;
		sa.sa_handler = do_barrier;
		sigaction (SIGSEGV, &sa, NULL);
		sigaction (SIGPIPE, &sa, NULL);
#else
                signal (SIGSEGV, do_barrier);
#ifdef SIGPIPE
                signal (SIGPIPE, do_barrier);
#endif
#endif
	}
	if (getenv ("MATECOMPONENT_ACTIVATION_BARRIER_INIT")) {
		volatile int barrier = 1;
		while (barrier);
	}
#endif

	return matecomponent_activation_orb;
}
Beispiel #2
0
void
CORBA_Context_set_values(CORBA_Context ctx,
			 const CORBA_NVList values,
			 CORBA_Environment * ev)
{
  int i;

  for(i = 0; i < values->list->len; i++)
    {
      CORBA_NamedValue *nvp;

      nvp = ((CORBA_NamedValue *)values->list->data) + i;

      g_assert(nvp->argument._type == TC_CORBA_string);

      CORBA_Context_set_one_value(ctx, nvp->name, nvp->argument._value, ev);
    }
}