[Mono-list] Mono/Java interop?
Mathias Hasselmann
mathias.hasselmann@gmx.de
Thu, 07 Nov 2002 15:41:30 +0100
Ben Hutchison wrote:
> I see 2 basic strategies for interop between .Net and Java:
>
> 1. Bytecode conversion
>
> ...
> Although you can convert the bytecode over, its in large part both
> framework's libraries that make them useful. To utilize these also
> requires a mapping of the basic platform facilities of one API set to
> the other. Eg. a Java String gets converted to a .Net string, a Class to
> a Type, etc. One can compile the pure C# or Java components across
> format using bytecode conversion, but the native libraries they rest
> upon need to be recreated.
Yes, recreation of the libraries would be the most time consuming part
of the job... IMHO.
> 2. Remote call interoperability ("Bridging")
>
> The ability to make remote calls using object types between the two
> systems. A brief search of the web shows several companies developing
> this type of tech; eg www.jnbridge.com.
>
> The first challenge here is to find a suitable common wire protocol. At
> present, there is SOAP (Web Services), but it is weak in both
> performance and sematics.
Don't think you want to use SOAP for such a bridge: As you stated it's
simply too slow. In a research project I participated we've seen latency
times for _simple_ local SOAP calls of 10ms on 1.7 GHz machine -- Maybe
ok for a more sorphistcated way of integration CGI-like stuff. Otherwise
just yet another buzzword.
> ...
> The bulk of data flowing down a remote call socket is serialized
> objects. Developing a common mapping between Java and .Net object data
> is a difficult piece of remote call level interop, a problem similar to
> Objects By Value in CORBA.
I know of some very capable CORBA hackers actively participating in OMG
at my institute. They are doing fancy stuff like streams over CORBA and
such. Quite sure that they have really efficient design patterns for
this problem. ;-)
> (c) Complex pass-by-value objects which likely as not have no
> representation in the other framework; imagine sending eg a
> javax.swing.JButton to .Net (remember it cant instatiate it directly as
> .Net doesn't understand the Java class definition). How is .Net going to
> handle this piece of data?
Bad example: Why would you like to transport something complex like a
JButton by value? Method invokation on this object per reference would
be natural and works like perfectly...
> While I don't think there's a *general* solution for (c), it can be
> imporved by building a mapping for a wide variety of common Class-Type
> pairs.
I only see the need of recreating the interfaces of the referenced
objects by using reflection mechanisms. From my understanding of the
.NET technology it should be possible to teach C# late binding if this
is possible for VB.Net already...
> Since this is a .Net focused list, I guess there is greater interest in
> making Java work with .Net than the other way round.
At least for Java on Windows it should be easy to integrate .Net
objects into Java applications: .NET objects on windows automatically
are COM objects. Java on Windows is capable to instanciate COM
objects... Something I doubt is the assumption you could have Java
objects in .Net apps without being able to create .Net objects in Java
apps....
> Therefore,
> obtaining or producing some specification of the Remoting binary
> protocol seems a critical early step. This may mean reverse-engineering
> it from the shared source CLI.
I strongly double Rotor's license allows this. The the statement about
this on http://go-mono.com/.
> Alternately, I think Daniel Morgans idea of a CORBA channel has merit;
> Java already has excellent support for CORBA, and this sidesteps the
> need to develop wire protocol code.
I don't see CORBA just as an alternative. In my opinion providing CORBA
support in Mono would be the most valuable solution:
a) CORBA support has some value per se (crossplatform,
accepted standard, ...).
b) Java already has good CORBA support, so we only would have to
build the other end of the bridge.
c) Having CORBA support in Mono would speedup Bonobo integration
of Mono and therefore would improve GNOME integration of
Mono.
The main question to work out about this: Does the OMG have defined
CORBA bindings für CIL already? Or does Microsoft have defined some? Or
is there at least a working group in the OMG working on this issue?
Ciao,
Mathias