Exemplo n.º 1
0
/* Releases @servant object and finally destroys @orb. If error
 * occures @ev points to exception object on return.
 */
static void 
server_cleanup (CORBA_ORB           orb,
		PortableServer_POA  poa,
		CORBA_Object        ref,
		CORBA_Environment  *ev)
{
	PortableServer_ObjectId   *objid       = NULL;

	objid = PortableServer_POA_reference_to_id (poa, ref, ev);
	if (etk_raised_exception(ev)) return;
		
	/* Servant: deactivatoin - will invoke  __fini destructor */
	PortableServer_POA_deactivate_object (poa, objid, ev);
	if (etk_raised_exception(ev)) return;

	PortableServer_POA_destroy (poa, TRUE, FALSE, ev);
	if (etk_raised_exception(ev)) return;

	CORBA_free (objid);

        CORBA_Object_release ((CORBA_Object) poa, ev);
	if (etk_raised_exception(ev)) return;
	
        CORBA_Object_release (ref, ev);
	if (etk_raised_exception(ev)) return;

        /* ORB: tear down the ORB */
        if (orb != CORBA_OBJECT_NIL)
        {
                /* going to destroy orb.. */
                CORBA_ORB_destroy(orb, ev);
		if (etk_raised_exception(ev)) return;
        }
}
Exemplo n.º 2
0
static void 
server_cleanup (CORBA_ORB           orb,
		PortableServer_POA  poa,
		CORBA_Object        ref,
		CORBA_Environment  *ev)
{
	PortableServer_ObjectId   *objid       = NULL;

	objid = PortableServer_POA_reference_to_id (poa, ref, ev);
	if (etk_raised_exception(ev)) return;
		
	PortableServer_POA_deactivate_object (poa, objid, ev);
	if (etk_raised_exception(ev)) return;

	PortableServer_POA_destroy (poa, TRUE, FALSE, ev);
	if (etk_raised_exception(ev)) return;

	CORBA_free (objid);

        CORBA_Object_release ((CORBA_Object) poa, ev);
	if (etk_raised_exception(ev)) return;
	
        CORBA_Object_release (ref, ev);
	if (etk_raised_exception(ev)) return;

        if (orb != CORBA_OBJECT_NIL)
        {
                CORBA_ORB_destroy(orb, ev);
		if (etk_raised_exception(ev)) return;
        }
}
Exemplo n.º 3
0
static void
DeadReferenceObj_test (PortableServer_Servant  servant,
		       CORBA_Environment      *ev)
{
	PortableServer_Current poa_current;
	PortableServer_POA     poa;
	CORBA_Object           obj = CORBA_OBJECT_NIL;

	poa_current = (PortableServer_Current)
			CORBA_ORB_resolve_initial_references (global_orb,
							      "POACurrent",
							      ev);

	g_assert (ev->_major == CORBA_NO_EXCEPTION);

	poa = PortableServer_Current_get_POA (poa_current, ev);

	g_assert (ev->_major == CORBA_NO_EXCEPTION);

	obj = PortableServer_POA_servant_to_reference (poa, servant, ev);

	g_assert (ev->_major == CORBA_NO_EXCEPTION);
	g_assert (obj != CORBA_OBJECT_NIL);

	CORBA_Object_release ((CORBA_Object) obj, ev);
	CORBA_Object_release ((CORBA_Object) poa, ev);
	CORBA_Object_release ((CORBA_Object) poa_current, ev);
}
 */static 
void 
server_init (int                 *argc_ptr, 
	     char                *argv[],
	     CORBA_ORB           *orb,
	     PortableServer_POA  *poa,
	     CORBA_Environment   *ev)
{
	PortableServer_POA         rootpoa     = CORBA_OBJECT_NIL;
	PortableServer_POAManager  rootpoa_mgr = CORBA_OBJECT_NIL; 

	CORBA_Environment  local_ev[1];
	CORBA_exception_init(local_ev);

	/* init signal handling */
	signal(SIGTERM, server_shutdown);
	
	/* create Object Request Broker (ORB) */
	
        (*orb) = CORBA_ORB_init(argc_ptr, argv, "orbit-local-mt-orb", ev);
	if (etk_raised_exception(ev)) 
		goto failed_orb;

        rootpoa = (PortableServer_POA) 
		CORBA_ORB_resolve_initial_references(*orb, "RootPOA", ev);
	if (etk_raised_exception(ev)) 
		goto failed_poa;
	
        rootpoa_mgr = PortableServer_POA__get_the_POAManager(rootpoa, ev);
	if (etk_raised_exception(ev)) 
		goto failed_poamanager;

	/* create default POA with specific policies */

	(*poa) = server_create_multi_threaded_poa (*orb, 
						   rootpoa, 
						   rootpoa_mgr, 
						   ev);
	if (etk_raised_exception(ev)) 
		goto failed_child_poa;

	PortableServer_POAManager_activate(rootpoa_mgr, ev);
	if (etk_raised_exception(ev)) 
		goto failed_activation;

        CORBA_Object_release ((CORBA_Object) rootpoa_mgr, ev);
	return;

 failed_activation:
 failed_child_poa:
 failed_poamanager:
        CORBA_Object_release ((CORBA_Object) rootpoa_mgr, local_ev);
 failed_poa:
	CORBA_ORB_destroy(*orb, local_ev);		
 failed_orb:
	return;
}
Exemplo n.º 5
0
static
void
main_func(int argc, char *argv[]) {
        PortableServer_POA         poa         = CORBA_OBJECT_NIL;
        PortableServer_POAManager  poa_manager = CORBA_OBJECT_NIL;
        CORBA_Environment  ev[1];
        CORBA_exception_init(ev);
	
	/* init signal handling */
	
        signal(SIGINT,  server_shutdown);
        signal(SIGTERM, server_shutdown);
	
        /* create Object Request Broker (ORB) */
	
        global_orb = CORBA_ORB_init(&argc, 
				    argv, 
				    "orbit-local-treaded-orb", 
				    ev);
        g_assert (!ORBIT_EX (ev));
	
        /* get Portable Object Adaptor (POA) */
	
        poa = (PortableServer_POA) 
          CORBA_ORB_resolve_initial_references(global_orb,
					       "RootPOA",
					       ev);
        g_assert (!ORBIT_EX (ev));

        /* activate POA Manager */
	
	poa_manager = PortableServer_POA__get_the_POAManager(poa, ev);
        g_assert (!ORBIT_EX (ev));
	
        PortableServer_POAManager_activate(poa_manager, ev);
        g_assert (!ORBIT_EX (ev));
	
 	LEAK_DETECT_WITH_TOLERANCE (1000, test_ORBit_alloc (), 50); 
 	LEAK_DETECT_WITH_TOLERANCE (1000, test_ORBit_sequence (), 50); 
	LEAK_DETECT_WITH_TOLERANCE (1000, test_activate_deactivate (poa, ev), 50);

        /* tear down the ORB */
	CORBA_Object_release ((CORBA_Object) poa_manager, ev);
	g_assert (!ORBIT_EX (ev));

	CORBA_Object_release ((CORBA_Object) poa, ev);
	g_assert (!ORBIT_EX (ev));

        if (global_orb != CORBA_OBJECT_NIL) {
                /* going to destroy orb.. */
                CORBA_ORB_destroy(global_orb, ev);
		g_assert (!ORBIT_EX (ev));
        }
}
Exemplo n.º 6
0
static void
impl_setLineStatus(PortableServer_Servant servant, GNOME_Evolution_ShellState shell_state, GNOME_Evolution_Listener listener, CORBA_Environment *ev)
{
	struct _setline_data *sd;
	int status = status_check(shell_state);

	/* This will dis/enable further auto-mail-check action. */
	/* FIXME: If send/receive active, wait for it to finish? */
	if (status)
		camel_session_set_online(session, status);

	sd = g_malloc0(sizeof(*sd));
	sd->status = status;
	sd->listener = CORBA_Object_duplicate(listener, ev);
	if (ev->_major == CORBA_NO_EXCEPTION)
		mail_component_stores_foreach(mail_component_peek(), setline_check, sd);
	else
		CORBA_exception_free(ev);

	if (sd->pending == 0) {
		if (sd->listener) {
			CORBA_Object_release(sd->listener, ev);
			CORBA_exception_free(ev);
		}

		g_free(sd);

		if (!status)
			camel_session_set_online(session, status);
		GNOME_Evolution_Listener_complete(listener, ev);
	}
}
/**
 * matecomponent_zoomable_frame_bind_to_zoomable:
 * @zoomable_frame: A MateComponentZoomableFrame object.
 * @zoomable: The CORBA object for the MateComponentZoomable embedded
 * in this MateComponentZoomableFrame.
 *
 * Associates @zoomable with this @zoomable_frame.
 */
