Re: Calling IDL Objects from JAVA [message #65137 is a reply to message #65135] |
Fri, 13 February 2009 06:52  |
sdettrick@gmail.com
Messages: 5 Registered: February 2007
|
Junior Member |
|
|
On Feb 12, 2:49 pm, David Fanning <n...@dfanning.com> wrote:
> 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.")
What about making your objects inherit IDLitComponent? Then you could
use SetPropertyByIdentifier instead of SetProperty.
I do not use Java at all, but I find IDLitComponent to be one of the
most useful classes in IDL.
Cheers,
Sean
|
|
|