You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jesper Steen Møller <je...@selskabet.org> on 2002/12/16 21:33:45 UTC

Java binding - SWIG or not?

My (perhaps) ambitious goal is to write a Subversion client to build 
into Eclipse.

I'll be needing the functionality of the svn_client.h stuff and it's 
direct dependents, and I'd much rather use some JNI constructs than 
having to rely on the SVN command line client, so I can stay away from 
all the command line handling nonsense.

Since the stuff in subversion/bindings/java is incomplete *and* 
outmoded, and I saw some fairly recent postings about the SWIG wrappers, 
without any conclusion about the completeness, my question is really:

How should I contribute?
 A. Work on completing/improving/testing the SWIG/Java bindings
 B. Adjust/complete the original JNI effort

I'm finding the current state of the SWIG/Java binding somewhat, er, 
un-Javaish, if I may, but I might just have understood little of it, 
being new to SWIG.

-Jesper



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not? Not!

Posted by Hans Marggraff <hm...@qint.de>.
Greg Stein wrote:
> On Wed, Dec 18, 2002 at 09:46:04AM +0100, Hans Marggraff wrote:
> 
>>I have looked at the java bindings too and tried to get them working.
>>I posted the original question, and since have played with swig.
>>
>>The design of svn makes use of swig very hard. Svn exposes a mass of interfaces
>>that reach right through to its underlying libraries (neon etc)
>>Swig will try to generate wrappers for these too which leads to an unmanageable
>>mass of interfaces, most of which are superfluous.
> 
> 
> What did you do? Run SWIG yourself right over our .h files? Eesh... No
> wonder it isn't coming out very well.
> 
> Take a look at subversion/bindings/swig/. The top-level Makefile even has
> some stuff already for generating the Java bindings.

I tried that, baut at the time (8 months ago) Swig core dumped when I tried to
generate java output using the subversion swig bindings. At that point I gave up.
Pleased to hear, that the situation has improved.

> 
> 
>>This can be turned off by defining mappings for swig, however these mappings did not
>>appear much simpler than to to a concise JNI wrapper.
>>
>>To be able to generate or to maintain the java interface *automatically* via swig
>>is an illusion in my opinion.
> 
> 
> We've been doing exactly this for the Python wrappers, and I believe it is
> also working (to a point) for the Java stuff that Daniel Rall has been
> working on.
> 
> Cheers,
> -g
> 

If the swig/java and the swig/python stuff can share a significant part of the wrappers,
then swig will make a lot more sense for java too.

Regards
Hans

-- 
Hans Marggraff
Qint Software
Allingerstr. 18a
82178 Pucheim
Germany
Tel 089 80067094
mailto:hmf@qint.de
http://www.qint.de


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not? Not!

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Dec 18, 2002 at 09:46:04AM +0100, Hans Marggraff wrote:
> I have looked at the java bindings too and tried to get them working.
> I posted the original question, and since have played with swig.
> 
> The design of svn makes use of swig very hard. Svn exposes a mass of interfaces
> that reach right through to its underlying libraries (neon etc)
> Swig will try to generate wrappers for these too which leads to an unmanageable
> mass of interfaces, most of which are superfluous.

What did you do? Run SWIG yourself right over our .h files? Eesh... No
wonder it isn't coming out very well.

Take a look at subversion/bindings/swig/. The top-level Makefile even has
some stuff already for generating the Java bindings.

> This can be turned off by defining mappings for swig, however these mappings did not
> appear much simpler than to to a concise JNI wrapper.
> 
> To be able to generate or to maintain the java interface *automatically* via swig
> is an illusion in my opinion.

We've been doing exactly this for the Python wrappers, and I believe it is
also working (to a point) for the Java stuff that Daniel Rall has been
working on.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not? Not!

Posted by Hans Marggraff <hm...@qint.de>.
I have looked at the java bindings too and tried to get them working.
I posted the original question, and since have played with swig.

The design of svn makes use of swig very hard. Svn exposes a mass of interfaces
that reach right through to its underlying libraries (neon etc)
Swig will try to generate wrappers for these too which leads to an unmanageable
mass of interfaces, most of which are superfluous.

This can be turned off by defining mappings for swig, however these mappings did not
appear much simpler than to to a concise JNI wrapper.

To be able to generate or to maintain the java interface *automatically* via swig
is an illusion in my opinion.

Regards
	Hans Marggraff

