|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.graph.connector.map.MapRepository
public abstract class MapRepository
A default implementation of a map-based repository.
MapRepository
provides means for creating, retrieving, and destroying map-based workspaces
,
including providing the locking primitives required for safe control of the workspaces.
Constructor Summary | |
---|---|
MapRepository(String sourceName,
UUID rootNodeUuid)
Creates a MapRepository with the given repository source name, root node UUID, and a default workspace named
"" (the empty string). |
|
MapRepository(String sourceName,
UUID rootNodeUuid,
String defaultWorkspaceName)
Creates a MapRepository with the given repository source name, root node UUID, and a default workspace with the
given name. |
Method Summary | |
---|---|
MapWorkspace |
createWorkspace(ExecutionContext context,
String name,
CreateWorkspaceRequest.CreateConflictBehavior behavior)
Attempts to create a workspace with the given name with name-collision behavior determined by the behavior parameter. |
MapWorkspace |
createWorkspace(ExecutionContext context,
String name,
CreateWorkspaceRequest.CreateConflictBehavior existingWorkspaceBehavior,
String nameOfWorkspaceToClone)
Attempts to create a workspace with the requested name as in the #createWorkspace(ExecutionContext, String, CreateConflictBehavior) method and then clones the content from the
given source workspace into the new workspace if the creation was successful. |
boolean |
destroyWorkspace(String name)
Removes the named workspace from the #workspaces workspaces map . |
ReadWriteLock |
getLock()
Returns the lock that must be used to ensure consistent access to the repository |
UUID |
getRootNodeUuid()
Returns the UUID used by the root nodes in each workspace. |
String |
getSourceName()
Returns the logical name (as opposed to the class name) of the repository source that defined this instance of the repository for use in error, informational, and other contextual messages. |
MapWorkspace |
getWorkspace(String name)
Returns the workspace with the given name |
Set<String> |
getWorkspaceNames()
Returns a list of the names of the currently created workspaces |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapRepository(String sourceName, UUID rootNodeUuid)
MapRepository
with the given repository source name, root node UUID, and a default workspace named
""
(the empty string).
sourceName
- the name of the repository source for use in error and informational messages; may not be null or emptyrootNodeUuid
- the UUID that will be used as the root node UUID for each workspace in the repository; may not be null
or emptypublic MapRepository(String sourceName, UUID rootNodeUuid, String defaultWorkspaceName)
MapRepository
with the given repository source name, root node UUID, and a default workspace with the
given name.
sourceName
- the name of the repository source for use in error and informational messages; may not be null or emptyrootNodeUuid
- the UUID that will be used as the root node UUID for each workspace in the repository; may not be null
or emptydefaultWorkspaceName
- the name of the default, auto-created workspaceMethod Detail |
---|
public final UUID getRootNodeUuid()
Note that the root nodes themselves are distinct objects in each workspace and a change to the root node of one workspace does not imply a change to the root nodes of any other workspaces. However, the JCR specification mandates that all referenceable root nodes in a repository use a common UUID (in support of node correspondence); therefore this must be supported by DNA.
public String getSourceName()
public ReadWriteLock getLock()
public Set<String> getWorkspaceNames()
public MapWorkspace getWorkspace(String name)
name
- the name of the workspace to return
public MapWorkspace createWorkspace(ExecutionContext context, String name, CreateWorkspaceRequest.CreateConflictBehavior behavior)
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.
context
- the context in which the workspace is to be created; 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 nullbehavior
- the behavior to use in case a workspace with the requested name already exists in the repository
null
if a workspace with the requested name already exists in the repository
and behavior == CreateConflictBehavior#DO_NOT_CREATE
.public MapWorkspace createWorkspace(ExecutionContext context, String name, CreateWorkspaceRequest.CreateConflictBehavior existingWorkspaceBehavior, String nameOfWorkspaceToClone)
#createWorkspace(ExecutionContext, String, CreateConflictBehavior)
method and then clones the content from the
given source workspace into the new workspace if the creation was successful.
If no workspace with the name nameOfWorkspaceToClone
exists, the method will return an empty workspace.
context
- the context in which the workspace is to be created; 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; may not be null
nameOfWorkspaceToClone
or null
if a workspace with the requested name already exists in the repository and
behavior == CreateConflictBehavior#DO_NOT_CREATE
.public boolean destroyWorkspace(String name)
#workspaces workspaces map
.
name
- the name of the workspace to remove
true
if a workspace with that name previously existed in the map
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |