
CORBA/EJB Interoperability
--------------------------

This README describes how to achieve CORBA/EJB interoperability. More
specifically, the sample code in this directory demonstrates how a
MICO client can access an EJB server (the other direction is trivial).
The source code in this directory is portable to other conformant
CORBA/EJB implementations; the only MICO and Sun EJB specific parts
are the tools used to compile, deploy and run the application. It
should be fairly straight forward to adopt it to other CORBA/EJB
implementations.


Prerequisites
-------------

 - Sun's J2EE 1.3.1
 - Sun's Java2 JDK 1.3.1_02

both can be downloaded for free from java.sun.com

NOTE: there is currently an unresolved problem with JDK 1.4.0. Don't
use this version!


Manifest
--------

Converter.java     : EJB interface of 'Converter'
ConverterBean.java : EJB implementation of interface 'Converter'
ConverterHome.java : EJB home interface for 'Converter'
converter-jar.xml  : XML descriptor for the Java Archive (.jar)
converter-ri.xml   : XML descriptor for the Enterprise Archive File (.ear)
gen-libejbcpp      : Creates libejbcpp.a; a supporting library
                     for the C++ client
client.cc          : CORBA C++ client
do-deploy          : Deploys the converter EJB application
run-client         : Runs the client


Running the demo
----------------

Compile all the necessary binaries by typing "make" in this directory.
This will generate the MICO client and the EJB-EAR file. Before you
can run the demo, you need to deploy the EJB-EAR. It is assumed that
the EJB server is running on localhost. Type 'do-deploy' in this
directory to deploy the EJB converter application. Once the server is
deployed, simply type 'run-client' to run the MICO client. The output
of client should be 'Result: 1100'.


Comments
--------

The EJB application implements a stateless entity bean that does some
(fake) currency conversions. Look at Converter.java for the bean
interface. The Makefile uses Sun's rmic compiler to generate IDL from
the Java interface, according to the Java-to-IDL mapping (note that we
are _not_ talking about the IDL-to-Java mapping!). Even for the simple
Converter interface, this results in over a dozen(!) IDL interfaces.
The MICO client is coded against these IDL interfaces. The shell
script 'gen-libejbcpp' creates a C++ library from the IDL
specifications generated by rmic.

The rmic tool is invoked with the command line option -noValueMethods.
This inhibits the generation of operations for value types. Doing this
reduces dramatically the number of interfaces that the C++ client has
to worry about.

MICO's IDL compiler is invoked with the option -DprimaryKey=primKey.
This in effect renames all occurances of 'primaryKey' to 'primKey' in
the IDL specifications. This has to be done because the identifier
'primaryKey' clashes with the keyword of the CORBA Component Model,
which MICO supports.

The EJB server runs an OMG compliant CosNaming server where an
instance of the Converter home interface is registered. The
interoperable naming service name (INS) for this naming service is:
corbaloc::1.2@localhost:1050/NameService

Note that MICO uses GIOP 1.0 and IIOP 1.0 by default. You need to give
the MICO client the command line options -ORBGIOPVersion 1.2
-ORBIIOPVersion 1.2


That's it!  Enjoy!
