[omniORB] omniORBpy and JPython

Carlson, Andy andycarlson@att.com
Mon, 26 Jun 2000 02:37:38 -0700


I eventually found another way to solve my problem. A bit off-topic perhaps
but it may be of interest.

The problem was how to call CORBA servers directly from a tool which
supports JPython as a scripting environment.

The answer I came up with was to use of the fact that JPython can make calls
to Java classes as if they were Python classes. I built the IDL using the
Sun JavaIDL compiler and then imported the Java stubs into my Python script.
Result - my JPython script can now make CORBA calls.

This approach is not the same as using omniORBpy though, because I'm
actually calling an implementation of the CORBA Java binding, not the Python
binding. This means calling narrow() when necessary and using the Java
mapping for out parameters (i.e. using Holder classes rather than return
values). 

Code using this approach would not be portable to CPython/omniORBpy. It did
get the job done though!

Andy
----------------------------------------------------------------------------
-----------
Andy Carlson. AT&T Labs (UK)   	Tel: +44 1527 495258
E-Mail: andycarlson@ipo.att.com	Fax: +44 1527 495229



> -----Original Message-----
> From:	Duncan Grisby [SMTP:dgrisby@uk.research.att.com]
> Sent:	Friday, June 23, 2000 2:53 PM
> To:	Carlson, Andy
> Cc:	zlist-Omniorb (E-mail)
> Subject:	Re: [omniORB] omniORBpy and JPython 
> 
> On Friday 23 June, "Carlson, Andy" wrote:
> 
> > Has anyone looked at what would be required to make omniORBpy work in
> > JPython. The main snag is that omniORBpy uses C++ modules for its low
> level
> > implementation. JPython cant call these directly but the JPython web
> site
> > says that it is possible to use them by writing a JNI Bridge.
> 
> I'm afraid I don't think this is likely to happen. omniORBpy doesn't
> just use the Python/C API a little bit -- it uses it a lot.
> Essentially everything you do in omniORBpy involves a great deal of
> interaction with the C API. The marshalling functions have to be able
> to read and create Python objects from C++. You only have to look at
> the ratio of C++ code to Python code in omniORBpy to see that a great
> deal would have to be changed to support JPython.
> 
> That said, the basic design of omniORBpy, and the layout of the stubs,
> could probably be used to create a JPython ORB, based on a Java ORB.
> There's a small (!) project for someone.
> 
> Cheers,
> 
> Duncan.
> 
> -- 
>  -- Duncan Grisby  \  Research Engineer  --
>   -- AT&T Laboratories Cambridge          --
>    -- http://www.uk.research.att.com/~dpg1 --