org.modeshape.jcr.query.engine

## Class QuerySources

- java.lang.Object
- - org.modeshape.jcr.query.engine.QuerySources

-     public class QuerySources
      extends Object

  A factory for creating `NodeSequence` instances.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `QuerySources.BatchWriter`
    `protected static class` | `QuerySources.CompositeNodeFilter`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `includeSystemContent`
    `protected NodeTypes` | `nodeTypes`
    `protected NodeCacheIterator.NodeFilter` | `queryableAndNonSystemFilter`
    `protected NodeCacheIterator.NodeFilter` | `queryableFilter`
    `protected RepositoryCache` | `repo`
    `protected String` | `systemWorkspaceName`
    `protected String` | `workspaceName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QuerySources(RepositoryCache repository, NodeTypes nodeTypes, String workspaceName, boolean includeSystemContent)` Construct a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `NodeSequence` | `allNodes(float score, long nodeCount)` Obtain a `NodeSequence` that returns all (queryable) nodes in the workspace, where each node is assigned the given score.
    `NodeSequence` | `childNodes(Path parentPath, float score)` Obtain a `NodeSequence` that returns the (queryable) children of the node at the given path in the workspace, where each child node is assigned the given score.
    `NodeSequence` | `descendantNodes(Path ancestorPath, float score)` Obtain a `NodeSequence` that returns the (queryable) descendants of the node at the given path in the workspace, where each descendant node is assigned the given score.
    `NodeSequence` | `fromIndex(Index index, Collection<Constraint> constraints, Map<String,Object> variables, Map<String,Object> parameters, ValueFactories valueFactories, int batchSize)` Obtain a `NodeSequence` that uses the supplied index to find the node that satisfy the given constraints.
    `protected String` | `getIdentifier(CachedNode node, NodeKey workspaceRootKey)`
    `protected CachedNode` | `getNodeAtPath(Path path, NodeCache cache)`
    `String` | `getWorkspaceName()`
    `protected String` | `getWorkspaceName(Path path)`
    `boolean` | `includeSystemContent()`
    `protected NodeCacheIterator.NodeFilter` | `nodeFilterForWorkspace(String workspaceName)`
    `protected NodeCacheIterator` | `nodes(String workspaceName, Path path)` Return an iterator over all nodes at or below the specified path in the named workspace, using the supplied filter.
    `protected NodeCacheIterator.NodeFilter` | `sharedNodesFilter()` Creates a node filter which doesn't include any of the nodes from the shared set in the query result.
    `NodeSequence` | `singleNode(Path path, float score)` Obtain a `NodeSequence` that returns the (queryable) node at the given path in the workspace, where the node is assigned the given score.
    `NodeSequence` | `singleNode(String workspaceName, String identifier, float score)` Obtain a `NodeSequence` that returns the (queryable) node with the given key in the workspace, where the node is assigned the given score.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### repo

          protected final RepositoryCache repo

    - #### workspaceName

          protected final String workspaceName

    - #### systemWorkspaceName

          protected final String systemWorkspaceName

    - #### includeSystemContent

          protected final boolean includeSystemContent

    - #### queryableFilter

          protected final NodeCacheIterator.NodeFilter queryableFilter

    - #### queryableAndNonSystemFilter

          protected final NodeCacheIterator.NodeFilter queryableAndNonSystemFilter

    - #### nodeTypes

          protected final NodeTypes nodeTypes

  - ### Constructor Detail

    - #### QuerySources

          public QuerySources(RepositoryCache repository,
                      NodeTypes nodeTypes,
                      String workspaceName,
                      boolean includeSystemContent)

      Construct a new instance.
      Parameters:
        `repository` - the repository cache; may not be null
        `nodeTypes` - the node types cache; may not be null
        `workspaceName` - the name of the main workspace to be queried; may not be null
        `includeSystemContent` - true if the system content is to be included in the query results, or false otherwise

  - ### Method Detail

    - #### includeSystemContent

          public boolean includeSystemContent()

    - #### getWorkspaceName

          public String getWorkspaceName()

    - #### allNodes

          public NodeSequence allNodes(float score,
                              long nodeCount)

      Obtain a `NodeSequence` that returns all (queryable) nodes in the workspace, where each node is assigned the given score.
      Parameters:
        `score` - the score for each node
        `nodeCount` - the number of nodes (or an estimate) that will be returned
      Returns:
        the sequence of nodes; never null

    - #### singleNode

          public NodeSequence singleNode(Path path,
                                float score)

      Obtain a `NodeSequence` that returns the (queryable) node at the given path in the workspace, where the node is assigned the given score.
      Parameters:
        `path` - the path of the node; may not be null
        `score` - the score for the node
      Returns:
        the sequence of node(s); never null

    - #### singleNode

          public NodeSequence singleNode(String workspaceName,
                                String identifier,
                                float score)

      Obtain a `NodeSequence` that returns the (queryable) node with the given key in the workspace, where the node is assigned the given score.
      Parameters:
        `workspaceName` - the name of the workspace; may not be null
        `identifier` - the `identifier` of the node; may not be null
        `score` - the score for the node
      Returns:
        the sequence of node(s); never null

    - #### getIdentifier

          protected String getIdentifier(CachedNode node,
                             NodeKey workspaceRootKey)

    - #### childNodes

          public NodeSequence childNodes(Path parentPath,
                                float score)

      Obtain a `NodeSequence` that returns the (queryable) children of the node at the given path in the workspace, where each child node is assigned the given score.
      Parameters:
        `parentPath` - the path of the parent node; may not be null
        `score` - the score for the nodes
      Returns:
        the sequence of nodes; never null

    - #### descendantNodes

          public NodeSequence descendantNodes(Path ancestorPath,
                                     float score)

      Obtain a `NodeSequence` that returns the (queryable) descendants of the node at the given path in the workspace, where each descendant node is assigned the given score.
      Parameters:
        `ancestorPath` - the path of the ancestor of all descendants; may not be null
        `score` - the score for the nodes
      Returns:
        the sequence of nodes; never null

    - #### fromIndex

          public NodeSequence fromIndex(Index index,
                               Collection<Constraint> constraints,
                               Map<String,Object> variables,
                               Map<String,Object> parameters,
                               ValueFactories valueFactories,
                               int batchSize)

      Obtain a `NodeSequence` that uses the supplied index to find the node that satisfy the given constraints.
      Parameters:
        `index` - the index; may not be null
        `constraints` - the constraints that apply to the index; may not be null or empty
        `variables` - the immutable map of variable values keyed by their name; never null but possibly empty
        `parameters` - the provider-specific index parameters; may not be null, but may be empty
        `valueFactories` - the value factories; never null
        `batchSize` - the ideal number of nodes that are to be included in each batch; always positive
      Returns:
        the sequence of nodes; null if the index cannot be used (e.g., it might be rebuilding or in an inconsistent state)

    - #### sharedNodesFilter

          protected NodeCacheIterator.NodeFilter sharedNodesFilter()

      Creates a node filter which doesn't include any of the nodes from the shared set in the query result. This is per JSR-283/#14.16: if a query matches a descendant node of a shared set, it appears in query results only once.
      Returns:
        a new `NodeCacheIterator.NodeFilter` instance

    - #### nodes

          protected NodeCacheIterator nodes(String workspaceName,
                                Path path)

      Return an iterator over all nodes at or below the specified path in the named workspace, using the supplied filter.
      Parameters:
        `workspaceName` - the name of the workspace
        `path` - the path of the root node of the subgraph, or null if all nodes in the workspace are to be included
      Returns:
        the iterator, or null if this workspace will return no nodes

    - #### nodeFilterForWorkspace

          protected NodeCacheIterator.NodeFilter nodeFilterForWorkspace(String workspaceName)

    - #### getNodeAtPath

          protected CachedNode getNodeAtPath(Path path,
                                 NodeCache cache)

    - #### getWorkspaceName

          protected String getWorkspaceName(Path path)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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