JBoss.orgCommunity Documentation

Chapter 12. File System Connector

This connector exposes an area of the local file system as a read-only graph of "nt:file" and "nt:folder" nodes. The connector considers a workspace name to be the path to the directory on the file system that represents the root of that workspace. Each connector can define whether it allows new workspaces can be created, but if so the names of the new workspaces must represent valid paths to existing directories.

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

Table 12.1. FileSystemSource properties

PropertyDescription
nameThe name of the repository source, which is used by the RepositoryService when obtaining a RepositoryConnection by name.
directoryForDefaultWorkspaceOptional property that, if used, specifies the file system path to the existing directory that should be used for the default workspace. If null (or not specified), the source will use the current working directory of this virtual machine (as defined by new File(".").getAbsolutePath().
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 file system connector is used by creating in the JcrConfiguration a repository source that uses the InMemoryRepositorySource class. For example:



JcrConfiguration config = ...
config.repositorySource("source A")
      .usingClass(FileSystemSource.class)
      .setDescription("The repository for our content")
      .setProperty("directoryForDefaultWorkspace", "file://some/file/path")
      .setProperty("creatingWorkspaceAllowed", "false");