[ tim ]
> I'm trying to get jython working with the java corba implementation,
> client code. To do this, I build some idl, use idlj to create the
> 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
> called Foo that defines the stuff that I want to interact with. Lets
> that this includes an interface called Main. Idlj will put the
> .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
> files for the Foo client: I'd have thought from Foo import *, but
> doesn't seem to work - jython seems unable to identify Foo as a set
> java stuff.
> Orb = ORB.init ()
> Blah = Orb.string_to_object ("corbaloc::localhost:1234/Foo")
> Blah = Blah._narrow (<something that passes the java interface
> in Foo/Main.java>)
> The challenges seem to be getting that subdirectory of java stuff
> the jython namespace, and then how to pass a java interface to a
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
from org.omg.CORBA import ORB
Hope this helps,
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day