void
matecomponent_zoomable_frame_bind_to_zoomable (MateComponentZoomableFrame *zoomable_frame,
					MateComponent_Zoomable      zoomable,
					CORBA_Environment   *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (zoomable != CORBA_OBJECT_NIL);
	g_return_if_fail (MATECOMPONENT_IS_ZOOMABLE_FRAME (zoomable_frame));

	if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL)
		CORBA_Object_release (zoomable_frame->priv->zoomable, NULL);

	zoomable_frame->priv->zoomable = CORBA_Object_duplicate (zoomable, NULL);

	if (!opt_ev) {
		CORBA_exception_init (&temp_ev);
		ev = &temp_ev;
	} else
		ev = opt_ev;

	MateComponent_Zoomable_setFrame (zoomable, MATECOMPONENT_OBJREF (zoomable_frame), ev);

	if (MATECOMPONENT_EX (ev))
		matecomponent_object_check_env (MATECOMPONENT_OBJECT (zoomable_frame), zoomable, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}
/**
 * bonobo_zoomable_frame_bind_to_zoomable:
 * @zoomable_frame: A BonoboZoomableFrame object.
 * @zoomable: The CORBA object for the BonoboZoomable embedded
 * in this BonoboZoomableFrame.
 *
 * Associates @zoomable with this @zoomable_frame.
 */