Greg Stein wrote:
> On Mon, Dec 16, 2002 at 11:02:04PM +0100, Oliver Geisser wrote:
> 
>>Hi
>>
>>Jesper Steen Møller wrote:
>>
>>>My (perhaps) ambitious goal is to write a Subversion client to build 
>>>into Eclipse.
> 
> 
> Very cool.
> 
> 
>>...
>>
>>>How should I contribute?
>>>A. Work on completing/improving/testing the SWIG/Java bindings
>>>B. Adjust/complete the original JNI effort
> 
> 
> I would recommend (A). Over the long-haul, having the bindings automatically
> update w.r.t the libraries' APIs will be much better. Having to hand-code
> each wrapper and maintain that will be a pain and will fall out of sync very
> easily.
> 
> 
>>...
>>Copy the way SWT interacts with native toolkits.
>>The SWT JNI bindings are the smallest possible wrappers around
>>the native C functions. Everything else is done on the
>>Java side.
> 
> 
> I'm not entirely sure exactly what SWT does, but that is the recommend
> procedure: wrap the functions exactly as they are -- get them up into the
> other language. In *that* language, create your language-specific and
> language-stylistic abstractions.
> 
> Python and Java and Perl will have *very* different notions of the "right"
> way to expose the SVN functionality. So let the wrappers give you the
> basics, and then do it Right in the other language.
> 
> Cheers,
> -g
> 

-- 
Hans Marggraff
Qint Software
Allingerstr. 18a
82178 Pucheim
Germany
Tel 089 80067094
mailto:hmf@qint.de
http://www.qint.de


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not?

Posted by Greg Stein <gs...@lyra.org>.
On Mon, Dec 16, 2002 at 11:02:04PM +0100, Oliver Geisser wrote:
> Hi
> 
> Jesper Steen Møller wrote:
> > My (perhaps) ambitious goal is to write a Subversion client to build 
> > into Eclipse.

Very cool.

>...
> > How should I contribute?
> > A. Work on completing/improving/testing the SWIG/Java bindings
> > B. Adjust/complete the original JNI effort

I would recommend (A). Over the long-haul, having the bindings automatically
update w.r.t the libraries' APIs will be much better. Having to hand-code
each wrapper and maintain that will be a pain and will fall out of sync very
easily.

>...
> Copy the way SWT interacts with native toolkits.
> The SWT JNI bindings are the smallest possible wrappers around
> the native C functions. Everything else is done on the
> Java side.

I'm not entirely sure exactly what SWT does, but that is the recommend
procedure: wrap the functions exactly as they are -- get them up into the
other language. In *that* language, create your language-specific and
language-stylistic abstractions.

Python and Java and Perl will have *very* different notions of the "right"
way to expose the SVN functionality. So let the wrappers give you the
basics, and then do it Right in the other language.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not?

Posted by Oliver Geisser <ol...@gmx.de>.
Hi

Jesper Steen Møller wrote:
> My (perhaps) ambitious goal is to write a Subversion client to build 
> into Eclipse.
        ^^^^^^^
[...]
I would like to see a SVN integration into Eclipse, too.
Maybe, if I find the time, I can support you sometime in the future ...

> How should I contribute?
> A. Work on completing/improving/testing the SWIG/Java bindings
> B. Adjust/complete the original JNI effort
[...]

What do you think about the following idea?

Copy the way SWT interacts with native toolkits.
The SWT JNI bindings are the smallest possible wrappers around
the native C functions. Everything else is done on the
Java side.

For details see this very interesting article:
http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html

Why don't you use this idea for the SVN JNI binding, too?

Olli

--
og




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Java binding - SWIG or not?

Posted by Alexander Mueller <Al...@littleblue.de>.
Jesper Steen Møller wrote:
> My (perhaps) ambitious goal is to write a Subversion client to build 
> into Eclipse.
> 
> I'll be needing the functionality of the svn_client.h stuff and it's 
> direct dependents, and I'd much rather use some JNI constructs than 
> having to rely on the SVN command line client, so I can stay away from 
> all the command line handling nonsense.
> 
> Since the stuff in subversion/bindings/java is incomplete *and* 
> outmoded, and I saw some fairly recent postings about the SWIG wrappers, 
> without any conclusion about the completeness, my question is really:
> 
> How should I contribute?
> A. Work on completing/improving/testing the SWIG/Java bindings
> B. Adjust/complete the original JNI effort
> 
> I'm finding the current state of the SWIG/Java binding somewhat, er, 
> un-Javaish, if I may, but I might just have understood little of it, 
> being new to SWIG.
> 
> -Jesper
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
> 
> 
> 
In my opinion it is better to go the SWIG way. During the
implementation of the current JNI bindings I learned the hard way that
you have to repeat yourself during coding much too often. I think it
would be good to use the SWIG/Java wrapper as a first step in the Java
world. You could build a nicer class set (namings, structure) around this.

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org