Distributed object application development: The DCOM solution
Part 1: "
Link
."
Part 2: "
Link
."
Part 2: "
Link
."
DCOM overview
Microsoft's answer to distributed computing is the Distributed Component Object Model (DCOM) -- the "other" major standard to consider in the world of distributed objects. DCOM is simply an extension of Microsoft's Component Object Model (COM), formerly called Network OLE, which forms the basic architecture of the Windows operating system. The underlying objective of COM is to permit the independent development of software components that can intercommunicate, regardless of language or function. DCOM extends the functionality of COM by allowing components to communicate remotely via LAN, WAN, or the Internet.
And how does ActiveX fit in to this picture? ActiveX is no more than another representation of a DCOM object. ActiveX controls are designed to facilitate distribution of components over the Internet and provide integration of DCOM components into Web browsers (specifically Internet Explorer).
The pros and cons of DCOM
The biggest gain that DCOM provides in developing a distributed application is, not surprisingly, its tight integration with Microsoft operating systems and applications. For example, distributed systems using DCOM as its middle-ware will be able to leverage the powerful resources of components like Microsoft's Transaction Server and Internet Information Server 4.0. Both of these technologies rely on DCOM for remote communications. Furthermore, there are tons of Microsoft shops currently building COTS products and tools that are DCOM compatible, thus reducing the system development time by reusing these plug-and-play components.
DCOM-based applications can also take full advantage of Microsoft NT security mechanisms. Since the first release of DCOM, the application programming interface (API), including the security model, has been made readily available to developers. Through this model, developers can provide secure and authorized communications via Windows Domain, Novell Authenticators or DCE Kerberos. Security implementations in DCOM are also highly configurable. Developers and administrators have the ability to configure the security settings for each component using the DCOMCNFG utility. DCOMCNFG allows developers/administrators to define access control lists (ACLs) for each component. This is an important feature which provides the means to create complex, multi-user, multi-role, applications with n-levels of secure access.
There are three principal drawbacks to a DCOM implementation: non-intuitive and complex development process, platform dependencies, and ActiveX security issues.
One of the chief complaints of a DCOM solution, regardless of the programming language, is that the development effort is too awkward and complex. Fortunately, Microsoft's Visual J++ removes some of this complexity by making DCOM objects resemble Java classes. Interestingly enough, Java is better suited for DCOM development than other languages (Microsoft. Visual C++., Microsoft Visual Basic., Delphi, PowerBuilder) due to the Java Bindings provided by the Visual J++ tools.
As a product of the Micosoft world, DCOM architectures are tied heavily to Windows95 and WinNT platforms. This is a major stumbling block for any architectures that are not 100% Microsoft, so strides are being taken to port DCOM to other operating systems. A Microsoft solutions provider, Software AG, has developed a port to Sun Microsystems' Solaris UNIX platform and has plans to develop DCOM ports for other UNIX operating systems as well. Even more DCOM-porting initiatives are reportedly underway at Digital Equipment Corporation, Hewlett Packard, and Siemens-Nixdorf. The bottom line is that DCOM will eventually have multi-platform support, giving the DCOM architecture even more credibility as a tool for building heterogeneous distributed systems.
There also has been criticism about the lack of security of ActiveX components -- that "signed" code does not equate to "secure" code. Critics of ActiveX believe that the technology needs to incorporate a more Java applet type of security model, where the download-able Java code cannot play outside of its well-defined "sandbox." This is a valid request, since a hostile ActiveX component could instill extensive damage upon a client machine. As outlined in an article on ZDNet titled "Norton Utilities, Internet Explorer Combo Puts Systems in Harm's Way," it was discovered that there was a core component of the Norton Utilities software that could be invoked by an ActiveX component downloaded through an Internet Explorer browser. The authors describe some of the havoc that could be reaked upon unsuspecting clients.
"A Web page hacker could build a page that, when viewed by Internet Explorer, runs a few lines of VBScript code that wipes out a hard drive, installs a Trojan horse, or invokes file transfer and directory utilities to retrieve confidential information. Worse yet, all these tasks could be performed in the background without the user ever knowing what's happening to their system."1
So it makes sense to enhance the security model of ActiveX. But how much? As a technology becomes more secure, it often loses desirable functionality. Today's Java applets are a good example of this security/functionality trade off. Though Java applets provide greater code security on the client side than ActiveX components, there are limitations associated with that security that sometimes make Java applets an inadequate solution. The answer for ActiveX is probably somewhere in the middle -- an expanded version of Java's sandbox mechanism combined with the current signature attachments (which is the exact approach Java applets are taking from the opposite end).
The future of DCOM
The future of DCOM appears secure. Microsoft's substantial COM user base from which to build gives it tremendous momentum. And they certainly boast some impressive figures to back up this statement. First, Microsoft states that over 150 million systems are using some form of COM. Second, the Giga Information Group estimates that the market for third-party components based on COM was at $410 million dollars in 1997. The same group projects an amazing growth rate that reaches about $3 billion dollars by 2001 for COM products.2
Another important factor in assuring the future success of DCOM was the move from proprietary Microsoft ownership to the welcoming arms of a standards body -- The Open Group (TOG). The main charter of The Open Group is to:
- promote the availability and compatibility of ActiveX technologies across systems and architectures.
- enhance ActiveX interoperability with the Distributed Computing Environment (DCE).
- accelerate the evolution of ActiveX technologies through the collaborative development process.
The current list of OTG members includes:
- Adobe Systems Inc.
- Computer Associates International Inc.
- Digital Equipment Corp.
- Hewlett-Packard Corp.
- Lotus Development Corp.
- Microsoft Corp.
- NCR Corp.
- The Powersoft Division of Sybase Inc.
- SAP AG
- Siemens Nixdorf Informationssysteme AG
- Software AG
A TOG-managed DCOM will impact the ongoing evolution of the distributed object technology in a number of ways. For one, it is likely to slow down the evolutionary process since there are more players involved with the different goals and objectives that need to be mediated, look at CORBA and the Object Management Group (OMG). However, more players in the mix will also mean a more robust, more versatile technology that meets the needs and visions of a broader community. Reiterating this point, Bob Zurek, from the Powersoft Division of Sybase, states, "We are excited about the outcome of the first meeting for determining the direction of ActiveX into the world of open standards. We believe this will bring significant benefits to the customers and ISVs that have a strong investment in COM and DCOM technologies."3 Now that DCOM is now part of an open standard, albeit one hand-picked by Microsoft, developers will be more apt to seriously consider DCOM as an alternative to CORBA.
Finally, it is important for DCOM's growth to acknowledge that CORBA is not going to disappear any time soon -- there are too many industry leaders supporting the technology. So it will be necessary to close the gap between DCOM and CORBA, providing builders of distributed applications with greater flexibility. But it's not likely that DCOM and CORBA will merge into a unified architecture, at least for the near term, so DCOM-CORBA Bridges will have to suffice. Software companies like IONA and ObjectSpace already understand the marketability of such tools, as they race to be the first on the technology block to support an integrated DCOM/CORBA development environment.
Sample DCOM-based projects & applications
URL: http://www.microsoft.com/com/wpaper/dcomsol.zip
INFO: Introduces several real-world solutions that apply DCOM to facilitate development and deployment of distributed applications.
URL: n/a
INFO: Lotus Notes has announced support for DCOM in the 5.0 Release of the Domino/Notes server.
URL: http://www.objectdesign.com
INFO: The latest bundle of ObjectStore includes Active Toolkit - a COM interface that allows developers to ObjectStore applications using COM technology provides a COM interface.
The DCOM "TimeStamp" example
To provide a general understanding of a Java/DCOM implementation, a step-by-step illustration of how to implement a working Java/DCOM solution using Microsoft's Visual J++ technology is outlined here.
The TimeStamp example application is a basic implementation of Java/DCOM. It demonstrates a simple client-server utility where the client requests and receives the current date and time from a remote object located on a server.
The Java/DCOM development process for the TimeStamp example application is broken down in to ten manageable steps:
- Install Visual J++ from Microsoft.
- Create the TimeStamp IDL file.
- Use the IDL to generate a type library file (TimeStamp.tlb)
- Run the JavaTLB on the type library file. These .CLASS files allow COM services to be used by Java programs.
- Create the server-side implementation of the interface.
- Compile the server implementation.
- Create the client TimeStampClient.java
- Compile the client.
- Register the server.
- Start the client.
Step 1. Install Microsoft Visual J++
Microsoft Visual J++ provides the easiest way to create a Java/DCOM implementation since the bindings for DCOM are included in the application. For instance, Visual J++ provides developers with a step-saver utility that automatically generates globally-unique identifiers (GUID) which are critical elements to DCOM interfaces (described below in Step 2.)
Step 2. Create the IDL file
Listing 1 shows the ODL (Object Definition Language) File, which is a subset of the Microsoft IDL standard, that will be used as the TimeStamp application interface. As mentioned in Step 1, the lengthy id numbers that are in the code are called the GUIDs numbers. These numbers must be unique since all interfaces are referenced by their assigned GUIDs. Though there is a function in the DCOM API that specifically handles this task, Visual J++ has a utility, found under the 'Tools' drop down menu, called 'Create GUID' that does the dirty work for us. Listing 1. The DCOM TimeStamp.IDL file
Step 3. Generate the type library file
The type library file may be generated using the MIDL 3.0 compiler. The MIDL 3.O compiler is not bundled with Visual J++, but is a part of Microsoft's SDK and available for download at http://www.eu.microsoft.com/msdn/sdk/sdktools.htm. However, there is an older compiler packaged with Visual J++ called MKTYPLIB that can be used to create type libraries. To use the MKTYPLIB compiler, type in the following at the command prompt (make sure your AUTOEXEC.BAT has the correct PATH to MKTYPLIB). The /nocpp command disables the C++ pre-processor from being initiated.
X mktyplib /nocpp timestamp.idl
Step 4. Run the type library file (TimeStamp.tlb) through the JavaTLB compiler
X javatlb /U:T TimeStamp.tlb
The above command will create the necessary classes needed for the DCOM architecture based upon the type library file. Javatlb will also create a new package to store these classes - the package for this application is called 'timestamp'.
Step 5. Create the server-side implemenation of the interface
Listing 2, below, illustrates the implementation file of the TimeStamp interface. Notice that the 'main' method is missing - this is because DCOM automatically assumes the role of 'main' for the distributed object.
Listing 2. The DCOM TimeStampImpl.java file
import java.util.*;
import com.ms.com.*;
// the timestamp package is created
in Step 4 by the JavaTLB compiler
import timestamp.*;
class TimeStampImpl implements TimeStampIF
{
public String getTimeStamp() throws ComException {
Date exactTime = new Date();
String exactTimeStr = (String)(exactTime).toString();
return exactTimeStr;
}
}
Step 6. Compile the server-side implementation file
Using the Visual J++ compiler, JVC, compile TimeStampImpl.java as shown below.
X jvc -d C:\windows\java\trustlib TimeStampImpl.java
Step 7. Create the client Java file
Listing 3 provides the sample code for the TimeStampClient.java client.
Listing 3. The DCOM TimeStampClient.java File
// DCOM -- TimeStampClient.java
import timestamp.*;
public class TimeStampClient {
static public void main(String args[]){
// bind to the TimeStamp object
System.out.println("Binding to TimeStamp object");
TimeStampIF obj = (TimeStampIF) new timestamp.TimeStampImpl();
// call the getTimeStamp() method on the remote object
String whatTimeIsIt = obj.getTimeStamp();
// print out the time given by the server
System.out.println("TimeStamp = "+whatTimeIsIt);
}
}
Step 8. Compile the client
Using the Visual J++ compiler, JVC, compile TimeStampClient.java as shown below.
jvc -d C:\windows\java\trustlib TimeStampClient.java
Step 9. Register the server
Register the server by typing in the following at the command line:
X javareg /register /class:TimeStampImpl /clsid:{
F4339BE2-B109-11d1-ACAF-0080C7D43C92} /surrogate
Notice that the GUID is the same one used in the original interface (Step 2). If the server registers correctly, you will see a dialog box that looks like this:
Step 10. Server DCOM configuration
DCOM is already included as part of the Windows NT Server 4.0 and provides a DCOM configuration utility aptly named DCOMCNFG. This tool allows you to control enable or disable COM objects located on the server. Start up DCOMCNFG from the command line and click on the "DEFAULT PROPERTIES" tab and check the "ENABLE DISTRIBUTED COM" checkbox.
You will also need to delete LocalServer32 and InprocServer32 from the WindowsNT registry for new CLASSID - set at F4339BE0-B109-11d1-ACAF-0080C7D43C92 in this example). This is can be accomplished via NT's regedt32 utility.
Step 11. Client DCOM configuraton
If the client exists on a Win95 machine you will need to download DCOM95 from Microsoft's COM site.
To let clients connect to servers on a machine:
- Start DCOMCNFG on the machine
- On the "Default Properties" page, check "Enable Distributed COM on this computer"
- On the "Default Security" page, check "Enable Remote Connection"
Step 12. Start the client
Start the client using the Visual J++ interpreter (jview):
X jview TimeStampClient
Within a few seconds the client will retrieve the current date and time from the server.
References
Tom Albertson is a senior associate at PriceWaterhouseCoopers in Washington, D.C. He has extensive experience in systems design and engineering, application/GUI development, computer programming and database management.
