Re: a proposal for 2 OAF features



On 3 Jul 2000, Maciej Stachowiak wrote:

> >          /* ActivationResult */
> >          enum ActivationResultType { 
> >                  RESULT_OBJECT, 
> > @@ -87,6 +87,7 @@
> >                  REG_SUCCESS, 
> >                  REG_NOT_LISTED, 
> >                  REG_ALREADY_ACTIVE, 
> > +                REG_EXCLUSIVE,
> >                  REG_ERROR 
> >          };

The meaning of and need for this additional ActivationResult is very
unclear.

> > +
> > +extern gboolean oaf_exclusive;

A global variables is very broken for this case. Multiple objects might be
activated in the same process. You have to do implement exclusivity only
for the object activated from the command line.

> > --- liboaf/oaf-servreg.c	2000/05/07 18:34:15	1.5
> > +++ liboaf/oaf-servreg.c	2000/07/03 20:37:48
> > @@ -47,6 +47,9 @@
> >  			close (iorfd);
> >  	}
> >  
> > +        if(oaf_exclusive)
> > +                return OAF_REG_EXCLUSIVE;
> > +
> >  	regcat.session_name = oaf_session_name_get ();
> >  	regcat.username = oaf_username_get ();
> >  	regcat.hostname = oaf_hostname_get ();
> > @@ -81,6 +84,9 @@
> >  	OAF_ObjectDirectory od;
> >  	OAFRegistrationCategory regcat = { "IDL:OAF/ObjectDirectory:1.0" };
> >  	CORBA_Environment ev;
> > +
> > +        if(oaf_exclusive)
> > +                return;

These two hunks are totally incorrect. oaf-servreg is not related to
activated object registration.

> > +        params = GNOME_stringlist__alloc ();
> > +        if(actinfo->flags & OAF_FLAG_EXCLUSIVE) {
> > +                params->_length = 1;
> > +                params->_buffer = CORBA_sequence_CORBA_string_allocbuf (params->_length);
> > +                params->_buffer[0] = oaf_alloca (sizeof ("oaf-exclusive"));
> > +                g_snprintf (params->_buffer[0], sizeof ("oaf-exclusive"),
> > +                            "oaf-exclusive");
> > +        }
> > +        else
> > +                params->_length = 0;
> > +        CORBA_sequence_set_release (params, CORBA_TRUE);
> > +
> >  	retval =
> > -		GNOME_GenericFactory_create_object (factory, si->iid, &dummy,
> > +		GNOME_GenericFactory_create_object (factory, si->iid, params,
> >  						    ev);

Use of params to factories is deprecated - please do not use. Factories
are not supposed to register with OAF any of the objects they create
(although for apps like gnumeric they will certainly want to register the
object in another place such as the name service). If one wishes to have
the factory return the same object for multiple activations, that logic
needs to be coded into the factory object. The point of factories is
basically to allow implementing custom activation logic beyond what OAF
allows.

> > --- test/empty-server.c	2000/05/27 14:47:10	1.6
> > +++ test/empty-server.c	2000/07/03 20:37:49
> > @@ -81,5 +81,5 @@
> >  static void
> >  do_Nothing (PortableServer_Servant servant, CORBA_Environment * ev)
> >  {
> > -	g_print ("doNothing called!");
> > +  g_print("I just did nothing\n");
> >  }

Whatever, :)
-- Elliot
The best way to accelerate a Macintosh is at 9.8 meters per second per second.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]