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

Compare with Current View Page History

« Previous Version 13 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

Under development

Note that binding.corba is under development and may not be yet available in Tuscany releases.

<binding.corba>

The Tuscany Java SCA runtime supports CORBA using the <binding.corba> SCDL extension. New CORBA based service can be provided using a <binding.corba> element within a SCA <service>, existing CORBA object can be accessed using a <binding.corba> element within a SCA <reference>.

Using CORBA binding

Configuring CORBA service/reference

Location for both service and reference CORBA binding can be configured by:

1. Name, host, port parameters, where host and port points to name service, and name points to object within name service.

(info) 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="ScenarioOne/TuscanyGenerated"/>

</service>

2. Corbaname URI.

(info) Example reference declaration:

<reference name="scenarioOne">

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

</reference>

Providing interface

For both service and reference side you can use one of two types of Java interface:

1. Generated by idlj compiler from *.idl file.

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: Java2IDL, IDL2Java. Samples of CORBA bindings can be found in sca/itest/corba module.
 

Overloading, case collisions

When using Tuscany service/reference binding to communicate with traditional CORBA objects:

1. Don't overload method names in Java interface.

2. Don't create methods with names which differs only by case, ie. you shouldn't declare both methods: caseSensitive() and CaseSensitive().

You can ignore above rules if you are using Tuscany CORBA binding  to communicate with other Tuscany CORBA binding. Those constraints results from differences between IDL and Java. More details can be found in Method/operation mapping rules section.

Declaring exceptions

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

Example: if in reference binding remote object throws exception with ID "IDL:org/apache/tuscany/sca/test/corba/generated/WrongColor:1.0" then you should declare exception class named "org.apache.tuscany.sca.test.corba.generated.WrongColor".

The same in service bindings. SCA component exception will be thrown with ID created from Java name.

Method/operation mapping rules

IDL rules are different than rules in Java programming language - Java method names can't be always directly mapped to CORBA operations. Following table shows used mapping rules:

Mapping type

Description 

Examples: Java method - translated CORBA operation

1. Getters and setters

If user declared valid pair of getter and setter then those methods wouldbe translated to operations which are responsible for getting/setting objects attribute.

1. getName() - _get_name
2. setName(String newName) - _set_name
3. isName() - _get_name 

2. Overloaded names

CORBA does not support overloading method names - Java does.. Some mapping rules were applied to allow using overloaded names in Java interfaces using CORBA binding. Final operation name is created by taking method name and appending it by CORBA parameters type names separated by '_' chars.

1. overloadedMethod() - overloadedMethod__
2. overloadedMethod(String arg1) - overloadedMethod__CORBA_WStringValue
3. overloadedMethod(String arg1, int arg2) - overloadedMethod_CORBA_WStringValue_long

3. Names with case collisions

CORBA is not case sensitive - Java is. CORBA ie. doesn't distinguish methods caseDifferent() and CaseDifferent(), so some mapping rules are fixing it. Final operation name is created by taking method name and appending it by indexes of characters which are capitals.

1. caseDifferent() - caseDifferent_4
2. CaseDifferent() - CaseDifferent_0_4

Usage of additional "id" attribute in CORBA service bindings

User can also provide id attribute 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 service binding provide this ID automatically basing on user provided Java interface name. Providing id attribute is the only way to provide custom identifier.

(info) 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>

Host environment types

CORBA binding supports two hosting environments.

host-corba-jse

It is the standalone hosting environment where various ORBs could be used. Note that you have to provide name service by yourself and configure service/reference to point onto desired ORB.
(info) Usage: add tuscany-host-jse-<version>.jar module to your class path.

host-corba-jse-tns

This hosting environment extends host-corba-jse. For every configured service CORBA binding which points to localhost Transient Name Service will be created and name servers for bindings using the same port will be shared.
(info) Usage: add tuscany-host-jse-tns-<version>.jar module to your class path.

host-corba-jee

It is the JEE application server environment. In this case ORB is obtained from JNDI by java:comp/ORB name and you don't need to provide name service. Also host and port (or their equivalent contained in corbaname URI) parameters are ignored.
(info) Usage: add tuscany-host-jee-<version>.jar module to your class path.

  • No labels