Package org.apache.jackrabbit.oak.query
Class QueryEngineImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.QueryEngineImpl
-
- All Implemented Interfaces:
QueryEngine
public abstract class QueryEngineImpl extends Object implements QueryEngine
The query engine implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryEngineImpl.QuerySelectionMode
Used to instruct theQueryEngineImpl
on how to act with respect of the SQL2 optimisation.
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.oak.api.QueryEngine
INTERNAL_SQL2_QUERY, NO_BINDINGS, NO_MAPPINGS
-
-
Constructor Summary
Constructors Constructor Description QueryEngineImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Result
executeQuery(String statement, String language, long limit, long offset, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings)
Execute a query and get the result.Result
executeQuery(String statement, String language, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings)
Execute a query and get the result.Result
executeQuery(String statement, String language, Optional<Long> limit, Optional<Long> offset, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings)
Execute a query and get the result.List<String>
getBindVariableNames(String statement, String language, Map<String,String> mappings)
Parse the query (check if it's valid) and get the list of bind variable names.protected abstract ExecutionContext
getExecutionContext()
Get the execution context for a single query execution.Set<String>
getSupportedQueryLanguages()
Get the set of supported query languages.protected void
setQuerySelectionMode(@NotNull QueryEngineImpl.QuerySelectionMode querySelectionMode)
Instruct the query engine on how to behave with regards to the SQL2 optimised query if available.protected void
setTraversalEnabled(boolean traversalEnabled)
-
-
-
Method Detail
-
getExecutionContext
protected abstract ExecutionContext getExecutionContext()
Get the execution context for a single query execution.- Returns:
- the context
-
getSupportedQueryLanguages
public Set<String> getSupportedQueryLanguages()
Description copied from interface:QueryEngine
Get the set of supported query languages.- Specified by:
getSupportedQueryLanguages
in interfaceQueryEngine
- Returns:
- the supported query languages
-
getBindVariableNames
public List<String> getBindVariableNames(String statement, String language, Map<String,String> mappings) throws ParseException
Parse the query (check if it's valid) and get the list of bind variable names.- Specified by:
getBindVariableNames
in interfaceQueryEngine
- Parameters:
statement
- query statementlanguage
- query languagemappings
- namespace prefix mappings- Returns:
- the list of bind variable names
- Throws:
ParseException
-
executeQuery
public Result executeQuery(String statement, String language, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings) throws ParseException
Description copied from interface:QueryEngine
Execute a query and get the result. This is a convenience method: no limit, and offset 0.- Specified by:
executeQuery
in interfaceQueryEngine
- Parameters:
statement
- the query statementlanguage
- the languagebindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsed
-
executeQuery
public Result executeQuery(String statement, String language, Optional<Long> limit, Optional<Long> offset, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings) throws ParseException
Description copied from interface:QueryEngine
Execute a query and get the result.- Specified by:
executeQuery
in interfaceQueryEngine
- Parameters:
statement
- the query statementlanguage
- the languagelimit
- the maximum result set size (may not be negative but may be empty)offset
- the number of rows to skip (may not be negative but may be empty)bindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsed
-
executeQuery
public Result executeQuery(String statement, String language, long limit, long offset, Map<String,? extends PropertyValue> bindings, Map<String,String> mappings) throws ParseException
Description copied from interface:QueryEngine
Execute a query and get the result.- Specified by:
executeQuery
in interfaceQueryEngine
- Parameters:
statement
- the query statementlanguage
- the languagelimit
- the maximum result set size (may not be negative)offset
- the number of rows to skip (may not be negative)bindings
- the bind variable value bindingsmappings
- namespace prefix mappings- Returns:
- the result
- Throws:
ParseException
- if the statement could not be parsed
-
setTraversalEnabled
protected void setTraversalEnabled(boolean traversalEnabled)
-
setQuerySelectionMode
protected void setQuerySelectionMode(@NotNull @NotNull QueryEngineImpl.QuerySelectionMode querySelectionMode)
Instruct the query engine on how to behave with regards to the SQL2 optimised query if available.- Parameters:
querySelectionMode
- cannot be null
-
-