|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.connector.base.Repository<DiskNode,DiskWorkspace> org.modeshape.connector.disk.DiskRepository
@ThreadSafe public class DiskRepository
The representation of a disk-based repository and its content.
Field Summary | |
---|---|
protected FileChannel |
lockFileChannel
|
protected static Logger |
LOGGER
|
protected AtomicInteger |
readLockCount
|
Fields inherited from class org.modeshape.graph.connector.base.Repository |
---|
context, rootNodeUuid, source |
Constructor Summary | |
---|---|
DiskRepository(DiskSource source)
|
Method Summary | |
---|---|
DiskWorkspace |
createWorkspace(Transaction<DiskNode,DiskWorkspace> txn,
String name,
CreateWorkspaceRequest.CreateConflictBehavior existingWorkspaceBehavior,
String nameOfWorkspaceToClone)
Attempts to create a workspace with the given name with name-collision behavior determined by the behavior parameter. |
protected File |
getRepositoryRoot()
Get the root of this repository |
Set<String> |
getWorkspaceNames()
Get the names of the available workspaces that have been loaded. |
protected void |
initialize()
Initializes the repository by creating the default workspace. |
DiskTransaction |
startTransaction(ExecutionContext context,
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.base.Repository |
---|
createRequestProcessor, destroyWorkspace, getContext, getDefaultWorkspaceName, getRootNodeUuid, getSourceName, getWorkspace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOGGER
protected final FileChannel lockFileChannel
protected AtomicInteger readLockCount
Constructor Detail |
---|
public DiskRepository(DiskSource source)
Method Detail |
---|
protected void initialize()
Repository
Due to the ordering restrictions on constructor chaining, this method cannot be called until the repository is fully
initialized. This method MUST be called at the end of the constructor by any class that implements MapRepository
.
initialize
in class Repository<DiskNode,DiskWorkspace>
public DiskWorkspace createWorkspace(Transaction<DiskNode,DiskWorkspace> txn, String name, CreateWorkspaceRequest.CreateConflictBehavior existingWorkspaceBehavior, String nameOfWorkspaceToClone) throws InvalidWorkspaceException
Repository
This method will first check to see if a workspace already exists with the given name. If no such workspace exists, the
method will create a new workspace with the given name, add it to the #workspaces workspaces map
, and return it. If
a workspace with the requested name already exists and the behavior
is CreateWorkspaceRequest.CreateConflictBehavior.DO_NOT_CREATE
, this method will return null
without modifying the state of the repository. If a workspace with the requested
name already exists and the behavior
is CreateWorkspaceRequest.CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME
, this method will
generate a unique new name for the workspace, create a new workspace with the given name, added it to the #workspaces workspaces map
, and return it.
If nameOfWorkspaceToClone
is given, this method will clone the content in this original workspace into the new
workspace. However, if no workspace with the name nameOfWorkspaceToClone
exists, the method will create an empty
workspace.
createWorkspace
in class Repository<DiskNode,DiskWorkspace>
txn
- the transaction creating the workspace; may not be nullname
- the requested name of the workspace. The name of the workspace that is returned from this method may not be the
same as the requested name; may not be nullexistingWorkspaceBehavior
- the behavior to use in case a workspace with the requested name already exists in the
repositorynameOfWorkspaceToClone
- the name of the workspace from which the content should be cloned; be null if the new
workspace is to be empty (other than the root node)
nameOfWorkspaceToClone
or null
if a workspace with the requested name already exists in the repository and
behavior == CreateConflictBehavior#DO_NOT_CREATE
.
InvalidWorkspaceException
- if the workspace could not be createdpublic Set<String> getWorkspaceNames()
getWorkspaceNames
in class Repository<DiskNode,DiskWorkspace>
Repository.getWorkspaceNames()
protected File getRepositoryRoot()
public DiskTransaction startTransaction(ExecutionContext context, boolean readonly)
committed
or rolled back
.
startTransaction
in class Repository<DiskNode,DiskWorkspace>
context
- the context in which the transaction is to be performed; may not be nullreadonly
- true if the transaction will not modify any content, or false if changes are to be made
Repository.startTransaction(org.modeshape.graph.ExecutionContext, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |