JBoss.orgCommunity Documentation

Chapter 11. In-Memory Connector

The in-memory repository connector is a simple connector that creates a transient, in-memory repository. This repository is used as a very simple in-memory cache or as a standalone transient repository. This connector works well for a readable and writable repository source with small to moderate sized content that need not be permanently saved.

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

Table 11.1. InMemoryRepositorySource properties

nameThe name of the repository source, which is used by the RepositoryService when obtaining a RepositoryConnection by name.
jndiNameOptional property that, if used, specifies the name in JNDI where an InMemoryRepository instance can be found. This is an advanced property that is infrequently used.
rootNodeUuidOptional property that, if used, defines the UUID of the root node in the in-memory repository. If not used, then a new UUID is generated.
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'.
defaultCachePolicyOptional 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.
defaultWorkspaceNameOptional 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.

Using the in-memory connector is used by creating in the JcrConfiguration a repository source that uses the InMemoryRepositorySource class. For example:

JcrConfiguration config = ...
config.repositorySource("source A")
      .setDescription("The repository for our content")
      .setProperty("defaultWorkspaceName", workspaceName);