1. CORBA binding general description

1.1 Providing interface

CORBA binding both for service and reference side can be used with two types of Java interface:

1. Generated by idlj compiler

2. Created by user according to rules for Java to CORBA mapping

In both cases interfaces are almost the same. Difference is that generated interfaces extends/implements CORBA types which are ignored by binding.

Mapping rules are available under:
1. Java2IDL: http://www.omg.org/docs/formal/08-01-14.pdf
2. IDL2Java: http://www.omg.org/docs/formal/08-01-11.pdf

Samples of CORBA bindings can be found in sca/itest/corba module.

1.2 CORBA service location

CORBA binding can be configured by:

1. Name, host, port parameters

Example service declaration:

<service name="ScenarionOneServiceGenerated" promote="ScenarionOneServiceGenerated">

    <interface.java interface="org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"/>

    <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscanyGenerated"/>

</service>

2. Corbaname URI, which is:

corbaname::<host>:<port>/<NameService>#<Name>

host, port, NameService are optional.

Example reference declaration:

<reference name="scenarioOne">

    <tuscany:binding.corba uri="corbaname::localhost:5060#NamedWithURI"/>       

</reference>

 1.3 Usage of "id" attribute in CORBA service bindings

User can also provide id parameter for service binding. It's not required, but helpfull if we want to publish service which will be consumed by some idlj generated code. This generated code contains *Helper classes with narrow(...) methods. Narrow(...) method compares obtained CORBA reference id to some local (which was generated). CORBA binding cannot provide this id automatically because it doesn't have access to Java path of component interface. Workaround is to:

a). provide id manually by "id" attribute

Example of using "id" attribute:

<service name="ScenarionOneServiceGenerated" promote="ScenarionOneServiceGenerated">

    <interface.java interface="org.apache.tuscany.sca.test.corba.generated.ScenarioOneOperations"/>

    <tuscany:binding.corba host="localhost" port="5060" name="ScenarioOneTuscanyGenerated" id="IDL:org/apache/tuscany/sca/test/corba/generated/ScenarioOne:1.0"/>

</service>

b). change generated code to use unchecked_narrow(...) methods

1.4 User provided interface exceptions

Exceptions declared by user should be named to match remote exception ID.

Example: we expect remote exception with ID IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0 then we should create exception org.apache.tuscany.sca.test.corba.generated.WrongColor.

This also works when user is creating service binding. Component exception will be thrown with ID translated from Java name to IDL:... form.

2. TODO list

TODO

Description

Solution


Add methods to operations mapping

Merge code from Java2IDLUtil.java

Extract some code to additional module, ie. corba-common, corba-util and use it in binding-ejb-runtime and binding-corba-runtime.


Unions handling

Pure Java interface is not enough to describe CORBA union. There is need to describe which getter method should be executed for obtained discriminator value, and how to handle pass union value to stream.

It can be done by annotation.


Arrays handling

There should be method to distinguish them from sequences.

It can be done by annotation.


INOUT and OUT argument types handling

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


1. annotation - but possibility to have argument change would be lost
2. by implementing interface, ie:

public interface InOutHolder {
    void setValue(Object value);
    Object getValue();
}
 public interface OutHolder {
    void setValue(Object value);
    Object getValue(); 
}
3. Ignoring INOUT/OUT arguments


  • No labels