Master of disguises: Making JavaBeans look like ActiveX controls

Learn how to make your JavaBeans available to Windows programmers using tools from Sun and Microsoft

1 2 3 Page 3
Page 3 of 3

Other issues

In addition to the issues I've already noted, you need to be aware of a number of other hurdles facing you when you set out to bridge JavaBeans. One of the first roadblocks you'll notice is that COM currently doesn't support method overloading. Both javareg and Packager will choose one of the overloads for the type library. Also missing from COM are class constants. If your JavaBeans expose constants you'll need to either document the values and/or ship constants files (as h or bas files) for use by ActiveX developers.

Debugging JavaBean/ActiveX controls can be challenging. While Sun's bridge sends Java console output to the same location as application output, Microsoft's doesn't. For the most part, controls function the same within an ActiveX application as they do within a Java environment. However, you should be sure to test the controls using the same virtual machine as will be used by the bridge. If you test with Sun's VM but bridge with Microsoft's javareg, you may be in for an unhappy surprise.

Component versioning is another area where there seems to be more questions than answers. This isn't a new issue, but bridging does complicate things a bit. The techniques used to version COM controls differ from those used to version JavaBeans, and the bridging tools do little to help. If your controls are only used in-house, you may be able to manage your software to avoid this problem. However, if you plan to distribute your controls publicly, you will need to put some thought into how you will handle versioning.

Conclusion

There you have it: a great idea, some promising tools, but a lot to be desired. Can you use this technology in real life? The answer to that question will depend on your controls, your comfort with COM, and your ability and desire to work around the tools' shortcomings. What is important, however, is that bridging, while still in its infancy, has significant potential to allow you to maximize the usability of your controls without having to duplicate programming effort or shun certain customer segments in favor of others.

Patrick Carey is a software engineer at XYPOINT Corporation (http://www.xypoint.com/), a location services company in Seattle, WA. Patrick's current projects include a Java application that allows 911 dispatchers to see the location of a wireless phone on a map, and a library of JavaBeans/ActiveX controls that allow other companies to use XYPOINT's services in their own applications.

Learn more about this topic

1 2 3 Page 3
Page 3 of 3