logo       

Re: Corba .narrow method - need to pass a java interface: msg#00039

lang.jython.user

Subject: Re: Corba .narrow method - need to pass a java interface

[ tim ]
> I'm trying to get jython working with the java corba implementation,
> as
> client code. To do this, I build some idl, use idlj to create the
> .java
> skeletons and helpers and then build my main client jython code. For
> simplicity, lets say the idl is in foo.idl, and this contains a
> module
> called Foo that defines the stuff that I want to interact with. Lets
> say
> that this includes an interface called Main. Idlj will put the
> relevant
> .java files into ./Foo The jython code needs to include stuff like:
>
> from org.omg.CORBA import *
> # something that I cannot work out to import all of the generated
> java
> files for the Foo client: I'd have thought from Foo import *, but
> this
> doesn't seem to work - jython seems unable to identify Foo as a set
> of
> java stuff.
> .
> .
> Orb = ORB.init ()
> Blah = Orb.string_to_object ("corbaloc::localhost:1234/Foo")
> Blah = Blah._narrow (<something that passes the java interface
> defined
> in Foo/Main.java>)
>
>
>
> The challenges seem to be getting that subdirectory of java stuff
> into
> the jython namespace, and then how to pass a java interface to a
> method.

idlj produces .java files. You need to compile them into class files
before using them in Jython. Make sure the /Foo directory is a
subdirectory of a classpath directory.
Once compiled, there is nothing special to these classes. You can use
them in Jython like any other java classes, e.g.
from Foo import MainInterface

Passing a java interface to a method is easier than you think: there
are no casts in Jython. Simply pass the object in, Jython does the
conversion for you.

from org.omg.CORBA import * won't work AFAIK, use explicit imports
instead:
from org.omg.CORBA import ORB

Hope this helps,
Oti.

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise