Re: CORBA question



Diego Sevilla Ruiz wrote:

> Hello, Dietmar:
>
> On Sat, 21 Apr 2001, Dietmar Maurer wrote:
>
> > Hi everyone.
> >
> > Maybe someone of you know the answer: CORBA has those Contexts - client
> > site attributes which are sent to the server. Is it somehow possible to
> > specify such attributes for an object reference, which are then sent to
> > the server each time I call a method on that object. For example if I
> > have a database which stores localized values:
> >
> > interface Database {
> >
> >     any getValue (in string key, in string locale);
> >
> >     ... many other methods, which all needs those locale parameter
> > };
> >
> > another way would be to use Contexts:
> >
> >     any getValue (in string key) context ("locale");
> >
> > which only makes it more difficult to use (see C language mappings). So
> > what I would
> > like to have is:
> >
> >
> > interface Database context ("locale")  {
> >
> >     any getValue (in string key);
> >
> > };
> >
> This is not standard CORBA.
>
> > I can then set the locale once on the object reference at the client,
> > which is the passed to the
> > server each time I call a method on that Object.
> >
> Note that object references are only "client-side" representations of a
> server object, and that these references are not "passed" to the server
> ORB. Only the object key (which represents the target object) is passed to
> the server ORB (see H&V book, page 616).
>
> > So is there a way to do such things in CORBA?
> What you propose is not doable in a way different from a
> context for each operation.
>
> Note however, that if I understood well the question, you can do it
> several times easier than what you propose. Imagine that you obtain a
> Database object with an operation "setLocale". The corresponding server
> object will know from that point what is the locale it must use.

This does not work because it sets the locale for all clients. You share
those databases between different clients, but each client wants to use
a separate locale. The locale is a per client setting, not an attribute of
the server. But the suggestion below sounds good:

> This means that you must have "active" at least a Database object per
> locale. Note that I use "active", not "allocated", as all the requests can
> be served by only one object using the correct POA policies.
>
> If you know the locale beforehand, you even can create objects whose
> object key includes the locale (say "es_xxx", where xxx identifies _that_
> Database object).

I think this will work, although you can never change the locale on such an
object.

Thanks for that hint :-)

> Another one more thing, and sorry for my little knowledge of C mapping,
> but, isn't it that you can share context properties between different
> client-side invocations?

Sure, but it is still a bit clumsy to use.

- Dietmar





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