#91 Subversion access to bibtex databases (Patch #2)

open
nobody
None
5
2014-03-26
2008-02-15
Bernd Kalbfuß
No

Hi everyone,

I had provided quick and dirty subversion functionality for Jabref in a previous patch. This is an update now on the code. The diff was generated against revision 2587. Structure and usability have improved a lot. In addition, there is rudimentary conflict management available now using a configurable merging app.
Storage of databases in subversion repositories is particularly useful for concurrent multiuser access (as e.g. required in research groups). We have used cvs/subversion for this purpose a lot by wrapping jabref into shell scripts. Shell scripts are, however, not portable. Therefore, I started to implement the functionality in Java resulting in the presented code.
I believe the project has reached a status where inclusion into the main development branch makes sense. I hope any of the developers is picking this up. Alternatively, you could grant me write access to the svn repository and I will do it myself :-)

*Current Features*
General framework for implementing access to files in repositories. Noteworthy, the term repository is to be interpreted in a very broad sense. Anything can be a repository as long as it supports the basic actions check out, update, commit and revert. Implementation is realized via interfaces Repository and RepositoryFactory.
Pure Java implementation of access to subversion repositories. The subversion merging algorithm allows for fairly robust concurrent multi-user access including powerful version management. As a side effect, access becomes available from all over the world via SSH. Rudimentary conflict resolution is supported by calling a merging application like kdiff3 or kompare (configurable).

Once subversion repositories have been configured properly (see below) a submenu “Repositories” will appear in the file menu. A menu item will be added to the “Check out” submenu that can be used to check out databases for every repository that has been configured. In addition, the following commands will become available for manipulation of databases from repositories.

Commit – Commit changes of the working copy. An update against the head revision will be performed automatically prior to the actual commit.

Update – Update working copy against head revision in the repository.

Revert – Revert to head revision in the repository. All changes in the working copy will be lost.

*Requirements*
Pure java subversion library SVNkit (http://www.svnkit.com)
Pure java ssh2 library (http://www.ganymed.ethz.ch/ssh2/)

Both jars have to be present in the trunk/jabref/lib directory.

*What's missing*
Conflict management is only rudimentary. Ideally, collaboration features of jabref would be used to handle conflicts in a smart way.
GUI extension for configuration of repositories via the jabref preferences dialog is still missing.

*Configuration*
Up to now, GUI configuration via the jabref preferences dialog has not been implemented. Configuration therefore has to be added manually to the preferences file. The fields svnTitle, svnUrl, svnFile and svnWorkingDir (optional) are used for configuration. Fields are enumerated starting with 0 in order to allow for configuration of multiple repositories. Entries that are incomplete will be ignored. The first missing or incomplete entry further stops the search for more repositories. Configuration of subversion repositories is explained in the following. Examples of configuration are given in between explanations.

svnTitle - Title to be displayed for user interaction. The title will be used e.g. to create a menu item in the "check out" submenu.

<entry key="svnTitle0" value="BPT Literaturdatenbank"/>

svnUrl - URL to the SVN repository. All modes of access are supported. See SVN documentation for details.

<entry key="svnUrl0" value="svn+ssh://tolpatsch/home/spunky/svn-rep"/>

svnFile - Name of the actual database file within the repository directory. This is the file to open after check out of a working copy. Since SVN only supports the check out of whole directories (as specified by the repository URL) this entry is mandatory.

<entry key="svnFile0" value="Literaturdatenbank.bib"/>

svnWorkingDir - Optional directory for check out of working copies. The working directory will be left untouched upon termination of jabref. If this entry is omitted a temporary directory is used instead.

<entry key="svnWorkingDir0" value="~/biolit"/>

svnConflictApp - In addition to repositories, a conflict manager application may be installed that is called if SVN is unable to merge database files. The following patterns will be replaced in the command string:

%1 - Full path of local working copy
%2 - Full path of head revision from repository
%f - Full path of merged copy \(target file\)
%w - Working directory

<entry key="svnConflictApp" value="kdiff3 %1 %2 -o %f"/>

*Details*
Lots of comments have been added to the code. Have a look at them if you want to understand the implementation in detail. Check interfaces Repository and RepositoryFactory first if you want to implement access to a new type of repository. Check the following tables for a quick overview.

New classes or interfaces:
Name / Description
net.sf.jabref.Repository
Interface for access to repositories
net.sf.jabref.RepositoryException
Repository exception thrown to indicate failure on manipulation of repositories
net.sf.jabref.RepositoryFactory
Interface to be implemented by repository factories which are used to create repository instances of any kind
net.sf.jabref.RepositoryCollection
Collection of repositories that have been configured and are provided to the user
net.sf.jabref.SvnRepository
Implementation of Subversion (SVN) repository access
net.sf.jabref.SvnRepositoryFactory
Factory implementation for creating
SVN repository instances that have been configured in jabref preferences
net.sf.jabref.imports.CheckOutDatabaseAction
The action concerned with checking out a database from a subversion repository

Changed classes:
Name / Changes
net.sf.jabref.JabRefFrame
Added submenu and related action classes for access and manipulation of files from repositories.
net.sf.jabref.BasePanel
Made BasePanel aware of repositories
net.sf.jabref.imports.OpenDataBaseAction
Access restriction of frame variable relaxed to protected

Discussion

  • Bernd Kalbfuß
    Bernd Kalbfuß
    2008-02-15

    diff and new classes

     
    Attachments
  • hm_u
    hm_u
    2008-09-30

    Great work !

    Are the pdf files uploaded to the repository too ?

    Cheers,
    Manu

     
  • Wow, very much what I/we've been looking for. I really hope this will make it into the standard version of JabRef.
    Thanks.

    Cheers
    Nils

    P.S. Storing also the pdf in the repository would be nice too.