Registration

Name

Registration -- Registering CORBA objects to Bonobo Activation.

Synopsis


#include <bonobo-activation/bonobo-activation.h>


enum        Bonobo_RegistrationResult;
Bonobo_RegistrationResult bonobo_activation_active_server_register
                                            (const char *iid,
                                             CORBA_Object obj);
void        bonobo_activation_active_server_unregister
                                            (const char *iid,
                                             CORBA_Object obj);
typedef     BonoboActivationPlugin;
typedef     BonoboActivationPluginObject;
void        bonobo_activation_plugin_use    (PortableServer_Servant servant,
                                             gpointer impl_ptr);
void        bonobo_activation_plugin_unuse  (gpointer impl_ptr);

Description

When writing a component which can be activated through Bonobo Activation by clients, you need to be register your component to Bonobo Activation once it is created.

Details

enum Bonobo_RegistrationResult

   typedef enum
   {
      Bonobo_ACTIVATION_REG_SUCCESS,
      Bonobo_ACTIVATION_REG_NOT_LISTED,
      Bonobo_ACTIVATION_REG_ALREADY_ACTIVE,
      Bonobo_ACTIVATION_REG_ERROR
   }
   Bonobo_RegistrationResult;


bonobo_activation_active_server_register ()

Bonobo_RegistrationResult bonobo_activation_active_server_register
                                            (const char *iid,
                                             CORBA_Object obj);

Registers obj with iid in the local bonobo-activation-server daemon.

iid : IID of the server to register.
obj : CORBA::Object to register.
Returns : status of the registration.


bonobo_activation_active_server_unregister ()

void        bonobo_activation_active_server_unregister
                                            (const char *iid,
                                             CORBA_Object obj);

Unregisters obj with iid in the local OAF daemon.

iid : IID of the server to unregister.
obj : CORBA::Object to unregister.


BonoboActivationPlugin

typedef struct {
	const BonoboActivationPluginObject *plugin_object_list;
	const char *description;
        gpointer dummy[8];
} BonoboActivationPlugin;

Components which want to be activated as shared libraries must export an BonoboActivationPlugin structure of name BonoboActivation_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;
        }

        bonobo_activation_plugin_use (poa, impl_ptr);

        return object_ref;
}

static const BonoboActivationPluginObject hi_plugin_list[] = {
        {
                "OAFIID:Hi:20000923",
                hi_shlib_make_object
        },
        {
                NULL
  	}
};

const BonoboActivationPlugin BonoboActivation_Plugin_info = {
        hi_plugin_list,
        "Hi example"
};


BonoboActivationPluginObject

typedef struct {
	const char *iid;

	/* This routine should call bonobo_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 bonobo_activation_plugin_unuse() in the 
                                                         * implementation's destruction routine. */
				  CORBA_Environment *ev);
        gpointer dummy[4];
} BonoboActivationPluginObject;


bonobo_activation_plugin_use ()

void        bonobo_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 BonoboActivationPlugin structure named "Bonobo_Plugin_info".

servant : The servant that was created
impl_ptr : The impl_ptr that was passed to the original activation routine


bonobo_activation_plugin_unuse ()

void        bonobo_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.

impl_ptr : The impl_ptr that was passed to the activation routine