void
bonobo_zoomable_frame_bind_to_zoomable (BonoboZoomableFrame *zoomable_frame,
					Bonobo_Zoomable      zoomable,
					CORBA_Environment   *opt_ev)
{
	CORBA_Environment *ev, temp_ev;

	g_return_if_fail (zoomable != CORBA_OBJECT_NIL);
	g_return_if_fail (BONOBO_IS_ZOOMABLE_FRAME (zoomable_frame));

	if (zoomable_frame->priv->zoomable != CORBA_OBJECT_NIL)
		CORBA_Object_release (zoomable_frame->priv->zoomable, NULL);

	zoomable_frame->priv->zoomable = CORBA_Object_duplicate (zoomable, NULL);

	if (!opt_ev) {
		CORBA_exception_init (&temp_ev);
		ev = &temp_ev;
	} else
		ev = opt_ev;

	Bonobo_Zoomable_setFrame (zoomable, BONOBO_OBJREF (zoomable_frame), ev);

	if (BONOBO_EX (ev))
		bonobo_object_check_env (BONOBO_OBJECT (zoomable_frame), zoomable, ev);

	if (!opt_ev)
		CORBA_exception_free (&temp_ev);
}
static void
set_data (BonoboWidget *control, const char *string)
{
	Bonobo_PersistStream persist;
	BonoboObject *bstream;

	CORBA_Environment ev;

	persist = (Bonobo_PersistStream) Bonobo_Unknown_queryInterface (
		       bonobo_widget_get_objref (control), 
		       "IDL:Bonobo/PersistStream:1.0", &ev);
			
	if (persist == CORBA_OBJECT_NIL) {
			g_object_ref_sink (G_OBJECT (control));
			return ;
	}

	bstream = bonobo_stream_mem_create (string, strlen (string), TRUE, FALSE);

	CORBA_exception_init (&ev);
	Bonobo_PersistStream_load (persist, BONOBO_OBJREF (bstream),
				   "text/calendar", &ev);
	bonobo_object_unref (BONOBO_OBJECT (bstream));
	Bonobo_Unknown_unref (persist, &ev);
	CORBA_Object_release (persist, &ev);
}
static gboolean
test_matecomponent_activation_server (CORBA_Environment *ev, const char *type)
{
        CORBA_Object ns;

        ns = matecomponent_activation_name_service_get (ev);
        if (ev->_major != CORBA_NO_EXCEPTION) {
                g_warning ("Exception '%s' (%s) finding matecomponent_activation_server %s",
                           matecomponent_activation_exception_id (ev), ev->_id, type);
                return FALSE;
        }

        if (name_service != CORBA_OBJECT_NIL &&
            name_service != ns) {
                g_warning ("matecomponent_activation_server crashed %s", type);
                return FALSE;
        }

        if (name_service == CORBA_OBJECT_NIL)
                name_service = ns;
        else
                CORBA_Object_release (ns, ev);

        return TRUE;
}
Exemplo n.º 11
0
static int
pycorba_any_init(PyCORBA_Any *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "typecode", "value", NULL };
    PyCORBA_TypeCode *pytc;
    PyObject *value;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O:CORBA.any.__init__",
				     kwlist, &PyCORBA_TypeCode_Type, &pytc,
				     &value))
	return -1;

    self->any._type = (CORBA_TypeCode)CORBA_Object_duplicate(
					(CORBA_Object)pytc->tc, NULL);
    self->any._value = MateCORBA_small_alloc(self->any._type);

    if (!pymatecorba_marshal_any(&self->any, value)) {
	CORBA_Object_release((CORBA_Object)self->any._type, NULL);
	self->any._type = NULL;
	CORBA_free(self->any._value);
	self->any._value = NULL;
	PyErr_SetString(PyExc_TypeError, "could not marshal value");
	return -1;
    }

    return 0;
}
Exemplo n.º 12
0
static void FreeDataSourceObjectData(DataSourceObjectData* p_object_data) {
	
	ilu_Error an_error;
	CORBA_Environment ilu_env;
	
	if (p_object_data->m_state_change_condition)
		ilu_DestroyCondition(p_object_data->m_state_change_condition);

	if (p_object_data->m_access_mutex) {
		ilu_DestroyMutex(p_object_data->m_access_mutex, &an_error);
		if (ILU_ERRNOK(an_error)) {
			ILU_HANDLED(an_error);
			ILU_CLER(an_error);
		}
	}
	if (p_object_data->m_renderSink) {
		CORBA_Object_release(p_object_data->m_renderSink, &ilu_env);
		log_and_clear_if_exception(&ilu_env, "CORBA_Object_release problem");
	}

	if (p_object_data->m_pipeline) {
		ILU_C_ReleasePipeline(p_object_data->m_pipeline, &ilu_env);
		log_and_clear_if_exception(&ilu_env, "Calling ILU_C_ReleasePipeline");
		ILU_C_SetPipelineContext(NULL); 
	}
	
	CLOSE_FUNCTION(p_object_data->m_h_native_content_file);
	ilu_free(p_object_data->m_pc_object_id);	
	ilu_free(p_object_data);
}
static void
matecomponent_control_unset_control_frame (MateComponentControl     *control,
				    CORBA_Environment *opt_ev)
{
	CORBA_Environment *ev, tmp_ev;

	if (!opt_ev) {
		CORBA_exception_init (&tmp_ev);
		ev = &tmp_ev;
	} else
		ev = opt_ev;

	if (control->priv->no_frame_timeout_id != 0) {
		g_source_remove (control->priv->no_frame_timeout_id);
		control->priv->no_frame_timeout_id = 0;
	}

	if (control->priv->frame != CORBA_OBJECT_NIL) {
		MateComponent_ControlFrame frame = control->priv->frame;

		control->priv->frame = CORBA_OBJECT_NIL;

		MateCORBA_small_unlisten_for_broken (
			frame, G_CALLBACK (control_frame_connection_died_cb));

		if (control->priv->active)
			MateComponent_ControlFrame_notifyActivated (
				frame, FALSE, ev);

		CORBA_Object_release (frame, ev);
	}

	if (!opt_ev)
		CORBA_exception_free (&tmp_ev);
}
Exemplo n.º 14
0
 */static 
