The Mozilla
Organization
Our Mission
Who We Are
Getting Involved
Community
Editorials
What's New
Newsbot
Development
Roadmap
Module Owners
Blue Sky
Projects
Status
Tools
Products
Source Code
Binaries
Documentation
License Terms
Bug Reports
Quality
Search
Feedback

Java-to-XPCOM Bridge

The Java-to-XPCOM Bridge allows interoperability between Java and XPCOM components. Java code may obtain proxies to XPCOM objects written in other languages such as C++, invoke methods on those objects as if they were written in Java, and register Java objects for callbacks from XPCOM components. When this bridge it is in place, it will be possible to write applets that access the DOM, or (when the infrastructure is in place) XPCOM components written in Java instead of C++.

Current Design

The Blackwood team is working on an implementation based on the XPCOM reflection and typelib infrastructure behind XPConnect. The current plan is to implement dynamically-generated Java proxies to C++ objects, and vice-versa. That is, the system will generate the byte-codes for each Java-side proxy on demand; each method implementation will marshall arguments to a generic invocation method based on XPTC_Invoke(), and back again. Java objects which implement an XPCOM interface may be passed to C++ based XPCOM components, using a proxy derived from nsXPTCStubBase.

Other notable features of the current design:

  1. The binding will mirror nsIComponentManager and nsIServiceManager into the Java environment.
  2. Java code interacts with XPCOM objects through a binding from XPIDL to Java based loosely on CORBA and MS-COM bindings. One of Java's key features is its type safety, and the binding uses it as much as possible.
  3. Because Java has automatic memory management, Java proxies will take care of all reference counting; Java programmers need never call AddRef() or Release(), and the binding will not expose those methods.

Status

Right now, the project is just getting started. What implementation we have is useful only for standalone test programs demonstrating argument marshalling. We have yet to explore a number of issues relating to security and concurrency. We also have yet to explore mapping Java interfaces back to IIDs, and nsXPTCStubBase.CallMethod() invocations to Java calls. Anyone interested in helping out should contact Frank Mitchell or George Drapeau.


Frank Mitchell
Last modified: Tue Jul 20 14:26:04 PDT 1999

Copyright © 1998-1999 The Mozilla Organization.