Package org.apache.jackrabbit.core.query
Class QueryImpl
- java.lang.Object
-
- org.apache.jackrabbit.core.query.AbstractQueryImpl
-
- org.apache.jackrabbit.core.query.QueryImpl
-
- All Implemented Interfaces:
Query
- Direct Known Subclasses:
QueryObjectModelImpl
public class QueryImpl extends AbstractQueryImpl
Provides the default implementation for a JCR query.
-
-
Field Summary
Fields Modifier and Type Field Description protected QueryHandler
handler
The query handler for this query.protected String
language
The syntax of the query statementprotected long
limit
The maximum result sizeprotected Node
node
The node where this query is persisted.protected long
offset
The offset in the total result setprotected ExecutableQuery
query
The actual query implementation that can be executedprotected SessionContext
sessionContext
Component context of the current sessionprotected String
statement
The query statement
-
Constructor Summary
Constructors Constructor Description QueryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindValue(String varName, Value value)
Throws anIllegalArgumentException
as XPath and SQL1 queries have no bind variables.protected void
checkInitialized()
Checks if this query is initialized and throws anIllegalStateException
if it is not yet initialized.protected void
checkNotInitialized()
Checks if this query is not yet initialized and throws anIllegalStateException
if it is already initialized.QueryResult
execute()
This method simply forwards theexecute
call to theExecutableQuery
object returned byQueryHandler.createExecutableQuery(org.apache.jackrabbit.core.session.SessionContext, java.lang.String, java.lang.String)
.String[]
getBindVariableNames()
String
getLanguage()
String
getStatement()
String
getStoredQueryPath()
void
init(SessionContext sessionContext, QueryHandler handler, String statement, String language, Node node)
Initialises a query instance from a query string.protected void
setInitialized()
Sets the initialized flag.void
setLimit(long limit)
Sets the maximum size of the result set.void
setOffset(long offset)
Sets the start offset of the result set.Node
storeAsNode(String absPath)
-
-
-
Field Detail
-
sessionContext
protected SessionContext sessionContext
Component context of the current session
-
statement
protected String statement
The query statement
-
language
protected String language
The syntax of the query statement
-
query
protected ExecutableQuery query
The actual query implementation that can be executed
-
node
protected Node node
The node where this query is persisted. Only set when this is a persisted query.
-
handler
protected QueryHandler handler
The query handler for this query.
-
limit
protected long limit
The maximum result size
-
offset
protected long offset
The offset in the total result set
-
-
Method Detail
-
init
public void init(SessionContext sessionContext, QueryHandler handler, String statement, String language, Node node) throws InvalidQueryException
Initialises a query instance from a query string.- Specified by:
init
in classAbstractQueryImpl
- Parameters:
sessionContext
- component context of the current sessionhandler
- the query handler of the search index.statement
- the query statement.language
- the syntax of the query statement.node
- a nt:query node where the query was read from ornull
if it is not a stored query.- Throws:
InvalidQueryException
- if the query statement is invalid according to the specifiedlanguage
.
-
execute
public QueryResult execute() throws RepositoryException
This method simply forwards theexecute
call to theExecutableQuery
object returned byQueryHandler.createExecutableQuery(org.apache.jackrabbit.core.session.SessionContext, java.lang.String, java.lang.String)
.- Throws:
RepositoryException
-
getStatement
public String getStatement()
-
getLanguage
public String getLanguage()
-
getStoredQueryPath
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException
-
storeAsNode
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException
-
getBindVariableNames
public String[] getBindVariableNames()
-
bindValue
public void bindValue(String varName, Value value) throws IllegalArgumentException
Throws anIllegalArgumentException
as XPath and SQL1 queries have no bind variables.- Throws:
IllegalArgumentException
- always thrown
-
setLimit
public void setLimit(long limit)
Sets the maximum size of the result set.- Parameters:
limit
- new maximum size of the result set
-
setOffset
public void setOffset(long offset)
Sets the start offset of the result set.- Parameters:
offset
- new start offset of the result set
-
setInitialized
protected void setInitialized()
Sets the initialized flag.
-
checkNotInitialized
protected void checkNotInitialized()
Checks if this query is not yet initialized and throws anIllegalStateException
if it is already initialized.
-
checkInitialized
protected void checkInitialized()
Checks if this query is initialized and throws anIllegalStateException
if it is not yet initialized.
-
-