code: public void init(SessionImpl session, SessionDataManager itemMgr, QueryHandler handler, Node node)
        throws InvalidQueryException, RepositoryException
     {
        checkNotInitialized();
        this.session = session;
        this.node = node;
        this.handler = handler;
  
        if (!((ExtendedNode)node).isNodeType(Constants.NT_QUERY))
        {
           throw new InvalidQueryException("node is not of type nt:query");
        }
        statement = node.getProperty("jcr:statement").getString();
        language = node.getProperty("jcr:language").getString();
        query = handler.createExecutableQuery(session, itemMgr, statement, language);
        setInitialized();
     }
docs: {@inheritDoc}