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`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `includeSystemContent`
    `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, 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 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.
    `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.
    `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

  - ### Constructor Detail

    - #### QuerySources

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

      Construct a new instance.
      Parameters:
        `repository` - the repository 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

    - #### 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; never null

    - #### 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.