Calling IDL Objects from JAVA [message #65140] |
Thu, 12 February 2009 14:49 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
We are working on a new web portal that uses JAVA code
for most of its operations. We wish to add some graphical
functionality to the web page, so we are using the
JAVA bridge to call some already defined IDL objects
that open a file, process the data, create a PNG file,
and display it on the web page.
All of this works reasonably well. (We have had
some weird problems with the IDL JAVA Bridge
Assistant Wizard, or whatever it is calling itself
these days, but for the moment we have overcome these.)
Our main problem is that our IDL objects use a LOT
of keywords in their methods. Specifically, in their
SetProperty methods. We do this primarily for ease of
communicating with superclass objects, and it seems to
be a "best practice" to judge from most of the objects
written from within the ITTVIS confines.
As it happens, JAVA doesn't know anything at all
about keywords, and indeed the IDL JAVA Bridge
programmers who wrote the JAVA wrappers admit that
you can't pass keywords to IDL object methods from
JAVA. Bummer, to say the least. :-(
So much a bummer that you wonder why anyone would bother
to write a JAVA IDL Bridge in the first place.
But that aside, perhaps someone has some ideas on how to
proceed. We have kicked around several ideas, none terribly
compelling, that would have the advantage of us not having
to write duplicate methods for all of our important methods
that we wanted to expose to the JAVA programmer.
We have settled, we think, on JAVA passing a "keyword string"
of keyword:value pairs, that we would parse to create an
anonymous structure of keywords and their values. As long
as our keyword values are fairly "generic" (strings, integers,
and floats), this is not a huge deal. We take this keyword
structure and pass it to the appropriate object method, which
is also named in the same string. (We use CALL_METHOD for the
latter.)
Has anyone run into this problem before? (I can't imagine
you haven't!) What have you done to solve it?
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|