JBoss.orgCommunity Documentation
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 file nodes returned by this connector will have a primary type of nt:file
and a child node named jcr:content
.
The jcr:content
node will have a primary type of dna:resource
. The dna:resource
node type is equivalent
to the built-in nt:resource
node type in all ways except one: it does not extend mix:referenceable
. This is because
DNA cannot assign a persistent UUID to the files in the file system or guarantee that no other process will not move or delete the files outside of DNA.
The mix:referenceable
node type cannot be implemented if either of these conditions cannot be met.
The FileSystemSource
class provides a number of JavaBean properties that control its behavior:
Table 12.1. FileSystemSource
properties
Property | Description |
---|---|
name | The name of the repository source, which is used by the RepositoryService when obtaining a RepositoryConnection by name. |
cacheTimeToLiveInMilliseconds | Optional 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. |
defaultWorkspaceName | Optional property that is initialized to "default" and which defines the name for the workspace that will be used by default
if none is specified. |
creatingWorkspaceAllowed | Optional property that defines whether clients can create additional workspaces. The default value is "true". |
predefinedWorkspaceNames | Optional 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 "false" value for the "creatingWorkspaceAllowed" property to allow only the use of only predefined workspaces. |
retryLimit | Optional 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'. |
rootNodeUuid | Optional property that, if used, specifies the UUID that should be used for the root node of each workspace. If no value is specified, a random UUID is generated each time that the repository is started. |
workspaceRootPath |
Optional property that, if used, specifies a path on the local file system to the root of all workspaces. The source will will
use the name of the workspace as a relative path from the As an example for a workspace named |
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("workspaceRootPath", "/home/content/someApp")
.setProperty("defaultWorkspaceName", "prod")
.setProperty("predefinedWorkspaceNames", new String[] { "staging", "dev"})
.setProperty("rootNodeUuid", UUID.fromString("fd129c12-81a8-42ed-aa4b-820dba49e6f0")
.setProperty("creatingWorkspaceAllowed", "false");