Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.connector.map
Interface MapWorkspace

All Known Implementing Classes:
  AbstractMapWorkspace, SimpleJpaRepository.Workspace

    public interface MapWorkspace

The `MapWorkspace` defines the required methods for workspaces in a `map repository`. By default, a map repository supports multiple workspaces, each equating logically to a map of UUIDs to `map nodes`.

As each map node (except the root-node for the workspace) has a non-null parent and a set of children, the `map nodes` naturally construct a tree within the workspace.

Method Summary
`MapNode` | `cloneNode(ExecutionContext context, MapNode original, MapWorkspace newWorkspace, MapNode newParent, Name desiredName, Path.Segment desiredSegment, boolean removeExisting, Set<Location> removedExistingNodes)` This should clone the subgraph given by the original node and place the cloned copy under the supplied new parent.
`MapNode` | `copyNode(ExecutionContext context, MapNode original, MapWorkspace newWorkspace, MapNode newParent, Name desiredName, boolean recursive)` This should copy the subgraph given by the original node and place the new copy under the supplied new parent.
`MapNode` | `createNode(ExecutionContext context, MapNode parentNode, Name name, UUID uuid, Iterable<Property> properties)` Create a new node with the supplied name, as a child of the supplied parent.
`MapNode` | `createNode(ExecutionContext context, String pathToNewNode, Iterable<Property> properties)` Create a node at the supplied path.
`Path` | `getLowestExistingPath(Path path)` Find the lowest existing node along the path.
`String` | `getName()` Returns the name of the workspace.
`MapNode` | `getNode(Path path)` Returns the node at the given path, if one exists of `null` if no exists at the given path.
`MapNode` | `getNode(UUID uuid)` Returns the node with the given UUID, if one exists or `null` if no with the given UUID exists in the workspace.
`MapNode` | `getRoot()` Returns the root node in the workspace.
`void` | `lockNode(MapNode node, LockBranchRequest.LockScope lockScope, long lockTimeoutInMillis)` Attempts to lock the given node with the given timeout.
`void` | `moveNode(ExecutionContext context, MapNode node, Name desiredNewName, MapWorkspace newWorkspace, MapNode newParent, MapNode beforeNode)` Move the supplied node to the new parent.
`Path` | `pathFor(PathFactory pathFactory, MapNode node)` Returns the path for the given node with this workspace if one exists, or a `null` if no node exists at the given path.
`QueryResults` | `query(ExecutionContext context, AccessQueryRequest accessQuery)` Perform a query of this workspace.
`boolean` | `removeNode(ExecutionContext context, MapNode node)` Removes the given node.
`QueryResults` | `search(ExecutionContext context, String fullTextSearchExpression)` Perform a full-text search of this workspace.
`void` | `unlockNode(MapNode node)` Attempts to unlock the given node.

Method Detail

### getName

    String getName()

  Returns the name of the workspace. There can only be one workspace with a given name per repository.

  Returns:
    the name of the workspace

### getRoot

    MapNode getRoot()

  Returns the root node in the workspace. This returns a `map node` where `node.getParent() == null` and `node.getUuid() == repository.getRootNodeUuid()`.

  Returns:
    the root node in the workspace

### getNode

    MapNode getNode(UUID uuid)

  Returns the node with the given UUID, if one exists or `null` if no with the given UUID exists in the workspace.

  That is, `node == null || node.getUuid().equals(uuid)` for the returned node.

  Parameters:
    `uuid` - the UUID of the node to be retrieved; may not be null
  Returns:
    the node with the given UUID, if one exists or `null` if no with the given UUID exists in the workspace.

### getNode

    MapNode getNode(Path path)

  Returns the node at the given path, if one exists of `null` if no exists at the given path.

  Parameters:
    `path` - the path of the node to retrieve; may not be null
  Returns:
    the node at the given path, if one exists of `null` if no exists at the given path.

### removeNode

    boolean removeNode(ExecutionContext context,
                       MapNode node)

  Removes the given node. This method will return false if the given node does not exist in this workspace.

  Parameters:
    `context` - the current execution context; may not be null
    `node` - the node to be removed; may not be null
  Returns:
    whether a node was removed as a result of this operation

### createNode

    MapNode createNode(ExecutionContext context,
                       String pathToNewNode,
                       Iterable<Property> properties)

  Create a node at the supplied path. The parent of the new node must already exist.

  Parameters:
    `context` - the environment; may not be null
    `pathToNewNode` - the path to the new node; may not be null
    `properties` - the properties for the new node
  Returns:
    the new node (or root if the path specified the root)

### createNode

    MapNode createNode(ExecutionContext context,
                       MapNode parentNode,
                       Name name,
                       UUID uuid,
                       Iterable<Property> properties)

  Create a new node with the supplied name, as a child of the supplied parent.

  Parameters:
    `context` - the execution context
    `parentNode` - the parent node; may not be null
    `name` - the name; may not be null
    `uuid` - the UUID of the node, or null if the UUID is to be generated
    `properties` - the properties for the new node
  Returns:
    the new node

