[ Team LiB ] Previous Section Next Section

How jCOM Works

jCOM is said to work bi-directionally, which simply means that it allows communication in either direction between Java and COM components. Java objects can call COM components and, in turn, COM components can call Java objects. Of course, there exist two very disparate underlying architectures responsible for the wire-level communication that supports these distributed component frameworks.

At runtime, jCOM internally sets up a dual-protocol stack environment that accommodates support for each of these underlying infrastructures independent of one another (see Figure 33.1). For COM components, there is an implementation of COM/DCOM over DCE remote procedure calls; for Java objects, there is an implementation of RMI (Remote Method Invocation) over Java Remote Method IIOP (Internet Inter-ORB) protocol. Calls intended to cross between these stacks are handled through an internal translation that effectively masks the lower-level protocols from view. To an EJB, a call from a COM client looks as if it came from a Java client; to a COM component, a call from a Java client appears as if it came from an ordinary COM client.

Figure 33.1. jCOM runtime environment.

graphics/33fig01.gif

jCOM provides tools that you can use to auto-generate the higher-level COM/DCOM proxies and RMI stubs that clients use to marshal their calls between these infrastructures. Optionally, jCOM can be set up in a native mode fashion, utilizing native operating system dynamic link libraries to alleviate the network overhead of DCOM and thereby dramatically improving performance.

Let's look at a Java object calling a COM object:


import com.weblogicunleashed.account.*;
clsAccount account = new clsAccount();
double accountBalance = getAccountBalance("John Doe");

Figure 33.1 illustrates the standard flow of events that takes place when a Java object wants to access a COM component. The Java object first initiates its call to the jCOM-generated proxy object for that particular COM component. The proxy then communicates with the jCOM runtime engine, which in turn sends its messages via COM/DCOM as encapsulated remote procedure calls over TCP/IP to the COM component sitting in the Windows environment. At the lowest levels, jCOM uses standard Java networking classes on the server to make the call.

    [ Team LiB ] Previous Section Next Section