JBoss.orgCommunity Documentation

Chapter 15. Subversion Connector

This connector provides read-only access to the directories and folders within a Subversion repository, providing that content in the form of nt:file and nt:folder nodes. This source considers a workspace name to be the path to the directory on the repository's root directory location that represents the root of that workspace (e.g., "trunk" or "branches"). New workspaces can be created, as long as the names represent valid existing directories within the SVN repository.

The SVNRepositorySource class provides a number of JavaBean properties that control its behavior:

Table 15.1. SVNRepositorySource properties

nameThe name of the repository source, which is used by the RepositoryService when obtaining a RepositoryConnection by name.
repositoryRootURL Required property that should be set with the URL to the Subversion repository.
username The username that should be used to establish a connection to the repository.
password The password that should be used to establish a connection to the repository. This is not required if the URL represents an anonymous SVN repository address.
directoryForDefaultWorkspaceOptional property that, if used, specifies the relative path of the directory in the repository that should be exposed as the default workspace.
predefinedWorkspaceNamesOptional property that, if used, defines names of the workspaces that are predefined and need not be created before being used. This can be coupled with a "fase" value for the "creatingWorkspaceAllowed" property to allow only the use of only predefined workspaces.
creatingWorkspaceAllowedOptional property that defines whether clients can create additional workspaces. The default value is "true".
retryLimitOptional property that, if used, defines the number of times that any single operation on a RepositoryConnection to this source should be retried following a communication failure. The default value is '0'.
cacheTimeToLiveInMillisecondsOptional property that, if used, defines the maximum time in milliseconds that any information returned by this connector is allowed to be cached before being considered invalid. When not used, this source will not define a specific duration for caching information.

Using the SVN connector can be used by creating in the JcrConfiguration a repository source that uses the SVNRepositorySource class. For example:

JcrConfiguration config = ...
config.repositorySource("SVN repository for JBoss DNA")
      .setDescription("The DNA SVN repository (anonymous access)")
      .setProperty("repositoryRootUrl", "http://anonsvn.jboss.org/repos/dna");
      .setProperty("directoryForDefaultWorkspace", "trunk");
      .setProperty("predefinedWorkspaceNames", new  String[]{"trunk","tags/0.1","/tags/0.2", "/tags/0.3", "/tags/0.4", "/tags/0.5");