|
ModeShape Distribution 3.5.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.cache.RepositoryCache
public class RepositoryCache
Nested Class Summary | |
---|---|
static interface |
RepositoryCache.ContentInitializer
|
protected class |
RepositoryCache.LocalChangeListener
|
Field Summary | |
---|---|
protected Logger |
logger
|
static RepositoryCache.ContentInitializer |
NO_OP_INITIALIZER
|
protected NodeKey |
systemMetadataKey
|
protected Set<String> |
workspaceNames
|
Constructor Summary | |
---|---|
RepositoryCache(ExecutionContext context,
DocumentStore documentStore,
RepositoryConfiguration configuration,
RepositoryCache.ContentInitializer initializer,
SessionEnvironment sessionContext,
ChangeBus changeBus,
org.infinispan.manager.CacheContainer workspaceCacheContainer)
|
Method Summary | |
---|---|
protected org.infinispan.Cache<NodeKey,CachedNode> |
cacheForWorkspace(String name)
|
protected String |
cacheNameForWorkspace(String workspaceName)
|
void |
completeInitialization()
|
void |
completeShutdown()
|
protected ExecutionContext |
context()
|
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 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)
|
boolean |
register(ChangeSetListener observer)
Register the supplied observer. |
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". |
protected SessionEnvironment |
sessionContext()
|
void |
setAccessControlEnabled(boolean enabled)
|
void |
setLargeStringLength(long sizeInBytes)
|
void |
startShutdown()
|
boolean |
unregister(ChangeSetListener observer)
Unregister the supplied observer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final NodeKey systemMetadataKey
protected final Set<String> workspaceNames
protected final Logger logger
public static final RepositoryCache.ContentInitializer NO_OP_INITIALIZER
Constructor Detail |
---|
public RepositoryCache(ExecutionContext context, DocumentStore documentStore, RepositoryConfiguration configuration, RepositoryCache.ContentInitializer initializer, SessionEnvironment sessionContext, ChangeBus changeBus, org.infinispan.manager.CacheContainer workspaceCacheContainer)
Method Detail |
---|
public final void rollbackRepositoryInfo()
protected final SessionEnvironment sessionContext()
protected final String processKey()
protected Name name(String name)
public final boolean isInitializingRepository()
public final boolean isAccessControlEnabled()
public final void setAccessControlEnabled(boolean enabled)
protected final DocumentStore documentStore()
protected final ExecutionContext context()
public void completeInitialization()
public void startShutdown()
public void completeShutdown()
public NodeKey getRepositoryMetadataDocumentKey()
public boolean register(ChangeSetListener observer)
Observable
register
in interface Observable
observer
- the observer to be added; may be null
public boolean unregister(ChangeSetListener observer)
Observable
unregister
in interface Observable
observer
- the observer to be removed; may not be null
public void setLargeStringLength(long sizeInBytes)
public long largeValueSizeInBytes()
protected void refreshRepositoryMetadata(boolean update)
public void runOneTimeSystemInitializationOperation(Callable<Void> initOperation) throws Exception
initOperation
- a non-null
Callable
instance
Exception
- if anything unexpected occurs, clients are expected to handle thispublic 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 org.infinispan.Cache<NodeKey,CachedNode> cacheForWorkspace(String name)
protected final String cacheNameForWorkspace(String workspaceName)
public final DocumentTranslator getDocumentTranslator()
public WorkspaceCache createWorkspace(String name)
name
- the workspace name
UnsupportedOperationException
- 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 null
WorkspaceNotFoundException
- if no such workspace existspublic 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-only
WorkspaceNotFoundException
- 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 block
|
ModeShape Distribution 3.5.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |