You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

1. CORBA reference invocation mechanism 

 CORBA reference binding will use CORBA reference invocation mechanism, which can be used like this:

DynaCorbaRequest request1 = new DynaCorbaRequest(refCalcObject, "div");

//arguments, output type, exceptions configuration
request1.addArgument(2d);
request1.addArgument(2d);
request1.setOutputType(Double.class);
request1.addExceptionType(DivByZeroException.class);
try {
    //invocation
    DynaCorbaResponse response = request1.invoke();
    Double result = (Double) response.getContent(); //retrieve what you want
} catch (Exception e) {
}

Mechanism arguments, return types, exceptions are configured by Java types, which matches with CORBA types. This API will not be used by end user, but knowledge of remote structures and how they maps to Java is required to consume CORBA objects with success.

2. Features table 

Feature

Description

Solution

 

TODOs

Integration with reference binding provider

CORBA reference binding needs to use CORBA reference mechanism API (DynaCorbaRequest, DynaCorbaResponse classes)


 

Implementation

Primitives

Passing variables as an arguments and retrieving return values

Primitives are mapped as follows (Java - IDL):
byte - octet
short - short
int - Long
long - LongLong 
float - float
double - double
char - char
boolean - boolean
String - string

 

INOUT/OUT modifiers

Structures

Passing variables as an arguments and retrieving return values

User defines CORBA structures as simple Java classes, with public fields, ie.

public class SomeStruct {
    public int member1;
    public String member2;
    public InnerStruct member3;
}
means, that user is expecting structure with fields int, String and third field as some other structure.

 

1. Recurrent  structures are not handled, ie.

public class Recurrent {
    public Recurrent member;
 }

2.  INOUT/OUT modifiers

Sequences

Passing variables as an arguments and retrieving return values

User defines CORBA sequence as an array, which may be multidimentional, ie operation:

...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2c34e21a-9055-4d74-8a9d-9fc63529eb8e"><ac:plain-text-body><![CDATA[ public int[][] getSequence();
]]></ac:plain-text-body></ac:structured-macro>
...

is equal to IDL declaration:


...
typedef<long> oneDimLong;
typedef<oneDimLong> twoDimLong; 
twoDimLong getSequence();
...

 

1. INOUT/OUT modifiers

References

Retrieving and passing CORBA references as arguments, return types

References matches to Java interfaces. Remote objects can be retrieved and dynamic implementation for its interface will be created. Dynamic implementation will allow further CORBA invocations on remote object - those references won't be managed be Apache Tuscany.

 

1. INOUT/OUT modifiers
2. Passing references as an arguments

Unions

Generated Java classes (which bases on idl files) contains discriminator.

?

 

Propose a solution

Arrays

Cannot distinguish them from sequences. Need to have compile-time info about array size.

Can be done by annotating variable declared as an argument, or as a structure member, ie.

public class SomeStruct {
    @Array(length=10)
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="156f5225-422d-4faf-a4eb-27e64a6a6cd0"><ac:plain-text-body><![CDATA[     public int[] array;
]]></ac:plain-text-body></ac:structured-macro>
}

 

Chose a solution

INOUT and OUT argument types

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?). 

Solution for determining if Java object was meant to be passed as an IN, INOUT or OUT argument:

a. annotation
b. by implementing interface, ie:

public interface Holder {
    void setValue(Object value);
    Object getValue();
}

 

Chose a solution

Exception handling


CORBA reference binding should provide method to retrieve and populate remote exceptions. Exceptions are similar to structures. If remote operation was declared with more than one exception, then exception which occurred should be determined by CORBA id, which may be ie. IDL:com/smt/SomeException:1.0.

Actual solution works fine form single exception operations. If operation has more than one declared exception and application exception will occur, then general  ExceptionTranslationException will be raised.
Determination of exception type can be implemented by comparing remote exception id string to some value declared on users class hierarchy side, ie. annotation.

If remote operation has declared exception and exception was raised, but user has passed  interface with no declared exception ExceptionTranslationException will be thrown.

 

Chose a solution 

  • No labels