void 
server_init (int                 *argc_ptr, 
	     char                *argv[],
	     CORBA_ORB           *orb,
	     PortableServer_POA  *poa,
	     CORBA_Environment   *ev)
{
	PortableServer_POAManager  poa_manager = CORBA_OBJECT_NIL; 

	CORBA_Environment  local_ev[1];
	CORBA_exception_init(local_ev);

	/* init signal handling */
	signal(SIGINT,  server_shutdown);
	signal(SIGTERM, server_shutdown);
	
	/* create Object Request Broker (ORB) */
	
        (*orb) = CORBA_ORB_init(argc_ptr, argv, "orbit-local-mt-orb", ev);
	if (etk_raised_exception(ev)) 
		goto failed_orb;

        (*poa) = (PortableServer_POA) 
		CORBA_ORB_resolve_initial_references(*orb, "RootPOA", ev);
	if (etk_raised_exception(ev)) 
		goto failed_poa;

        poa_manager = PortableServer_POA__get_the_POAManager(*poa, ev);
	if (etk_raised_exception(ev)) 
		goto failed_poamanager;

	PortableServer_POAManager_activate(poa_manager, ev);
	if (etk_raised_exception(ev)) 
		goto failed_activation;

        CORBA_Object_release ((CORBA_Object) poa_manager, ev);
	return;

 failed_activation:
 failed_poamanager:
        CORBA_Object_release ((CORBA_Object) poa_manager, local_ev);
 failed_poa:
	CORBA_ORB_destroy(*orb, local_ev);		
 failed_orb:
	return;
}
Exemplo n.º 15
0
static void
pycorba_any_dealloc(PyCORBA_Any *self)
{
    if (self->any._type)
	CORBA_Object_release((CORBA_Object)self->any._type, NULL);
    CORBA_free(self->any._value);
    PyObject_DEL(self);
}
/**
 * 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;
}
static void
matecomponent_zoomable_frame_dispose (GObject *object)
{
	MateComponentZoomableFrame *frame = (MateComponentZoomableFrame *) object;

	CORBA_Object_release (frame->priv->zoomable, NULL);

	parent_class->dispose (object);
}
Exemplo n.º 18
0
static void
bonobo_zoomable_frame_dispose (GObject *object)
{
	BonoboZoomableFrame *frame = (BonoboZoomableFrame *) object;

	CORBA_Object_release (frame->priv->zoomable, NULL);

	parent_class->dispose (object);
}
Exemplo n.º 19
0
static void
test_activation (void)
{
	CORBA_Environment   env;
	PortableServer_POA  poa;
	GSList             *objids = NULL, *l;
	int                 i;

	fprintf (stderr, "Testing object activation...\n");

	CORBA_exception_init (&env);

	POA_Test__init (&test_servant, &env);

	poa = create_mult_id_poa (&env);

	g_assert (env._major == CORBA_NO_EXCEPTION);

	g_timer_reset (timer);

	for (i = 0; i < 1000; i++) {
		PortableServer_ObjectId *objid;

		objid = PortableServer_POA_activate_object (poa, &test_servant, &env);
		g_assert (env._major == CORBA_NO_EXCEPTION);

		objids = g_slist_append (objids, objid);
	}

	elapsed_time = g_timer_elapsed (timer, NULL);
	bogomark += elapsed_time;
	fprintf (stderr, " activation : %g(ms)\n", elapsed_time);

	g_timer_reset (timer);

	for (l = objids; l; l = l->next) {
		PortableServer_POA_deactivate_object (poa, l->data, &env);
		g_assert (env._major == CORBA_NO_EXCEPTION);
	}

	elapsed_time = g_timer_elapsed (timer, NULL);
	bogomark += elapsed_time;
	fprintf (stderr, " de-activation : %g(ms)\n", elapsed_time);
	
	for (l = objids; l; l = l->next)
		CORBA_free (l->data);
	g_slist_free (objids);

	POA_Test__fini (&test_servant, &env);

	PortableServer_POA_destroy (poa, CORBA_FALSE, CORBA_FALSE, &env);
	g_assert (env._major == CORBA_NO_EXCEPTION);
	CORBA_Object_release ((CORBA_Object) poa, &env);
	g_assert (env._major == CORBA_NO_EXCEPTION);

	CORBA_exception_free (&env);
}
/**
 * matecomponent_activation_debug_shutdown:
 * 
 *   A debugging function to shutdown the ORB and process
 * any reference count leaks that may have occurred.
 * 
 * Return value: FALSE if there were leaks detected, else TRUE
 **/
