![]() |
![]() |
|
|
Overview of idltojava Compiler
The CORBA environment in the BEA Tuxedo product allows CORBA Java clients and CORBA Java joint client/servers to invoke operations on CORBA objects in a BEA Tuxedo domain using the industry standard Object Management Group (OMG) Interface Definition Language (IDL) and Internet Inter-ORBProtocol (IIOP) defined by the OMG.
To build CORBA Java clients and CORBA Java joint client/servers that can access CORBA objects, you need the BEA idltojava compiler, a tool that converts OMG IDL files to Java client stub and skeleton files. The idltojava compiler is included with the BEA Tuxedo software.
This topic includes the following sections:
Where Do I Get the BEA idltojava Compiler?
The BEA Tuxedo CD-ROM includes the BEA version of the idltojava compiler. Once you have installed the BEA Tuxedo software, you can find the idltojava compiler in TUXDIR/bin.
How Does the BEA idltojava Compiler Differ from the Sun Microsystems, Inc. Version?
The idltojava compiler provided with the BEA Tuxedo product includes several enhancements, extensions, and additions that are not included in the original compiler produced by Sun Microsystems, Inc. This topic includes a summary of the revisions in the compiler included with the BEA Tuxedo product. For detailed information on using the idltojava compiler provided with the BEA Tuxedo product, see the topic Using the idltojava Command.
The BEA Tuxedo idltojava compiler:
What Is IDL?
Interface Definition Language (IDL) is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. In distributed object technology, new objects must be able to be sent to any platform environment and have the ability to discover how to run in that environment. An ORB is an example of a program that uses an interface definition language to "broker" communication between one object program and another.
All CORBA objects support an IDL interface; the IDL interface defines an object type. An interface can inherit from one or more other interfaces. IDL syntax is very similar to that of Java or C++, and an IDL file is functionally the CORBA language-independent equivalent to a C++ header file. IDL is mapped into each programming language to provide access to object interfaces from that language. With Java IDL, these IDL interfaces can be translated to Java using the idltojava compiler. For each IDL interface, the idltojava compiler generates a Java interface and the other .java files needed, including a client stub and a server skeleton.
An IDL interface declares a set of client-accessible operations, exceptions, and typed attributes (values). Each operation has a signature that defines its name, parameters, result, and exceptions. Listing 1-1 shows the IDL for the Simple interface in the Simpapp sample application included with the BEA Tuxedo product.
Listing 1-1 An IDL Interface for the Simpapp Sample Application
#pragma prefix "beasys.com"
interface Simple
{
//Convert a string to lower case (return a new string)
string to_lower(in string val);
//Convert a string to upper case (in place)
void to_upper(inout string val);
};
interface SimpleFactory
{
Simple find_simple();
};
What Is Java IDL?
Java IDL is not a particular kind of Interface Definition Language (IDL) apart from OMG IDL. The same IDL can be compiled with the idltojava compiler to produce CORBA-compatible Java files, or with a C++ based compiler to produce CORBA-compatible C++ files. The compiler that you use on the IDL is what makes the difference. The OMG has established IDL-to-Java mappings as well as IDL-to-C++ mappings. The language-based compilers generate code based on the OMG CORBA mappings to their particular language.
The BEA Tuxedo product provides its own "brand" of Java IDL. In other words, the BEA Tuxedo product provides all of the components you need to build CORBA Java clients and CORBA Java joint client/servers that are capable of accessing CORBA objects. The key components in the BEA Tuxedo product are listed in Accessing CORBA Objects.
Accessing CORBA Objects
You can build two types of applications using the idltojava compiler:
CORBA Java clients and CORBA Java joint client/servers communicate with the Application-to-Transaction Monitor Interface (ATMI) environment in the BEA Tuxedo product using the Internet Inter-ORB Protocol (IIOP). The ATMI environment in the BEA product does not support the hosting of CORBA Java server objects.
Note: A joint client/server is a client that implements CORBA server objects to be used as callback objects. The server role of the remote joint client/server is considerably less robust than that of a BEA Tuxedo CORBA server. For more information about joint client/servers, see Using CORBA Server-to-Server Communication.
The BEA Tuxedo product provides all of the components you need to build CORBA Java clients and CORBA Java joint client/servers capable of accessing CORBA objects. The key components are:
CORBA Java clients and CORBA Java joint client/servers obtain object references from:
For example, the client could invoke a create method on DocumentFactory object to create a new Document. The DocumentFactory create method would return an object reference for Document to the client.
The use of a factory object to obtain object references is the recommended method for CORBA Java clients in this release of the BEA Tuxedo product.
The FactoryFinder object registers, stores, and finds CORBA objects within a single BEA Tuxedo domain or across multiple domains.
For detailed information on how to use the FactoryFinder object, see the CORBA Javadoc.
After an object reference is obtained, the client must narrow it to the appropriate type. IDL supports inheritance; the root of its hierarchy is Object in IDL, org.omg.CORBA.Object in Java. (org.omg.CORBA.Object is, of course, a subclass of java.lang.Object.) Some operations, notably name lookup and unstringifying, return an org.omg.CORBA.Object, which you narrow (using a helper class generated by the idltojava compiler) to the derived type you want the object to be. CORBA objects must be explicitly narrowed because the Java run time cannot always know the exact type of a CORBA object.
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|