org.modeshape.graph.connector.inmemory
Class InMemoryRepository

java.lang.Object
  extended by org.modeshape.graph.connector.map.MapRepository
      extended by org.modeshape.graph.connector.inmemory.InMemoryRepository

@NotThreadSafe
public class InMemoryRepository
extends MapRepository

A specialized MapRepository that represents an in-memory repository.


Nested Class Summary
protected static class InMemoryRepository.InMemoryNodeState
           
protected  class InMemoryRepository.Workspace
           
 
Field Summary
protected  ReadWriteLock lock
           
 
Fields inherited from class org.modeshape.graph.connector.map.MapRepository
rootNodeUuid
 
Constructor Summary
InMemoryRepository(String sourceName, UUID rootNodeUuid)
           
InMemoryRepository(String sourceName, UUID rootNodeUuid, String defaultWorkspaceName)
           
 
Method Summary
protected  MapWorkspace createWorkspace(ExecutionContext context, String name)
          Creates a new workspace with the given name containing only a root node.
protected  ReadWriteLock getLock()
           
protected  void releaseBackups()
           
protected  void restoreBackups()
           
 MapRepositoryTransaction startTransaction(boolean readonly)
          Begin a transaction, hinting whether the transaction will be used only to read the content.
 
Methods inherited from class org.modeshape.graph.connector.map.MapRepository
createWorkspace, createWorkspace, destroyWorkspace, getDefaultWorkspaceName, getRootNodeUuid, getSourceName, getWorkspace, getWorkspaceNames, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected final ReadWriteLock lock
Constructor Detail

InMemoryRepository

public InMemoryRepository(String sourceName,
                          UUID rootNodeUuid)

InMemoryRepository

public InMemoryRepository(String sourceName,
                          UUID rootNodeUuid,
                          String defaultWorkspaceName)
Method Detail

createWorkspace

protected MapWorkspace createWorkspace(ExecutionContext context,
                                       String name)
Description copied from class: MapRepository
Creates a new workspace with the given name containing only a root node.

This method does NOT automatically add the newly created workspace to the workspace map or check to see if a workspace already exists in this repository with the same name.

Specified by:
createWorkspace in class MapRepository
Parameters:
context - the context in which the workspace is to be created
name - the name of the workspace
Returns:
the newly created workspace; may not be null

startTransaction

public MapRepositoryTransaction startTransaction(boolean readonly)
Begin a transaction, hinting whether the transaction will be used only to read the content. If this is called, then the transaction must be either committed or rolled back.

Specified by:
startTransaction in class MapRepository
Parameters:
readonly - true if the transaction will not modify any content, or false if changes are to be made
Returns:
the transaction; never null
See Also:
MapRepository.startTransaction(boolean)

getLock

protected ReadWriteLock getLock()

restoreBackups

protected void restoreBackups()

releaseBackups

protected void releaseBackups()


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