[DB-SIG] The CORBA DB API fantasy

Andy Dustman adustman@comstar.net
Tue, 16 May 2000 14:24:40 -0400 (EDT)

On Tue, 16 May 2000, M.-A. Lemburg wrote:

> Andy Dustman wrote:
> > 
> > > Hmm, Andy could probably steal a few ideas from OLE DB and reimplement
> > > them using CORBA as backend.
> > >
> > > I'm not sure whether it's worth the effort though.
> >
> > Heh. I think I'd just as soon try to come up with something that wasn't
> > based on an existing framework, get stuck, and then poke around for some
> > new ideas.
> I was referring to the effort needed to get the CORBA DB API
> up and running ... you have two problems here: the server *and*
> the client sice. While the Python client is probably manageable,
> the server side will certainly be a huge undertaking.

Well, it'd say it's "non-trivial". :) The IDL for the interface, of
course, can be used for both the stubs (client-side) and the skeletons
(server-side). Being able to implement the server-side means you have
server sources.

However, think about the Python client side. The IDL results maps
one-to-one to the Python binding. So what I am proposing is
two-fold: a) an actualy CORBA interface defined by IDL. b) a Python
interface that is functionally identical to the CORBA one using the
standard CORBA Python language mapping, but actually using no CORBA. With
the CORBA Python language mapping, all the CORBA stuff is really hidden
behind the scenes, so we can just pretend it's there and sorta
transliterate into the native API, which requires no server changes.

Brief example, cribbed from ILU. First, the IDL:

module Tutorial {

  exception DivideByZero {};

  interface Calculator {

    // Set the value of the calculator to _v_
    void SetValue (in double v);
    // Return the value of the calculator
    double GetValue ();
    // Adds _v_ to the calculator_s value
    void Add (in double v);
    // Subtracts _v_ from the calculator_s value
    void Subtract (in double v);
    // Multiplies the calculator_s value by _v_
    void Multiply (in double v);
    // Divides the calculator_s value by _v_
    void Divide (in double v) raises (DivideByZero);

  interface Factory {

    // Create and return an instance of a Calculator object
    Calculator CreateCalculator();

The code looks something like this:

def Get_Tutorial_Calculator (sid, ih):
        f = ilu.LookupObject (sid, ih, Tutorial.Factory)
        c = f.CreateCalculator()
        return (c)

Then c is a Calculator object, which has SetValue(), GetValue(), Add(),
Subtract(), Multiply(), and Divide() methods. Once you've actually got an
object, manipulating it is just standard Python stuff. So any CORBA-ish,
implementation-dependent stuff should obviously be hidden away.

andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"