![]() |
![]() |
![]() |
MateComponent Activation API Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <matecomponent-activation/matecomponent-activation.h> MateComponent_RegistrationResult; void matecomponent_activation_unregister_active_server (const char *iid
,CORBA_Object obj
); void matecomponent_activation_registration_env_free (GSList *reg_env
); GSList * matecomponent_activation_registration_env_set (GSList *reg_env
,const char *name
,const char *value
); void matecomponent_activation_registration_env_set_global (GSList *reg_env
,gboolean append_if_existing
); MateComponent_RegistrationResult matecomponent_activation_register_active_server (const char *iid
,CORBA_Object obj
,GSList *reg_env
); const char * matecomponent_activation_iid_get (void
); MateComponentActivationPlugin; MateComponentActivationPluginObject; void matecomponent_activation_plugin_use (PortableServer_Servant servant
,gpointer impl_ptr
); void matecomponent_activation_plugin_unuse (gpointer impl_ptr
);
When writing a component which can be activated through MateComponent Activation by clients, you need to be register your component to MateComponent Activation once it is created.
typedef struct { CORBA_unsigned_long _maximum, _length; MateComponent_ServerInfo* _buffer; CORBA_boolean _release; } CORBA_sequence_MateComponent_ServerInfo; #endif #if !defined(TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_0) #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_0 'M' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_1 'a' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_2 't' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_3 'e' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_4 'C' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_5 'o' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_6 'm' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_7 'p' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_8 'o' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_9 'n' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_10 'e' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_11 'n' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_12 't' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_13 '_' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_14 'A' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_15 'c' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_16 't' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_17 'i' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_18 'v' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_19 'a' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_20 't' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_21 'i' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_22 'o' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_23 'n' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_24 '_' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_25 't' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_26 'y' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_27 'p' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_28 'e' #define TC_IMPL_TC_CORBA_sequence_MateComponent_ServerInfo_29 's' #ifdef MATECORBA_IDL_C_IMODULE_MateComponent_Activation_types static #else extern #endif MATECORBA2_MAYBE_CONST struct CORBA_TypeCode_struct TC_CORBA_sequence_MateComponent_ServerInfo_struct; #define TC_CORBA_sequence_MateComponent_ServerInfo ((CORBA_TypeCode)&TC_CORBA_sequence_MateComponent_ServerInfo_struct) #endif #define CORBA_sequence_MateComponent_ServerInfo__alloc() ((CORBA_sequence_MateComponent_ServerInfo *)MateCORBA_small_alloc (TC_CORBA_sequence_MateComponent_ServerInfo)) #define CORBA_sequence_MateComponent_ServerInfo__freekids(m,d) MateCORBA_small_freekids (TC_CORBA_sequence_MateComponent_ServerInfo,(m),(d)) #define CORBA_sequence_MateComponent_ServerInfo_allocbuf(l) ((MateComponent_ServerInfo*)MateCORBA_small_allocbuf (TC_CORBA_sequence_MateComponent_ServerInfo, (l))) #define CORBA_sequence_MateComponent_ServerInfo_allocbuf(l) ((MateComponent_ServerInfo*)MateCORBA_small_allocbuf (TC_CORBA_sequence_MateComponent_ServerInfo, (l))) #endif #if !defined(_MateComponent_ServerInfoList_defined) #define _MateComponent_ServerInfoList_defined 1 typedef CORBA_sequence_MateComponent_ServerInfo MateComponent_ServerInfoList; #define MateComponent_ServerInfoList_marshal(x,y,z) CORBA_sequence_MateComponent_ServerInfo_marshal((x),(y),(z)) #define MateComponent_ServerInfoList_demarshal(x,y,z,i) CORBA_sequence_MateComponent_ServerInfo_demarshal((x),(y),(z),(i)) #if !defined(TC_IMPL_TC_MateComponent_ServerInfoList_0) #define TC_IMPL_TC_MateComponent_ServerInfoList_0 'M' #define TC_IMPL_TC_MateComponent_ServerInfoList_1 'a' #define TC_IMPL_TC_MateComponent_ServerInfoList_2 't' #define TC_IMPL_TC_MateComponent_ServerInfoList_3 'e' #define TC_IMPL_TC_MateComponent_ServerInfoList_4 'C' #define TC_IMPL_TC_MateComponent_ServerInfoList_5 'o' #define TC_IMPL_TC_MateComponent_ServerInfoList_6 'm' #define TC_IMPL_TC_MateComponent_ServerInfoList_7 'p' #define TC_IMPL_TC_MateComponent_ServerInfoList_8 'o' #define TC_IMPL_TC_MateComponent_ServerInfoList_9 'n' #define TC_IMPL_TC_MateComponent_ServerInfoList_10 'e' #define TC_IMPL_TC_MateComponent_ServerInfoList_11 'n' #define TC_IMPL_TC_MateComponent_ServerInfoList_12 't' #define TC_IMPL_TC_MateComponent_ServerInfoList_13 '_' #define TC_IMPL_TC_MateComponent_ServerInfoList_14 'A' #define TC_IMPL_TC_MateComponent_ServerInfoList_15 'c' #define TC_IMPL_TC_MateComponent_ServerInfoList_16 't' #define TC_IMPL_TC_MateComponent_ServerInfoList_17 'i' #define TC_IMPL_TC_MateComponent_ServerInfoList_18 'v' #define TC_IMPL_TC_MateComponent_ServerInfoList_19 'a' #define TC_IMPL_TC_MateComponent_ServerInfoList_20 't' #define TC_IMPL_TC_MateComponent_ServerInfoList_21 'i' #define TC_IMPL_TC_MateComponent_ServerInfoList_22 'o' #define TC_IMPL_TC_MateComponent_ServerInfoList_23 'n' #define TC_IMPL_TC_MateComponent_ServerInfoList_24 '_' #define TC_IMPL_TC_MateComponent_ServerInfoList_25 't' #define TC_IMPL_TC_MateComponent_ServerInfoList_26 'y' #define TC_IMPL_TC_MateComponent_ServerInfoList_27 'p' #define TC_IMPL_TC_MateComponent_ServerInfoList_28 'e' #define TC_IMPL_TC_MateComponent_ServerInfoList_29 's' #ifdef MATECORBA_IDL_C_IMODULE_MateComponent_Activation_types static #else extern #endif MATECORBA2_MAYBE_CONST struct CORBA_TypeCode_struct TC_MateComponent_ServerInfoList_struct; #define TC_MateComponent_ServerInfoList ((CORBA_TypeCode)&TC_MateComponent_ServerInfoList_struct) #endif #define MateComponent_ServerInfoList__alloc() ((MateComponent_ServerInfoList *)MateCORBA_small_alloc (TC_CORBA_sequence_MateComponent_ServerInfo)) #define MateComponent_ServerInfoList__freekids(m,d) MateCORBA_small_freekids (TC_CORBA_sequence_MateComponent_ServerInfo,(m),(d)) #define MateComponent_ServerInfoList_allocbuf(l) ((MateComponent_ServerInfo*)MateCORBA_small_allocbuf (TC_CORBA_sequence_MateComponent_ServerInfo, (l))) #endif #if !defined(_MateComponent_RegistrationResult_defined) #define _MateComponent_RegistrationResult_defined 1 typedef enum { MateComponent_ACTIVATION_REG_SUCCESS, MateComponent_ACTIVATION_REG_NOT_LISTED, MateComponent_ACTIVATION_REG_ALREADY_ACTIVE, MateComponent_ACTIVATION_REG_ERROR } MateComponent_RegistrationResult;
void matecomponent_activation_unregister_active_server (const char *iid
,CORBA_Object obj
);
Unregisters obj
with iid
with the local matecomponent-activation-server
daemon.
|
IID of the server to unregister. |
|
CORBA::Object to unregister. |
void matecomponent_activation_registration_env_free
(GSList *reg_env
);
Frees the registration environment list, reg_env
.
|
a GSList pointer. |
GSList * matecomponent_activation_registration_env_set (GSList *reg_env
,const char *name
,const char *value
);
Sets the environment variable name
to value
in the
registration environment list reg_env
.
void matecomponent_activation_registration_env_set_global (GSList *reg_env
,gboolean append_if_existing
);
Sets the global registration environment list with the
contents of reg_env
. If append_if_existing
is set to
FALSE
, the an existing global list will be overwritten.
|
a GSList pointer. |
|
whether or not to append to the global list. |
MateComponent_RegistrationResult matecomponent_activation_register_active_server (const char *iid
,CORBA_Object obj
,GSList *reg_env
);
Registers obj
with iid
with the local matecomponent-activation-server
daemon.
If reg_env
is not NULL
, obj
will be registered in such a
way that if a client who's environment differs from the
environment specified in reg_env
, then another attempt
to activate iid
will not result in a reference to obj
being returned, but rather another instance of iid
being
activated.
So, for example, you can ensure that a seperate instance of the component is activated for each distinct X display (and screen) by:
display_name = gdk_display_get_name (gdk_display_get_default()); reg_env = matecomponent_activation_registration_env_set ( reg_env, "DISPLAY", display_name); matecomponent_activation_register_active_server (iid, active_server, reg_env); matecomponent_activation_registration_env_free (reg_env);
If reg_env
is NULL
, the global registration environment
list will be used if it is set. See
matecomponent_activation_registration_env_set_global()
.
|
IID of the server to register. |
|
CORBA::Object to register. |
|
the registration environment. |
Returns : |
status of the registration. |
typedef struct { const MateComponentActivationPluginObject *plugin_object_list; const char *description; gpointer dummy[8]; } MateComponentActivationPlugin;
Components which want to be activated as shared libraries must export an MateComponentActivationPlugin structure of name MateComponent_Plugin_info. An exmaple of how to use it folows:
static CORBA_Object hi_shlib_make_object (PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_Environment *ev) { CORBA_Object object_ref; object_ref = impl_Hi__create (poa, ev); if (object_ref == CORBA_OBJECT_NIL || ev->_major != CORBA_NO_EXCEPTION) { printf ("Server cannot get objref\n"); return CORBA_OBJECT_NIL; } matecomponent_activation_plugin_use (poa, impl_ptr); return object_ref; } static const MateComponentActivationPluginObject hi_plugin_list[] = { { "OAFIID:Hi:20000923", hi_shlib_make_object }, { NULL } }; const MateComponentActivationPlugin MateComponent_Plugin_info = { hi_plugin_list, "Hi example" };
typedef struct { const char *iid; /* This routine should call matecomponent_activation_plugin_use(servant, impl_ptr), * as should all routines which activate CORBA objects * implemented by this shared library. This needs to be done * before making any CORBA calls on the object, or * passing that object around. First thing after servant creation * always works. :) */ CORBA_Object (*activate) (PortableServer_POA poa, const char *iid, gpointer impl_ptr, /* This pointer should be stored by the implementation * to be passed to matecomponent_activation_plugin_unuse() in the * implementation's destruction routine. */ CORBA_Environment *ev); gpointer dummy[4]; } MateComponentActivationPluginObject;
void matecomponent_activation_plugin_use (PortableServer_Servant servant
,gpointer impl_ptr
);
You should call this routine to activate a shared library-based
CORBA Object. It will be called by OAF if the component exports
correctly an MateComponentActivationPlugin
structure named "MateComponent_Plugin_info".
|
The servant that was created |
|
The impl_ptr that was passed to the original activation routine |
void matecomponent_activation_plugin_unuse
(gpointer impl_ptr
);
Side effects: May arrange for the shared library that the implementation is in to be unloaded.
When a shlib plugin for a CORBA object is destroying an implementation, it should call this function to make sure that the shared library is unloaded as needed.
|
The impl_ptr that was passed to the activation routine |