gboolean
matecomponent_activation_debug_shutdown (void)
{
        int retval = TRUE;
        CORBA_Environment ev;

        if (is_initialized) {
                CORBA_exception_init (&ev);

                matecomponent_activation_base_service_debug_shutdown (&ev);
                if (ev._major != CORBA_NO_EXCEPTION) {
                        retval = FALSE;
                }

                if (matecomponent_activation_context != CORBA_OBJECT_NIL) {
                        CORBA_Object_release (
                                (CORBA_Object) matecomponent_activation_context, &ev);
                        matecomponent_activation_context = CORBA_OBJECT_NIL;
                }

                matecomponent_activation_release_corba_client ();

                if (object_directory != CORBA_OBJECT_NIL) {
                        CORBA_Object_release (object_directory, &ev);
                        object_directory = CORBA_OBJECT_NIL;
                }

                if (matecomponent_activation_orb != CORBA_OBJECT_NIL) {
                        CORBA_ORB_destroy (matecomponent_activation_orb, &ev);
                        if (ev._major != CORBA_NO_EXCEPTION) {
                                retval = FALSE;
                        }
                        CORBA_Object_release (
                                (CORBA_Object) matecomponent_activation_orb, &ev);
                        is_initialized = FALSE;
                }

                CORBA_exception_free (&ev);

        }

        return retval;
}
static CORBA_UnionMemberSeq *
MateCORBA_imodule_get_union_members (GHashTable        *typecodes,
				 IDL_tree           tree,
				 CORBA_TypeCode     switchtc,
				 CORBA_Environment *ev)
{
	CORBA_UnionMemberSeq *members;
	IDL_tree              l;
	int                   num_members = 0;
	int                   i;

	g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_TYPE_UNION, NULL);

	for (l = IDL_TYPE_UNION (tree).switch_body; l; l = IDL_LIST (l).next)
		num_members += IDL_list_length (IDL_CASE_STMT (IDL_LIST (l).data).labels);

	members = CORBA_UnionMemberSeq__alloc ();

	members->_length  = members->_maximum = num_members;
	members->_buffer  = CORBA_UnionMemberSeq_allocbuf (members->_length);
	members->_release = CORBA_TRUE;

	for (i = 0, l = IDL_TYPE_UNION (tree).switch_body; l; l = IDL_LIST (l).next) {
		CORBA_TypeCode subtc;
		IDL_tree       member, label, dcl;

		member = IDL_CASE_STMT (IDL_LIST (l).data).element_spec;
		g_assert (IDL_NODE_TYPE (member) == IDLN_MEMBER);

		subtc = MateCORBA_imodule_get_typecode (
				typecodes, IDL_MEMBER (member).type_spec);
		dcl = IDL_LIST (IDL_MEMBER (member).dcls).data;

		for (label = IDL_CASE_STMT (IDL_LIST (l).data).labels; label;
		     label = IDL_LIST (label).next, i++) {
			CORBA_UnionMember *umember = &members->_buffer [i];

			MateCORBA_imodule_setup_label_any (
				switchtc, IDL_LIST (label).data, &umember->label);

			umember->label._release = CORBA_TRUE;

			umember->name     = CORBA_string_dup (IDL_IDENT (dcl).str);
			umember->type     = (CORBA_TypeCode)
						CORBA_Object_duplicate ((CORBA_Object) subtc, ev);
			umember->type_def = CORBA_OBJECT_NIL; /* Not used? */
		}

		CORBA_Object_release ((CORBA_Object) subtc, ev);
	}

	g_assert (i == num_members);

	return members;
}
Exemplo n.º 22
0
static void
pyorbit_poa_dealloc(PyCORBA_Object *self)
{
    if (self->objref)
	CORBA_Object_release(self->objref, NULL);
    self->objref = NULL;

    if (self->ob_type->tp_free)
	self->ob_type->tp_free((PyObject *)self);
    else
	PyObject_DEL(self);
}
/**
 * matecomponent_event_source_notify_listeners:
 * @event_source: the Event Source that will emit the event.
 * @event_name: Name of the event being emitted
 * @opt_value: A CORBA_any value that contains the data that is passed
 * to interested clients, or NULL for an empty value
 * @opt_ev: A CORBA_Environment where a failure code can be returned, can be NULL.
 *
 * This will notify all clients that have registered with this EventSource
 * (through the addListener or addListenerWithMask methods) of the availability
 * of the event named @event_name.  The @value CORBA::any value is passed to
 * all listeners.
 *
 * @event_name can not contain comma separators, as commas are used to
 * separate the various event names. 
 */
