Hello!

In short, I'd like to allow HTTP-based read/write access to a
versioned hierarchical file system. I have a Java client application
that needs to retrieve, modify, create and delete files on a server.
HTTP / REST seems like a good way to do this.

I've yet to find something (simple) that does this (do you know of an
existing solution?) and so have begun thinking about what it would
take to implement this, in a rudimentary fashion, myself. I'm
interested in any suggestions, comments, references, etc. from any of
you. In particular, I wonder how I might use the Restlet framework to
easily implement something along these lines.

Assume we have a Subversion repository and want to allow basic read
and write operations in a RESTful manner. There's a server handling
HTTP requests. It responds to GET by returning the HEAD version of the
specified file or directory. For example, let's say a sole Subversion
repository is exposed at:
http://www.example.com/svn/
Then the HEAD version of a certain file in the trunk is found at:
http://www.example.com/svn/trunk/web/about/people.html
And a GET to that URI would return the latest version of said file.

Similary, to access an older version, syntax similar to the following
would be used:
http://www.example.com/svn/trunk/web/about/people.html?v=32

The PUT method would be implemented as commiting a new version to the
Subversion repository, i.e. committing a changelist consisting of just
one file.
DELETE would delete + commit a resource.
POST would add + commit a new resource. It should fail if this
resource already exists.

GET on a directory resource would return a directory listing (for the
specified version) in some useful format - maybe allow XML as Apache
does.

Authentication and Authorization should be layered on top of this,
allowing authorization directives to be specified separately for each
of the four methods.

I realize that this gets into WebDAV territory, but am hoping for
something simpler, a subset of operations based solely on GET, PUT,
DELETE and POST.

My first instinct was to subclass Directory, or Directory Resource, or
such and implement the get/put/delete/post methods as manipulations on
the SVN repo using the SVNKit library. Having looked at those
restlet.org and NOE classes, though, I feel I need more guidance ...

Might not be too hard to do basic SVN manipulations using SVNKit:
http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html#getFile(java.lang.String,%20long,%20java.util.Map,%20java.io.OutputStream)
http://svnkit.com/kb/dev-guide-commit-operation.html
(Note: I believe svnkit has a viral OS license)

There are numerous Java-based web applications that constitute an
interface onto a Subversion repository (http://www.sventon.org/,
http://www.polarion.org/index.php?page=overview&project=svnwebclient,
http://labs.jboss.com/shotoku/), but generally they provide read-only
access for humans using a browser.

Thank you for reading through all these notes, I look forward to
criticism and support, any feedback at all!

Ben.

Reply via email to