Hello, I'm rather new to corba so if this is a faq, I'll happily go
read the relevant docs or url. I just need a nudge.
My situation is this. The company I'm at has a java app running in
jboss that they need to integrate into a legacy distributed perl app. I
chose corba because this is going to be used in a performance critical
piece of code and web services simply have too much overhead. So at
this point I'm using jacorb on the java side and omniORB on the C/perl
side.
Since I'm using jboss and the way they support corba is via annotations
in the java class files combined with reflection at deployment time to
expose things, this means I need to generate IDL from the class files
then create C++ stub code. I've done this and have things working.
I've written a C++ library with C wrappers and a perl module in C to
use them. I have a fairly complicated data structure to return, so I
created a custom type but I've come into a minor bit of difficulty. I'm
not clear on how to map a 'traditional' pojo in corba. Something like:
public class Foo {
private String val;
public String getVal(){
return val;
}
public void setVal(String s){
val = s;
}
...
}
When I used idl generated by rmic for this type of bean, I would get
back an object ref that would consistently return an empty
CORBA::WStringValue object. After examining the objects in gdb, I'm
reasonably sure what is happening is that the 'private' string isn't
being returned by getVal(). Its there. I see it marshaled, the accessor
just isn't returning what I thought it should. The problem is, I'm not
sure what the generated IDL should look like as this is the first time
I've done something like this.
In the interim, what I've done is create a class in java that is
essentially a glorified C style struct.
public class Foo {
public String val;
...
}
I populate the member variables of a Foo with all the values I need to
return and on the C++ side it is unmarshaled exactly as I'd expect.
After that its pretty boring. I just need to copy the data I need into
perl side data structures, release references and do cleanup.
I'd really like to be able to use the former style pojo as the latter
makes the other java developers twitch.
I've only spent a few days working on this, and I'm still reading quite
a bit and learning how stuff gets marshalled. If anyone has example IDL
I could look at that'd be great. I've done ok with fixing up a lot of
the busted crap that rmic generates, but I seriously lack experience at
this stuff.
As it stands, I'm at least feature complete from a prototype
perspective. I can make the calls I need to from perl and get the right
data back. I'm sure I have a bit of tweaking to do to ensure there are
no leaks, but things work.
--
J.
arun.darra@gmail.com - 12 Aug 2007 21:27 GMT
> Hello, I'm rather new to corba so if this is a faq, I'll happily go
> read the relevant docs or url. I just need a nudge.
[quoted text clipped - 67 lines]
> --
> J.
Hi,
you can use "attribute's" to represent ur simple bean.
Ur IDL will look something like this:
sample.idl :
interface Sample
{
attribute String val;
};
when this idl file is compiled by a idl compiler it will generate
automatically a getter and a setter (like your bean).
I have used omniORB its pretty cool and easy to use,
but I have one question for u - howcome ur using JacORB (on java side)
instead the std SunORB (that comes as part of the JDK), any specific
reason?
Regards,
Arun
Jason Stelzer - 14 Aug 2007 17:56 GMT
> Hi,
>
[quoted text clipped - 10 lines]
> when this idl file is compiled by a idl compiler it will generate
> automatically a getter and a setter (like your bean).
Actually , that generates the declaration for a getter/setter which
then needs to be implemented in my Impl class. Thats fine, but its just
a bunch of boiler plate code to write.
> I have used omniORB its pretty cool and easy to use,
> but I have one question for u - howcome ur using JacORB (on java side)
> instead the std SunORB (that comes as part of the JDK), any specific
> reason?
We're mainly using it as it is what jboss uses as its orb in their
application server. So far it performs well enough and is fairly
painless to use. I've heard mixed reviews about sun's orb
implementation on a few lists. I've yet to hear a compelling enough
reason to push for a reconfiguration of our app servers.