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

Re: Java Question

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-08-02 00:50:43 CEST

On Tue, 01 Aug 2006, Dan Pozmanter wrote:

> Hmmm, that sounds nice. I suppose I am biased towards dev time itself.
> I will be able to go straight in without auth.

Okay. Subversion has two layers which you might be interested in --
libsvn_repos, and libsvn_fs. It sounds like libsvn_fs would be more
useful to you. Should also/instead expose a repos layer, or is
SVNClient sufficient API here?

> Perhaps:
> (pools would be automatic)

Yup. Pools are currently managed in the C++ JNI code using
thread-local storage. This should work fine for a repository or FS
class.

The pseudo-code you listed below is quite helpful. More comments
in-line...

> svnConnection conn = new svnConnection(reposPath);

Is this a connection to the repos (the thing that Subversion's RA
layer talks to, like svnserve or mod_dav_svn), or directly to the FS?

While I rather like how you've made this object look JDBC
Connection-like, how about calling it what it is instead
(e.g. SVNFileSystem or SVNRepository)?

> conn.begin();

If we stayed with the Connection metaphor (or are talking directly to
the FS), I'd suggest beginTrans().

> svnPath sp = new svnPath(conn, path);

A slightly different usage pattern involving retrofitting the existing
org.tigris.subversion.javahl.Path class or using a basic data type
like java.lang.String. See below.
 
> sp.getLogs();

I wouldn't think that we need an explicit transaction to retrieve
logs. This functionality is already available through SVNClient, but
involved auth.

> sp.move(newpath);
> sp.add(object);

Allowing a series of editor-esque operation here inside the
transaction sounds good. What do the other bindings allow?

conn.move(srcPath, destPath);
conn.addFile(targetInputStream, targetPath);

> svnFile f = sp.getFile(subpath);
> f.read(); //Whole String
> f.write(data); //Whole String

I'm not sure that I follow these.

> conn.commit(msg);

commitTrans(), I take it?

> conn.rollback();

This would typically be found in a catch block?

> -----Original Message-----
> From: Daniel Rall [mailto:dlr@collab.net]
> Sent: Tuesday, August 01, 2006 5:30 PM
> To: Dan Pozmanter
> Cc: dev@subversion.tigris.org
> Subject: Re: Java Question
>
> On Tue, 01 Aug 2006, Dan Pozmanter wrote:
>
> > Swig/Java API
> >
> > I think we should precisely mirror the c api.
> > This will be faster to write, and the same docs/experience exists.
>
> Experience with the bindings -- especially the Python bindings -- has
> shown us that typical users want language bindings with the look and
> feel of APIs they're familiar with in that language.
>
> Which is to say, Java APIs should look like Java APIs, not C APIs.
>
>
> > Here are a few example python lines:
> >
> > fs.node_history(connection._v_root, self.svnpath, pool)
> >
> > stream = fs.file_contents(repository_root, target_path, pool) data =
> > util.svn_stream_read(stream, CHUNK_SIZE)
> >
> > if kind_of_node == core.svn_node_none:
> > return ()
> > elif kind_of_node != core.svn_node_dir:
> > return (target_path, self.GetFileData(repository_root,
> target_path,
> > pool))
> >
> > svn_pool_destroy(pool)
> >
> > revision = fs.youngest_rev(fs, pool)
>
> This example is quite helpful, but deals with the libsvn_fs API. I
> assumed that you were trying to get the data via the RA layer. Is this
> not the case? Can you go straight to the repository's file system with
> no need for auth?
>
> Please elaborate on the specifics of what you're trying to do.

  • application/pgp-signature attachment: stored
Received on Wed Aug 2 00:51:58 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.