Package javax.jcr.query
Interface QueryManager
-
public interface QueryManagerThis 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 Modifier and Type Method Description QuerycreateQuery(String statement, String language)Creates a new query by specifying the querystatementitself and thelanguagein which the query is stated.QueryObjectModelFactorygetQOMFactory()Returns aQueryObjectModelFactorywith which a JCR-JQOM query can be built programmatically.QuerygetQuery(Node node)Retrieves an existing persistent query.String[]getSupportedQueryLanguages()Returns an array of strings representing all query languages supported by this repository.
-
-
-
Method Detail
-
createQuery
Query createQuery(String statement, String language) throws InvalidQueryException, RepositoryException
Creates a new query by specifying the querystatementitself and thelanguagein which the query is stated. Thelanguagemust be a string from among those returned by QueryManager.getSupportedQueryLanguages().- Parameters:
statement- aStringlanguage- aString- Returns:
- a
Queryobject - Throws:
InvalidQueryException- if the query statement is syntactically invalid or the specified language is not supported.RepositoryException- if another error occurs.
-
getQOMFactory
QueryObjectModelFactory getQOMFactory()
Returns aQueryObjectModelFactorywith which a JCR-JQOM query can be built programmatically.- Returns:
- a
QueryObjectModelFactoryobject - Since:
- JCR 2.0
-
getQuery
Query getQuery(Node node) throws InvalidQueryException, RepositoryException
Retrieves an existing persistent query.Persistent queries are created by first using
createQuery(java.lang.String, java.lang.String)to create aQueryobject and then callingQuery.saveto persist the query to a location in the workspace.- Parameters:
node- a persisted query (that is, a node of typent:query).- Returns:
- a
Queryobject. - Throws:
InvalidQueryException- Ifnodeis not a valid persisted query (that is, a node of typent:query).RepositoryException- if another error occurs
-
getSupportedQueryLanguages
String[] getSupportedQueryLanguages() throws RepositoryException
Returns an array of strings representing all query languages supported by this repository. This set must include at least the strings represented by the constantsQuery.JCR_SQL2andQuery.JCR_JQOM}. An implementation may also support other languages, including the deprecated languages of JCR 1.0:Query.XPATHandQuery.SQL.- Returns:
- A string array.
- Throws:
RepositoryException- if an error occurs.
-
-