javax.jcr.query

## Interface QueryManager

    public interface QueryManager

This interface encapsulates methods for the management of search queries. Provides methods for the creation and retrieval of search queries.

### Method Summary

All Methods Instance Methods Abstract Methods
`Query` `createQuery(java.lang.String statement, java.lang.String language)` Creates a new query by specifying the query `statement` itself and the `language` in which the query is stated.
`Query` `getQuery(Node node)` Retrieves an existing persistent query.
`java.lang.String[]` `getSupportedQueryLanguages()` Returns an array of strings representing all query languages supported by this repository.

### Method Detail

#### createQuery

    Query createQuery(java.lang.String statement,
                      java.lang.String language)
               throws InvalidQueryException,
                      RepositoryException

Creates a new query by specifying the query `statement` itself and the `language` in which the query is stated. If the query `statement` is syntactically invalid, given the language specified, an `InvalidQueryException` is thrown. The `language` must be a string from among those returned by QueryManager.getSupportedQueryLanguages(); if it is not, then an `InvalidQueryException` is thrown.

Returns:
  A `Query` object.
Throws:
  `InvalidQueryException` - if statement is invalid or language is unsupported.
  `RepositoryException` - if another error occurs

#### getQuery

    Query getQuery(Node node)
            throws InvalidQueryException,
                   RepositoryException

Retrieves an existing persistent query. If `node` is not a valid persisted query (that is, a node of type `nt:query`), an `InvalidQueryException` is thrown.

Persistent queries are created by first using `QueryManager.createQuery` to create a `Query` object and then calling `Query.save` to persist the query to a location in the workspace.

Parameters:
  `node` - a persisted query (that is, a node of type `nt:query`).
Returns:
  a `Query` object.
Throws:
  `InvalidQueryException` - If `node` is not a valid persisted query (that is, a node of type `nt:query`).
  `RepositoryException` - if another error occurs

#### getSupportedQueryLanguages

    java.lang.String[] getSupportedQueryLanguages()
                                           throws RepositoryException

Returns an array of strings representing all query languages supported by this repository. In level 1 this set must include the string represented by the constant `Query.XPATH`. If SQL is supported it must additionally include the string represented by the constant `Query.SQL`. An implementation may also support other languages as well. See `Query`.

Returns:
  An string array.
Throws:
  `RepositoryException` - if an error occurs.

Copyright © 2004-2005 Day Software Management AG. All Rights Reserved.