View Javadoc

1   package org.modeshape.graph.connector.path;
2   
3   import org.modeshape.graph.ExecutionContext;
4   import org.modeshape.graph.connector.LockFailedException;
5   import org.modeshape.graph.property.Path;
6   import org.modeshape.graph.query.QueryResults;
7   import org.modeshape.graph.request.AccessQueryRequest;
8   import org.modeshape.graph.request.LockBranchRequest.LockScope;
9   
10  public interface PathWorkspace {
11      /**
12       * Returns the name of the workspace. There can only be one workspace with a given name per repository.
13       * 
14       * @return the name of the workspace
15       */
16      String getName();
17  
18      /**
19       * Returns the node at the given path, if one exists of {@code null} if no {@PathNode node} exists at the given
20       * path.
21       * 
22       * @param path the path of the node to retrieve; may not be null
23       * @return the node at the given path, if one exists of {@code null} if no {@PathNode node} exists at the given
24       *         path.
25       */
26      PathNode getNode( Path path );
27  
28      /**
29       * Attempts to lock the given node with the given timeout. If the lock attempt fails, a {@link LockFailedException} will be
30       * thrown.
31       * 
32       * @param node the node to be locked; may not be null
33       * @param lockScope the scope of the lock (i.e., whether descendants of {@code node} should be included in the lock
34       * @param lockTimeoutInMillis the maximum lifetime of the lock in milliseconds; zero (0) indicates that the connector default
35       *        should be used
36       * @throws LockFailedException if the implementing connector supports locking but the lock could not be acquired.
37       */
38      void lockNode( PathNode node,
39                     LockScope lockScope,
40                     long lockTimeoutInMillis ) throws LockFailedException;
41  
42      /**
43       * Attempts to unlock the given node.
44       * 
45       * @param node the node to be unlocked; may not be null
46       */
47      void unlockNode( PathNode node );
48  
49      /**
50       * Find the lowest existing node along the path.
51       * 
52       * @param path the path to the node; may not be null
53       * @return the lowest existing node along the path, or the root node if no node exists on the path
54       */
55      Path getLowestExistingPath( Path path );
56  
57      /**
58       * Perform a query of this workspace.
59       * 
60       * @param context the context in which the query is to be executed; may not be null
61       * @param accessQuery the access query; may not be null
62       * @return the query results, or null if the query is not supported
63       */
64      QueryResults query( ExecutionContext context,
65                          AccessQueryRequest accessQuery );
66  
67      /**
68       * Perform a full-text search of this workspace.
69       * 
70       * @param context the context in which the query is to be executed; may not be null
71       * @param fullTextSearchExpression the full-text search expression; may not be null
72       * @return the query results, or null if the query is not supported
73       */
74      QueryResults search( ExecutionContext context,
75                           String fullTextSearchExpression );
76  }