ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr.cache
Class RepositoryCache

java.lang.Object
  extended by org.modeshape.jcr.cache.RepositoryCache
All Implemented Interfaces:
Observable

public class RepositoryCache
extends Object
implements Observable


Nested Class Summary
static interface RepositoryCache.ContentInitializer
           
protected  class RepositoryCache.LocalChangeListener
           
 
Field Summary
static RepositoryCache.ContentInitializer NO_OP_INITIALIZER
           
 
Constructor Summary
RepositoryCache(ExecutionContext context, SchematicDb database, RepositoryConfiguration configuration, RepositoryCache.ContentInitializer initializer, SessionEnvironment sessionContext, ChangeBus changeBus, org.infinispan.manager.CacheContainer workspaceCacheContainer)
           
 
Method Summary
protected  String cacheNameForWorkspace(String workspaceName)
           
 void completeShutdown()
           
 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)
          Permanently destroys the workspace with the supplied name, if the repository is appropriately configured.
 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()
           
 NodeCache 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 isSystemContentInitialized()
           
 long largeValueSizeInBytes()
           
protected  Name name(String name)
           
protected  void refreshWorkspaces(boolean update)
           
 boolean register(ChangeSetListener observer)
          Register the supplied observer.
 void setLargeValueSizeInBytes(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

NO_OP_INITIALIZER

public static final RepositoryCache.ContentInitializer NO_OP_INITIALIZER
Constructor Detail

RepositoryCache

public RepositoryCache(ExecutionContext context,
                       SchematicDb database,
                       RepositoryConfiguration configuration,
                       RepositoryCache.ContentInitializer initializer,
                       SessionEnvironment sessionContext,
                       ChangeBus changeBus,
                       org.infinispan.manager.CacheContainer workspaceCacheContainer)
Method Detail

name

protected Name name(String name)

startShutdown

public void startShutdown()

completeShutdown

public void completeShutdown()

getRepositoryMetadataDocumentKey

public NodeKey getRepositoryMetadataDocumentKey()
Get the identifier of the repository's metadata document.

Returns:
the cache key for the repository's metadata document; never null

register

public boolean register(ChangeSetListener observer)
Description copied from interface: Observable
Register the supplied observer. This method does nothing if the observer reference is null.

Specified by:
register in interface Observable
Parameters:
observer - the observer to be added; may be null
Returns:
true if the observer was added, or false if the observer was null, if the observer was already registered, or if the observer could not be added

unregister

public boolean unregister(ChangeSetListener observer)
Description copied from interface: Observable
Unregister the supplied observer. This method does nothing if the observer reference is null.

Specified by:
unregister in interface Observable
Parameters:
observer - the observer to be removed; may not be null
Returns:
true if the observer was removed, or false if the observer was null or if the observer was not registered on this source

setLargeValueSizeInBytes

public void setLargeValueSizeInBytes(long sizeInBytes)

largeValueSizeInBytes

public long largeValueSizeInBytes()

isSystemContentInitialized

public boolean isSystemContentInitialized()

refreshWorkspaces

protected void refreshWorkspaces(boolean update)

getKey

public final String getKey()
Get the key for this repository.

Returns:
the repository's key; never null

getSystemKey

public final NodeKey getSystemKey()

getSystemWorkspaceKey

public final String getSystemWorkspaceKey()

getSystemWorkspaceName

public final String getSystemWorkspaceName()

getName

public final String getName()
Get the name for this repository.

Returns:
the repository's name; never null

getWorkspaceNames

public final Set<String> getWorkspaceNames()
Get the names of all available workspaces in this repository. Not all workspaces may be loaded. This set does not contain the system workspace name, as that workspace is not accessible/visible to JCR clients.

Returns:
the names of all available workspaces; never null and immutable

cacheNameForWorkspace

protected final String cacheNameForWorkspace(String workspaceName)

createWorkspace

public WorkspaceCache createWorkspace(String name)
Create a new workspace in this repository, if the repository is appropriately configured. If the repository already contains a workspace with the supplied name, then this method simply returns that workspace. Otherwise, this method attempts to create the named workspace and will return a cache for this newly-created workspace.

Parameters:
name - the workspace name
Returns:
the workspace cache for the new (or existing) workspace; never null
Throws:
UnsupportedOperationException - if this repository was not configured to allow creation of workspaces.

destroyWorkspace

public boolean destroyWorkspace(String name)
Permanently destroys the workspace with the supplied name, if the repository is appropriately configured. If no such workspace exists in this repository, this method simply returns. Otherwise, this method attempts to destroy the named workspace.

Parameters:
name - the workspace name
Returns:
true if the workspace with the supplied name existed and was destroyed, or false otherwise
Throws:
UnsupportedOperationException - if this repository was not configured to allow creation (and destruction) of workspaces.

getWorkspaceCache

public NodeCache getWorkspaceCache(String workspaceName)
Get the NodeCache for the workspace with the given name. This session can be used (by multiple concurrent threads) to read, create, change, or delete content.

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.)

Parameters:
workspaceName - the name of the workspace; may not be null
Returns:
the node cache; never null
Throws:
WorkspaceNotFoundException - if no such workspace exists

createSession

public 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.

Parameters:
context - the context for the new session; may not be null
workspaceName - the name of the workspace; may not be null
readOnly - true if the session is to be read-only
Returns:
the new session that supports writes; never null
Throws:
WorkspaceNotFoundException - if no such workspace exists

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.