Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Corba > mapping java =>...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 505 of 534
Post > Topic >>

mapping java => C++ objects

by Jason Stelzer <mental@[EMAIL PROTECTED] > Aug 1, 2007 at 11:11 AM

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.




 3 Posts in Topic:
mapping java => C++ objects
Jason Stelzer <mental@  2007-08-01 11:11:12 
Re: mapping java => C++ objects
"arun.darra@[EMAIL P  2007-08-12 20:27:13 
Re: mapping java => C++ objects
Jason Stelzer <mental@  2007-08-14 12:56:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 17:17:13 CDT 2008.