Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

J2SE 1.4 breathes new life into the CORBA community, Part 1

Get started developing enterprise CORBA applications with the latest version of J2SE

  • Print
  • Feedback

Page 4 of 6

Portable interceptors

Portable interceptors (PIs) are hooks into the ORB through which ORB services can intercept the ORB's normal execution flow. I'll discuss the several types of PIs in Part 4.

Interoperable Naming Service

The INS attempts to ease multiple sore points with CORBA object references and the naming device. One of the problems that developers have had with IORs (interoperable object references) is that they are just too hard to read and even harder to remember. The INS supports simpler, human-readable object URLs, similar to the URLs that locate RMI (remote method invocation) objects. Developers have also found fault with the way names must be created for use with the naming service. The INS supports stringified names such as Acme/Finance/AccountsPayable. In Part 4, I'll cover the INS, and I'll also create a GUI-based naming service browser.

Dynamic anys

For those of you not familiar with CORBA, an any is a universal data type that can hold any other data type. Until CORBA 2.2, an any could not be created dynamically, a severe drawback for some applications. For example, debuggers, generic user interfaces for objects, and services such as the OMG Notification Service all require the ability to interpret values without knowing the values' IDL types at compile time. The DynAny interface was added to CORBA with the 2.2 revision to let applications dynamically compose and decompose any values. DynAny permits applications to compose at runtime a value whose type was unknown when the application compiled, and to transmit that value as an any. Similarly, DynAny allows applications to receive a value of type any from an operation invocation, and both to interpret the any's type (using the TypeCode interface) and to extract its value (using the DynAny interface) without compile-time knowledge of the IDL types involved. I will not cover dynamic anys in this series.

A quick example: Hello World

Now that you know what J2SE 1.4 offers, I'll quickly examine the fundamental steps required to build a CORBA application. I won't spend too much time explaining the code, since I'll cover many of the details in the remaining three parts of this series.

To create a CORBA application, follow these essential steps:

  1. Define the methods using the IDL
  2. Compile the IDL using a compiler, thus creating the programming-language-specific constructs
  3. Implement the server application, which consists of the method implementations and a host that starts up and registers the implementation with the ORB runtime
  4. Create client applications to use the server


As I mentioned above, I rush through these steps in this article. The later parts of this series will explain the important concepts with better examples. Without further ado, let's get started with the Hello World example.

Step 1: Define the methods using IDL

Here is the IDL for our simple Hello World server:

module hello
+{
  interface Hello
  {
    string sayHello();
    oneway void shutdown();
  };
};


Step 2: Compile the IDL using the idlj compiler

Here's the command that compiles the above IDL to create the Java interfaces and abstract classes:

  • Print
  • Feedback

Resources