Hi,
There are two specifications in these areas.
1) Java2IDL: http://www.omg.org/docs/formal/08-01-14.pdf
2) IDL2Java: http://www.omg.org/docs/formal/08-01-11.pdf
Let's try to use a few scenarios to help us understand what rules should be
applied.
Case A: There is an existing CORBA service (Java or C++) with IDL. Now we
want to consume it using SCA.
Here is what I would do:
a) Run idl2java to generate a java interface (ignoring other stubs and
skeletons) from the IDL.
b) Declare a SCA reference with binding.corba and set the interface to the
one generated from a)
c) The Tuscany corba invoker should be able to create a request stream for
input args and parse the response to get the return value.
The corba invoker needs to find the corba operation name from the java
method and know how to marshal/unmarshal the parameters/return value.
Case B: We have a SCA component and we want to expose it as a CORBA service.
The corba service binding listener will have to unpack/pack data from the
ServerRequest. Let's assume the component service interface is defined in
java, then we need to follow the Java2IDL spec so that we handle the java
parameters/return value following the CORBA IDL rules.
Ideally, the exposed CORBA service would behave as it has an IDL generated
from "rmic -idl <java_interface>".
Thanks,
Raymond
[snip]
Hi,
I recently submitted some code, which helps invoking remote objects.
Mechanism for invoking remote CORBA objects is determining operation
arguments types by Java types and I'm not sure that Java to CORBA mapping
model I proposed is OK.
There is quite nice description of Java to CORBA mapping under [1]. It
shows how idlj compiler creates Java structure basing on idl file and I
believe we shouldn't precisely follow those rules and try to make them as
simple as possible. Am I right?
1. Structures
I proposed that CORBA structures will be Java classes, with public fields
and no get/set methods. So every class field is member for CORBA
structure. Or maybe we should map JavaBean classes to CORBA structures?
2. Sequences and arrays
Sequences and arrays can be mapped to Java by arrays or lists.
Unfortunately both CORBA types behaves bit different, additionally CORBA
arrays have fixed length so there should be possibility to distinguish
those types somehow. For now on I cannot find any other solution, but
annotating arrays with it's target length. Any opinions?
3. Arguments with inout/out modifiers
In CORBA, operation argument value can be changed. As we know Java
supports passing arguments by values only, so update on argument is not
possible. Such was solved in Java by wrapping arguments in holder classes,
ie:
public class IntHolder {
public int value;
}
This means if user wants to get his argument updated he needs to create
argument in holder class, which could be tough (maybe there are low-level
techniques which allows to manipulate such arguments?).
I know I should provide some method to recognize if users class is holder
for inout/out argument:
a. annotation
b. by implementing interface, ie:
public interface Holder {
void setValue(Object value);
Object getValue();
}
Or maybe there is some other solution? Which one should I choose?
I'll appreciate any comments. Just ask if you need more details.
[1] - http://members.tripod.com/gsraj/corba/chapter/
Thanks,
Wojtek