void
matecomponent_event_source_notify_listeners (MateComponentEventSource *event_source,
				      const char        *event_name,
				      const CORBA_any   *opt_value,
				      CORBA_Environment *opt_ev)
{
	GSList *l, *notify;
	CORBA_Environment  *ev, temp_ev;
	const MateComponentArg *my_value;

	g_return_if_fail (MATECOMPONENT_IS_EVENT_SOURCE (event_source));
	
	if (!opt_ev) {
		CORBA_exception_init (&temp_ev);
		ev = &temp_ev;
	} else
		ev = opt_ev;

	if (!opt_value)
		my_value = matecomponent_arg_new (MATECOMPONENT_ARG_NULL);
	else
		my_value = opt_value;
	
	notify = NULL;

	for (l = event_source->priv->listeners; l; l = l->next) {
		ListenerDesc *desc = (ListenerDesc *) l->data;

		if (desc->event_masks == NULL || 
		    event_match (event_name, desc->event_masks)) {
			notify = g_slist_prepend (
				notify,
				CORBA_Object_duplicate (desc->listener, ev));
		}
	}

	matecomponent_object_ref (MATECOMPONENT_OBJECT (event_source));

	for (l = notify; l; l = l->next) {
		MateComponent_Listener_event (l->data, event_name, my_value, ev);
		CORBA_Object_release (l->data, ev);
	}

	matecomponent_object_unref (MATECOMPONENT_OBJECT (event_source));

	g_slist_free (notify);

	if (!opt_ev)
		CORBA_exception_free (ev);

	if (!opt_value)
		matecomponent_arg_release ((MateComponentArg *) my_value);
}
Exemplo n.º 24
0
void CORBA_BOA_impl_is_ready(CORBA_BOA ths, CORBA_Environment *ev)
{
	trapeze_mcp_init(1 /* yes, I'm the server */);
	
	/* Accept new clients, read client requests & send replies forever. */
	while (1) {
		FLICK_TARGET obj;
		FLICK_BUFFER msg;
		void *buffer;
		
		flick_trapeze_server_get_request(&msg);
		buffer = tpz_mtod(msg);
		
		obj = find_implementation(
			ths, buffer, ev);
		if (ev->_major != CORBA_NO_EXCEPTION) {
			/* Error finding object. */
			flick_trapeze_server_send_corba_exception(
				msg,
				CORBA_exception_id(ev));
			ev->_major = CORBA_NO_EXCEPTION;
		} else {
			switch ((*obj->server_func)(msg, buffer, obj)) {
			case FLICK_OPERATION_SUCCESS:
				/* end_encode already sent reply */
				break;
				
			case FLICK_OPERATION_SUCCESS_NOREPLY:
				break;
				
			default:
				/* FLICK_OPERATION_FAILURE */
				/*
				 * XXX --- The server dispatch function may
				 * have already encoded an exception
				 * `..._decode_error'.  We should send it, or
				 * the dispatch func should return FLICK_
				 * OPERATION_SUCCESS in that case.
				 */
				flick_trapeze_server_send_corba_exception(
					msg,
					ex_CORBA_NO_IMPLEMENT);
				break;
			}
		}
		if (!CORBA_Object_is_nil(obj, ev))
			CORBA_Object_release(obj, ev);
	}
	
	/* Should never be reached. */
	flick_set_exception(ths, ev, ex_CORBA_INTERNAL,
			    0, CORBA_COMPLETED_YES);
}
static CORBA_StructMemberSeq *
MateCORBA_imodule_get_struct_members (GHashTable        *typecodes,
				  IDL_tree           tree,
				  CORBA_Environment *ev)
{
	CORBA_StructMemberSeq *members;
	IDL_tree               l;
	int                    num_members = 0;
	int                    i;

	g_return_val_if_fail (IDL_NODE_TYPE (tree) == IDLN_TYPE_STRUCT ||
			      IDL_NODE_TYPE (tree) == IDLN_EXCEPT_DCL, NULL);

	for (l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next)
		num_members += IDL_list_length (IDL_MEMBER (IDL_LIST (l).data).dcls);

	members = CORBA_StructMemberSeq__alloc ();

	members->_length  = members->_maximum = num_members;
	members->_buffer  = CORBA_StructMemberSeq_allocbuf (members->_length);
	members->_release = CORBA_TRUE;

	for (i = 0, l = IDL_TYPE_STRUCT (tree).member_list; l; l = IDL_LIST (l).next) {
		CORBA_TypeCode subtc;
		IDL_tree       dcl;

		subtc = MateCORBA_imodule_get_typecode (
				typecodes, IDL_MEMBER (IDL_LIST (l).data).type_spec);

		for (dcl = IDL_MEMBER (IDL_LIST (l).data).dcls; dcl;
		     dcl = IDL_LIST (dcl).next, i++) {
			CORBA_StructMember *member = &members->_buffer [i];
			CORBA_string        name;

			if (IDL_NODE_TYPE (dcl) == IDLN_IDENT)
				name = IDL_IDENT (dcl).str;
			else /* IDLN_TYPE_ARRAY */
				name = IDL_IDENT (IDL_TYPE_ARRAY (dcl).ident).str;

			member->name     = CORBA_string_dup (name);
			member->type     = (CORBA_TypeCode)
						CORBA_Object_duplicate ((CORBA_Object) subtc, ev);
			member->type_def = CORBA_OBJECT_NIL; /* Not used? */
		}

		CORBA_Object_release ((CORBA_Object) subtc, ev);
	}

	g_assert (i == num_members);

	return members;
}
void
matecomponent_event_source_client_add_listener_closure (MateComponent_Unknown     object,
						 GClosure          *event_callback,
						 const char        *opt_mask,
						 CORBA_Environment *opt_ev)
{
	MateComponent_Listener l;

	l = matecomponent_event_source_client_add_listener_full (
		object, event_callback, opt_mask, opt_ev);

	if (l != CORBA_OBJECT_NIL)
		CORBA_Object_release (l, NULL);
}
Exemplo n.º 27
0
static void
impl_Test_LargeSeq__destroy(impl_POA_Test_LargeSeq *servant, CORBA_Environment *ev)
{
    CORBA_Object_release ((CORBA_Object) servant->poa, ev);

    /* No further remote method calls are delegated to 
    * servant and you may free your private attributes. */
   /* ------ free private attributes here ------ */
   /* ------ ---------- end ------------- ------ */

POA_Test_LargeSeq__fini((PortableServer_Servant)servant, ev);

g_free (servant);
}
Exemplo n.º 28
0
static void
kill_old_dataserver (void)
{
	GNOME_Evolution_DataServer_InterfaceCheck iface;
	CORBA_Environment ev;
	CORBA_char *version;

	CORBA_exception_init (&ev);

	/* FIXME Should we really kill it off?  We also shouldn't hard code the version */
	iface = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_DataServer_InterfaceCheck", 0, NULL, &ev);
	if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
		kill_dataserver ();
		CORBA_exception_free (&ev);
		return;
	}

	version = GNOME_Evolution_DataServer_InterfaceCheck__get_interfaceVersion (iface, &ev);
	if (BONOBO_EX (&ev)) {
		kill_dataserver ();
		CORBA_Object_release (iface, &ev);
		CORBA_exception_free (&ev);
		return;
	}

	if (strcmp (version, DATASERVER_VERSION) != 0) {
		CORBA_free (version);
		kill_dataserver ();
		CORBA_Object_release (iface, &ev);
		CORBA_exception_free (&ev);
		return;
	}

	CORBA_free (version);
	CORBA_Object_release (iface, &ev);
	CORBA_exception_free (&ev);
}
Exemplo n.º 29
0
int
main (int argc, char **argv) 
{
	CORBA_Environment  ev[1];
	PortableServer_POA rootpoa, poa;

	CORBA_exception_init (ev);

	orb = CORBA_ORB_init (&argc, argv, "", ev);

	rootpoa = (PortableServer_POA)
		CORBA_ORB_resolve_initial_references (orb, "RootPOA", ev);
	g_assert (ev->_major == CORBA_NO_EXCEPTION);

	{
		poa = ORBit_POA_new_from (orb, rootpoa, "Foo", NULL, ev);
		g_assert (ev->_major == CORBA_NO_EXCEPTION);
	
		PortableServer_POA_destroy (poa, FALSE, FALSE, ev);
		CORBA_Object_release ((CORBA_Object) poa, ev);
	}

	CORBA_Object_release ((CORBA_Object) rootpoa, ev);

	CORBA_ORB_destroy (orb, ev);
	g_assert (ev->_major == CORBA_NO_EXCEPTION);

	CORBA_Object_release ((CORBA_Object) orb, ev);
	g_assert (ev->_major == CORBA_NO_EXCEPTION);

	CORBA_exception_free (ev);

	fprintf (stderr, "PASS: test-poa\n");

	return 0;
}
Exemplo n.º 30
0
static
void
client_cleanup (CORBA_ORB                 orb,
                CORBA_Object              service,
                CORBA_Environment        *ev)
{
        CORBA_Object_release(service, ev);
        if (etk_raised_exception(ev)) return;
 
        if (orb != CORBA_OBJECT_NIL)
        {
                CORBA_ORB_destroy(orb, ev);
                if (etk_raised_exception(ev)) return;
        }
}