### moveNode

    void moveNode(ExecutionContext context,
                  MapNode node,
                  Name desiredNewName,
                  MapWorkspace newWorkspace,
                  MapNode newParent,
                  MapNode beforeNode)

  Move the supplied node to the new parent. This method automatically removes the node from its existing parent, and also correctly adjusts the `index` to be correct in the new parent.

  Parameters:
    `context` -
    `node` - the node to be moved; may not be the `root`
    `desiredNewName` - the new name for the node, if it is to be changed; may be null
    `newWorkspace` - the workspace containing the new parent node
    `newParent` - the new parent; may not be the `root`
    `beforeNode` - the node before which this new node should be placed

### copyNode

    MapNode copyNode(ExecutionContext context,
                     MapNode original,
                     MapWorkspace newWorkspace,
                     MapNode newParent,
                     Name desiredName,
                     boolean recursive)

  This should copy the subgraph given by the original node and place the new copy under the supplied new parent. Note that internal references between nodes within the original subgraph must be reflected as internal nodes within the new subgraph.

  Parameters:
    `context` - the context; may not be null
    `original` - the node to be copied; may not be null
    `newWorkspace` - the workspace containing the new parent node; may not be null
    `newParent` - the parent where the copy is to be placed; may not be null
    `desiredName` - the desired name for the node; if null, the name will be obtained from the original node
    `recursive` - true if the copy should be recursive
  Returns:
    the new node, which is the top of the new subgraph

### cloneNode

    MapNode cloneNode(ExecutionContext context,
                      MapNode original,
                      MapWorkspace newWorkspace,
                      MapNode newParent,
                      Name desiredName,
                      Path.Segment desiredSegment,
                      boolean removeExisting,
                      Set<Location> removedExistingNodes)
                      throws UuidAlreadyExistsException

  This should clone the subgraph given by the original node and place the cloned copy under the supplied new parent. Note that internal references between nodes within the original subgraph must be reflected as internal nodes within the new subgraph.

  Parameters:
    `context` - the context; may not be null
    `original` - the node to be cloned; may not be null
    `newWorkspace` - the workspace containing the new parent node; may not be null
    `newParent` - the parent where the clone is to be placed; may not be null
    `desiredName` - the desired name for the node; if null, the name will be calculated from `desiredSegment`; Exactly one of `desiredSegment` and `desiredName` must be non-null
    `desiredSegment` - the exact segment at which the clone should be rooted; if null, the name will be inferred from `desiredName`; Exactly one of `desiredSegment` and `desiredName` must be non-null
    `removeExisting` - true if existing nodes in the new workspace with the same UUIDs as nodes in the branch rooted at `original` should be removed; if false, a UuidAlreadyExistsException will be thrown if a UUID conflict is detected
    `removedExistingNodes` - the set into which should be placed all of the existing nodes that were removed as a result of this clone operation, or null if these nodes need not be collected
  Returns:
    the new node, which is the top of the new subgraph
  Throws:
    `UuidAlreadyExistsException` - if `removeExisting` is true and and a UUID in the source tree already exists in the new workspace

### lockNode

    void lockNode(MapNode node,
                  LockBranchRequest.LockScope lockScope,
                  long lockTimeoutInMillis)
                  throws LockFailedException

  Attempts to lock the given node with the given timeout. If the lock attempt fails, a `LockFailedException` will be thrown.

  Parameters:
    `node` - the node to be locked; may not be null
    `lockScope` - the scope of the lock (i.e., whether descendants of `node` should be included in the lock
    `lockTimeoutInMillis` - the maximum lifetime of the lock in milliseconds; zero (0) indicates that the connector default should be used
  Throws:
    `LockFailedException` - if the implementing connector supports locking but the lock could not be acquired.

### unlockNode

    void unlockNode(MapNode node)

  Attempts to unlock the given node.

  Parameters:
    `node` - the node to be unlocked; may not be null

### getLowestExistingPath

    Path getLowestExistingPath(Path path)

  Find the lowest existing node along the path.

  Parameters:
    `path` - the path to the node; may not be null
  Returns:
    the lowest existing node along the path, or the root node if no node exists on the path

### pathFor

    Path pathFor(PathFactory pathFactory,
                 MapNode node)

  Returns the path for the given node with this workspace if one exists, or a `null` if no node exists at the given path.

  Parameters:
    `pathFactory` - the path factory to use to construct the path; may not be null
    `node` - the node for which the path should be retrieved; may not be null
  Returns:
    the path for the given node with this workspace if one exists or null if the node does not exist in this workspace

### query

    QueryResults query(ExecutionContext context,
                       AccessQueryRequest accessQuery)

  Perform a query of this workspace.

  Parameters:
    `context` - the context in which the query is to be executed; may not be null
    `accessQuery` - the access query; may not be null
  Returns:
    the query results, or null if the query is not supported

### search

    QueryResults search(ExecutionContext context,
                        String fullTextSearchExpression)

  Perform a full-text search of this workspace.

  Parameters:
    `context` - the context in which the query is to be executed; may not be null
    `fullTextSearchExpression` - the full-text search expression; may not be null
  Returns:
    the query results, or null if the query is not supported

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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