Beispiel #1
0
/** The InvalidName exception is raised at @ev when
 *  ORB.resolve_initial_references is passed an @identifier for which
 *  there is no initial reference.
 */
CORBA_Object
CORBA_ORB_resolve_initial_references (CORBA_ORB          orb,
				      const CORBA_char  *identifier,
				      CORBA_Environment *ev)
{
	CORBA_Object objref;

	/* FIXME, verify identifier and raise exception for invalid
	 * service names, valid names might be: NameService, RootPOA,
	 * SecurityCurrent, PolicyCurrent, etc. */
 
	if (!orb->initial_refs ||
	    !(objref = g_hash_table_lookup (orb->initial_refs, identifier)))
		return CORBA_OBJECT_NIL;
	
	return ORBit_RootObject_duplicate (objref);
#if 0
 raise_invalid_name:
	CORBA_exception_set (ev,
			     CORBA_USER_EXCEPTION,
			     ex_CORBA_ORB_InvalidName,
			     NULL);
	return CORBA_OBJECT_NIL;
#endif
}
Beispiel #2
0
void
CORBA_ORB_get_default_context (CORBA_ORB          orb,
			       CORBA_Context     *ctx,
			       CORBA_Environment *ev)
{
	g_return_if_fail (ev != NULL);

	if (!orb->default_ctx)
		orb->default_ctx = CORBA_Context_new (
			CORBA_OBJECT_NIL, NULL, ev);

	*ctx = ORBit_RootObject_duplicate (orb->default_ctx);
}
Beispiel #3
0
static CORBA_Context
CORBA_Context_new (CORBA_Context      parent,
		   const char        *name,
		   CORBA_Environment *ev)
{
	CORBA_Context retval;

	retval = g_new0 (struct CORBA_Context_type, 1);

	ORBit_RootObject_init (&retval->parent, &CORBA_Context_epv);

	if (name)
		retval->the_name = g_strdup (name);

	retval->parent_ctx = parent;
	if (parent)
		parent->children = g_slist_prepend (parent->children, retval);

	return ORBit_RootObject_duplicate (retval);
}
Beispiel #4
0
CORBA_ORB
CORBA_ORB_init (int *argc, char **argv,
		CORBA_ORBid orb_identifier,
		CORBA_Environment *ev)
{
	gboolean thread_safe;
	CORBA_ORB retval;
	static ORBit_RootObject_Interface orb_if = {
		ORBIT_ROT_ORB,
		CORBA_ORB_release_fn
	};

	init_level++;

	if ((retval = _ORBit_orb))
		return ORBit_RootObject_duplicate (retval);

	/* the allocation code uses the bottom bit of any pointer */
	g_assert (ORBIT_ALIGNOF_CORBA_DOUBLE > 2);

	if (orb_identifier &&
	    strstr (orb_identifier, "orbit-local-non-threaded-orb") != NULL)
		thread_safe = FALSE;
	else
		thread_safe = TRUE;

	ORBit_option_parse (argc, argv, orbit_supported_options);
	
#ifdef G_ENABLE_DEBUG
	ORBit_setup_debug_flags ();

	if (_orbit_debug_flags & ORBIT_DEBUG_FORCE_THREADED) {
		g_warning ("-- Forced orb into threaded mode --");
		thread_safe |= TRUE;
	}
#endif /* G_ENABLE_DEBUG */

	giop_recv_set_limit (orbit_initial_recv_limit);
	giop_set_timeout (orbit_timeout_msec);
	giop_init (thread_safe,
		   orbit_use_ipv4 || orbit_use_ipv6 ||
		   orbit_use_irda || orbit_use_ssl);

	if (orb_identifier && thread_safe &&
	    strstr (orb_identifier, "orbit-io-thread") != NULL)
		link_set_io_thread (TRUE);

	genuid_init ();
	_ORBit_object_init ();
	ORBit_poa_init ();

	ORBit_locks_initialize ();

	retval = g_new0 (struct CORBA_ORB_type, 1);

	ORBit_RootObject_init (&retval->root_object, &orb_if);
	/* released by CORBA_ORB_destroy */
	_ORBit_orb = ORBit_RootObject_duplicate (retval);
	_ORBit_orb->lock = link_mutex_new ();
#ifndef G_OS_WIN32
	/* atexit(), which g_atexit() is just a #define for on Win32,
	 * often causes breakage when invoked from DLLs. It causes the
	 * registered function to be called when the calling DLL is
	 * being unloaded. At that time, however, random other DLLs
	 * might also have already been unloaded. There is no
	 * guarantee WinSock even works any longer. Etc. Best to avoid
	 * atexit() completely on Win32, and hope that just exiting
	 * the process and thus severing all connections will be
	 * noticed by all peers the process was connected to and acted
	 * upon properly.
	 *
	 * In the evolution-exchange-storage process's case, the
	 * shutdown_orb() function caused the process to hang and not
	 * exit, leaving the sockets it was listening on still in a
	 * LISTEN state. bonobo-activation-server thought the bonobo
	 * servers in evolution-exchange-storage were still OK and
	 * tried to contact them when Evolution was started the next
	 * time, causing it to hang, too.
	 */
	g_atexit (shutdown_orb);
#endif

	retval->default_giop_version = GIOP_LATEST;

	retval->adaptors = g_ptr_array_new ();

	/* init the forward bind hashtable*/
	retval->forw_binds = g_hash_table_new_full (
		g_str_hash, g_str_equal,
		g_free,
		NULL); 

	ORBit_init_internals (retval, ev);
	/* FIXME, handle exceptions */ 

	ORBit_initial_references_by_user (retval, 
					  orbit_naming_ref,
					  orbit_initref_list,
					  ev);
	/* FIXME, handle exceptions */ 

	return ORBit_RootObject_duplicate (retval);
}