Return-Path: Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: (qmail 46941 invoked from network); 18 Mar 2011 13:05:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Mar 2011 13:05:16 -0000 Received: (qmail 62190 invoked by uid 500); 18 Mar 2011 13:05:16 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 62157 invoked by uid 500); 18 Mar 2011 13:05:16 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 62149 invoked by uid 99); 18 Mar 2011 13:05:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 13:05:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2011 13:05:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 05A0823889C5; Fri, 18 Mar 2011 13:04:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1082899 - /chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext Date: Fri, 18 Mar 2011 13:04:52 -0000 To: commits@chemistry.apache.org From: jens@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110318130453.05A0823889C5@eris.apache.org> Author: jens Date: Fri Mar 18 13:04:52 2011 New Revision: 1082899 URL: http://svn.apache.org/viewvc?rev=1082899&view=rev Log: add one more section to test failing page Modified: chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext Modified: chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext?rev=1082899&r1=1082898&r2=1082899&view=diff ============================================================================== --- chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext (original) +++ chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext Fri Mar 18 13:04:52 2011 @@ -80,3 +80,46 @@ Note: There is currently no predefined w you need to support JOINS you have to build your own walker for this part as outlined in the previous section. +## Using QueryObject + +The class `QueryObject` provides all the basic functionality for resolving +types and properties and performs common validation tasks. The `QueryObject` +processes the `SELECT` and `FROM` parts as well as all property references from +the `WHERE` part. It maintains a list of Java objects and interface that you +can use to access the property and type definitions given your current +position in the statement. For an example refer to the class +`StoreManagerImpl` of the InMemory Server and method `query()`. +To be able to use this object `QueryObj` needs to get access to the types contained in your +repository. For this purpose you need to pass an interface to a `TypeManager` +as input parameter. The second parameter is your query walker implementing +`IQueryConditionProcessor`. Your code will typically look like this: + + :::java + TypeManager tm = new MyTypeManager(); // implements interface TypeManager + + IQueryConditionProcessor myWalker = new MyWalker(); + // implements interface IQueryConditionProcessor + // or extends AbstractQueryConditionProcessor + + queryObj = new QueryObject(tm, myWalker); + + +`queryObj` then will process the statement and call the interface methods of +your walker: + + :::java + try { + + CmisQueryWalker walker = QueryObject.getWalker(statement); + walker.query(queryObj); + + } catch (RecognitionException e) { + throw new RuntimeException("Walking of statement failed with RecognitionException error:\n " + e); + } catch (Exception e) { + throw new RuntimeException("Walking of statement failed with exception:\n " + e); + } + + +After this method returns you may for example ask your walker object +`myWalker` for the generated SQL string. +