[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: java bindings

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-03-26 21:24:31 CET

On Mon, Mar 25, 2002 at 10:16:18AM +0100, Alexander Mueller wrote:
> Ben Collins wrote:
> >On Fri, Mar 22, 2002 at 11:09:27AM -0500, Kevin Galligan wrote:
> >>Does anybody know how current the java bindings are? I got svn compiled on
> >>my Win2k box last night and I'd like to work on some client code. Any info
> >>would help.
>
> Its quite a long time since I worked on the java bindings (due to work
> overload in may daytime job).
> A lot of helper functions are working. The only command that is
> partially implemented, is "status"
> (org.tigris.subversion.lib.ClientImpl.status).

I would suspect that that code was probably broken by some of the recent
'svn_wc_entry' work that occurred last week.

>...
> >If Swig works for Win2k, you can hack up the swig bindings to support
> >java.

SWIG should work fine on Win2k. Much of the Python Win32 (COM) bindings are
developed using SWIG.

> There is a lot of stuff that cant be done with swig and java. Its ok to
> get wrappers for classes. But the advanced topics like callbacks (which
> are a main part
> of the subversion library) wont work using swig (at least my opinion).

It should work quite fine. Every one of our callbacks takes a "user"
parameter. Thus, it should be easy for us to create a little structure such
as:

struct {
    svn_error_t * user_func(...);
    void *user_data;
}

The JNI interface calls a specific C function with a pointer to the above
structure. That function then calls to the user function.

> And if you want to have java naming conventions for classes and methods
> you have to write wrapper classes with nice names that call the
> automatically generated code.

Definitely. SWIG will generate very plain interfaces to the underlying
libraries. I would suggest that it is "expected" that higher-level objects
are then built upon the SWIG bindings. Essentially, the design is that SWIG
gives you access, and then you can write pure Java code to expose a "clean"
interface.

For example, bindings/swig/python/svn/ is a Python package which papers over
the Python SWIG bindings with some helper functions. A lot more work can
occur in there, but it does show how I would expect it to work.

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
Received on Tue Mar 26 21:21:18 2002

This is an archived mail posted to the Subversion Dev mailing list.