public class RepositoryCache extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
RepositoryCache.ChangesToWorkspacesListener |
static interface |
RepositoryCache.ContentInitializer |
protected class |
RepositoryCache.RepositoryFeaturesDetector |
Modifier and Type | Field and Description |
---|---|
protected ChangeBus |
changeBus |
protected Logger |
logger |
static String |
REPOSITORY_INFO_KEY |
protected NodeKey |
systemMetadataKey |
protected String |
systemWorkspaceName |
protected Upgrades |
upgrades |
protected Set<String> |
workspaceNames |
Constructor and Description |
---|
RepositoryCache(ExecutionContext context,
DocumentStore documentStore,
LockingService lockingService,
RepositoryConfiguration configuration,
RepositoryCache.ContentInitializer initializer,
RepositoryEnvironment repositoryEnvironment,
ChangeBus changeBus,
Upgrades upgradeFunctions) |
Modifier and Type | Method and Description |
---|---|
protected ConcurrentMap<NodeKey,CachedNode> |
cacheForWorkspace() |
ChangeBus |
changeBus() |
RepositoryCache |
completeInitialization() |
void |
completeShutdown() |
RepositoryCache |
completeUpgrade(Upgrades.Context resources) |
protected ExecutionContext |
context() |
WorkspaceCache |
createExternalWorkspace(String name,
Connectors connectors)
Creates a new workspace in the repository coupled with external document
store.
|
SessionCache |
createSession(ExecutionContext context,
String workspaceName,
boolean readOnly)
Create a session for the workspace with the given name, using the supplied ExecutionContext for the session.
|
WorkspaceCache |
createWorkspace(String name)
Create a new workspace in this repository, if the repository is appropriately configured.
|
boolean |
destroyWorkspace(String name,
WritableSessionCache removeSession)
Permanently destroys the workspace with the supplied name, if the repository is appropriately configured, also unlinking
the jcr:system node from the root node .
|
protected DocumentStore |
documentStore() |
DocumentTranslator |
getDocumentTranslator() |
String |
getKey()
Get the key for this repository.
|
String |
getName()
Get the name for this repository.
|
NodeKey |
getRepositoryMetadataDocumentKey()
Get the identifier of the repository's metadata document.
|
NodeKey |
getSystemKey() |
String |
getSystemWorkspaceKey() |
String |
getSystemWorkspaceName() |
WorkspaceCache |
getWorkspaceCache(String workspaceName)
Get the NodeCache for the workspace with the given name.
|
Set<String> |
getWorkspaceNames()
Get the names of all available workspaces in this repository.
|
boolean |
isAccessControlEnabled() |
boolean |
isInitializingRepository() |
long |
largeValueSizeInBytes() |
protected LocalDocumentStore |
localStore() |
boolean |
lockingUsed() |
protected Name |
name(String name) |
LocalDocumentStore.DocumentOperationResults |
optimizeChildren(int targetCountPerBlock,
int tolerance)
Optimize the children in the supplied node document
Note that this method changes the underlying db as well as the given document, so *it must* be called either from a
transactional context or it must be followed by a session.save call, otherwise there might be inconsistencies between what
a session sees as "persisted" state and the reality.
|
protected String |
processKey() |
protected void |
refreshRepositoryMetadata(boolean update) |
protected RepositoryEnvironment |
repositoryEnvironment() |
void |
rollbackRepositoryInfo()
Removes the repository info document, in case the repository has not yet been initialized (as indicated by the presence of
the #REPOSITORY_INITIALIZED_AT_FIELD_NAME field).
|
void |
runOneTimeSystemInitializationOperation(Callable<Void> initOperation)
Executes the given operation only once, when the repository is created for the first time, using child node under
jcr:system as a global "lock".
|
void |
setAccessControlEnabled(boolean enabled) |
void |
setLargeStringLength(long sizeInBytes) |
void |
startShutdown() |
String |
toString() |
boolean |
versioningUsed() |
protected boolean |
waitUntil(Callable<Boolean> condition,
long time,
TimeUnit unit,
I18n failureMsg) |
public static final String REPOSITORY_INFO_KEY
protected final ChangeBus changeBus
protected final NodeKey systemMetadataKey
protected final String systemWorkspaceName
protected final Logger logger
protected final Upgrades upgrades
public RepositoryCache(ExecutionContext context, DocumentStore documentStore, LockingService lockingService, RepositoryConfiguration configuration, RepositoryCache.ContentInitializer initializer, RepositoryEnvironment repositoryEnvironment, ChangeBus changeBus, Upgrades upgradeFunctions)
protected boolean waitUntil(Callable<Boolean> condition, long time, TimeUnit unit, I18n failureMsg)
public final void rollbackRepositoryInfo()
public final boolean versioningUsed()
public final boolean lockingUsed()
public final ChangeBus changeBus()
protected final RepositoryEnvironment repositoryEnvironment()
protected final String processKey()
public final boolean isInitializingRepository()
public final boolean isAccessControlEnabled()
protected LocalDocumentStore localStore()
public final void setAccessControlEnabled(boolean enabled)
protected final DocumentStore documentStore()
protected final ExecutionContext context()
public RepositoryCache completeInitialization()
public RepositoryCache completeUpgrade(Upgrades.Context resources)
public void startShutdown()
public void completeShutdown()
public NodeKey getRepositoryMetadataDocumentKey()
public void setLargeStringLength(long sizeInBytes)
public long largeValueSizeInBytes()
protected void refreshRepositoryMetadata(boolean update)
public void runOneTimeSystemInitializationOperation(Callable<Void> initOperation) throws Exception
public final String getKey()
public final NodeKey getSystemKey()
public final String getSystemWorkspaceKey()
public final String getSystemWorkspaceName()
public final String getName()
public final Set<String> getWorkspaceNames()
protected ConcurrentMap<NodeKey,CachedNode> cacheForWorkspace()
public final DocumentTranslator getDocumentTranslator()
public WorkspaceCache createWorkspace(String name)
name
- the workspace nameUnsupportedOperationException
- if this repository was not configured to allow
creation of workspaces
.public boolean destroyWorkspace(String name, WritableSessionCache removeSession)
name
- the workspace nameremoveSession
- an outside session which will be used to unlink the jcr:system node and which is needed to guarantee
atomicity.UnsupportedOperationException
- if this repository was not configured to allow
creation (and destruction) of workspaces
.public WorkspaceCache getWorkspaceCache(String workspaceName)
The session maintains a transient set of changes to the workspace content, and these changes are always visible. But additionally any changes to the workspace content saved by other sessions will immediately be visible to this session. Notice that at times the changes persisted by other sessions may cause some of this session's transient state to become invalid. (For example, this session's newly-created child of some node, A, may become invalid or inaccessible if some other session saved a deletion of node A.)
workspaceName
- the name of the workspace; may not be nullWorkspaceNotFoundException
- if no such workspace existspublic WorkspaceCache createExternalWorkspace(String name, Connectors connectors)
name
- the name of the repositoryconnectors
- connectors to the external systems.public SessionCache createSession(ExecutionContext context, String workspaceName, boolean readOnly)
context
- the context for the new session; may not be nullworkspaceName
- the name of the workspace; may not be nullreadOnly
- true if the session is to be read-onlyWorkspaceNotFoundException
- if no such workspace existspublic LocalDocumentStore.DocumentOperationResults optimizeChildren(int targetCountPerBlock, int tolerance)
Note that this method changes the underlying db as well as the given document, so *it must* be called either from a transactional context or it must be followed by a session.save call, otherwise there might be inconsistencies between what a session sees as "persisted" state and the reality.
targetCountPerBlock
- the target number of children per blocktolerance
- the allowed tolerance between the target and actual number of children per blockCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.