JBoss.orgCommunity Documentation
The JBoss Cache repository connector allows a JBoss Cache instance to be used as a JBoss DNA (and thus JCR) repository. This provides a repository that is an effective, scalable, and distributed cache, and is often paired with other repository sources to provide a local or federated repository.
The JBossCacheSource
class provides a number of JavaBean properties that control its behavior:
Table 15.1. JBossCacheSource
properties
Property | Description |
---|---|
name | The name of the repository source, which is used by the RepositoryService when obtaining a RepositoryConnection by name. |
cacheFactoryJndiName | Optional property that, if used, specifies the name in JNDI where an existing JBoss Cache Factory instance can be found.
That factory would then be used if needed to create a JBoss Cache instance. If no value is provided, then the
JBoss Cache DefaultCacheFactory class is used. |
cacheConfigurationName | Optional property that, if used, specifies the name of the configuration that is supplied to the cache factory when creating a new JBoss Cache instance. |
cacheJndiName | Optional property that, if used, specifies the name in JNDI where an existing JBoss Cache instance can be found. This should be used if your application already has a cache that is used, or if you need to configure the cache in a special way. |
creatingWorkspacesAllowed | Optional property that is by default 'true' that defines whether clients can create new workspaces. |
defaultCachePolicy | Optional property that, if used, defines the default for how long this information provided by this source may to be cached by other, higher-level components. The default value of null implies that this source does not define a specific duration for caching information provided by this repository source. |
defaultWorkspaceName | Optional property that is initialized to an empty string and which defines the name for the workspace that will be used by default if none is specified. |
predefinedWorkspaceNames | Optional property that defines the names of the workspaces that exist and that are available for use without having to create them. |
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. |
uuidPropertyName | Optional property that, if used, defines the property that should be used to find the UUID value for each node
in the cache. "dna:uuid " is the default. |
The JBoss Cache connector is used by creating in the JcrConfiguration
a repository source that uses the JBossCacheSource
class.
For example:
JcrConfiguration config = ...
config.repositorySource("source A")
.usingClass(JBossCacheSource.class)
.setDescription("The repository for our content")
.setProperty("defaultWorkspaceName", "prod")
.setProperty("rootNodeUuid", UUID.fromString("12083e7e-2b55-4c8d-954d-627a9f5c45c2"))
.setProperty("predefinedWorkspaceNames", new String[] { "staging", "dev"});