chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r963193 [1/3] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-inmemory/ chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ chemistry-opencmis-server-inmemor...
Date Mon, 12 Jul 2010 06:41:50 GMT
Author: jens
Date: Mon Jul 12 06:41:49 2010
New Revision: 963193

URL: http://svn.apache.org/viewvc?rev=963193&view=rev
Log:
Put common query parts in server-support sub-project

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ExtensionSample.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisBaseGrammar.g
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlExtParser.g
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictParser.g
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQueryWalker.g
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeManager.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/AbstractQueryConditionProcessor.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/CmisSelector.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/ColumnReference.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/FunctionReference.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryConditionProcessor.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/AbstractParserTst.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserExt.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/pom.xml Mon Jul 12 06:41:49 2010
@@ -52,22 +52,7 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.antlr</groupId>
-                <artifactId>antlr3-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <!-- default phase: process-sources -->
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>antlr</goal>
-                        </goals>
-                        <configuration>
-                            <libDirectory>target/generated-sources/antlr3/org/apache/chemistry/opencmis/server/support/query</libDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
+
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-war-plugin</artifactId>

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java Mon Jul 12 06:41:49 2010
@@ -37,6 +37,7 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.server.support.TypeManager;
 
 /**
  * Class that manages a type system for a repository types can be added, the

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java Mon Jul 12 06:41:49 2010
@@ -18,7 +18,6 @@
  */
 package org.apache.chemistry.opencmis.inmemory.query;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
@@ -31,14 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
 
-import org.antlr.runtime.ANTLRInputStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
 import org.antlr.runtime.RecognitionException;
-import org.antlr.runtime.TokenSource;
-import org.antlr.runtime.TokenStream;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.CommonTreeNodeStream;
 import org.antlr.runtime.tree.Tree;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.ObjectList;
@@ -49,8 +41,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.PropertyType;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
-import org.apache.chemistry.opencmis.inmemory.TypeManager;
-import org.apache.chemistry.opencmis.inmemory.query.QueryObject.SortSpec;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
@@ -59,7 +49,15 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ObjectStoreImpl;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
-import org.apache.chemistry.opencmis.server.support.query.CalendarHelper;
+import org.apache.chemistry.opencmis.server.support.TypeManager;
+import org.apache.chemistry.opencmis.server.support.query.AbstractQueryConditionProcessor;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
+import org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker;
+import org.apache.chemistry.opencmis.server.support.query.CmisSelector;
+import org.apache.chemistry.opencmis.server.support.query.ColumnReference;
+import org.apache.chemistry.opencmis.server.support.query.FunctionReference;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -72,15 +70,13 @@ import org.apache.commons.logging.LogFac
  * @author Jens
  *
  */
-public class InMemoryQueryProcessor implements IQueryConditionProcessor {
+public class InMemoryQueryProcessor extends AbstractQueryConditionProcessor {
 
     private static Log LOG = LogFactory.getLog(InMemoryQueryProcessor.class);
     
     private List<StoredObject> matches = new ArrayList<StoredObject>();
     private QueryObject queryObj;
     private Tree whereTree;
-    private CommonTree parserTree; // the ANTLR tree after parsing phase
-    private CommonTree walkerTree; // the ANTLR tree after walking phase
     
     public InMemoryQueryProcessor() {
     }
@@ -107,33 +103,15 @@ public class InMemoryQueryProcessor impl
         return objList;
     }        
 
-    private CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
-        CharStream input = new ANTLRInputStream(new ByteArrayInputStream(statement.getBytes("UTF-8")));
-        TokenSource lexer = new CMISQLLexerStrict(input);
-        TokenStream tokens = new CommonTokenStream(lexer);
-        CMISQLParserStrict parser = new CMISQLParserStrict(tokens);
-
-        CMISQLParserStrict.query_return parsedStatement = parser.query();
-        if (parser.errorMessage != null) {
-            throw new RuntimeException("Cannot parse query: " + statement + " (" + parser.errorMessage + ")");
-        }
-        parserTree = (CommonTree) parsedStatement.getTree();            
-
-        CommonTreeNodeStream nodes = new CommonTreeNodeStream(parserTree);
-        nodes.setTokenStream(tokens);
-        CmisQueryWalker walker = new CmisQueryWalker(nodes);
-        return walker;
-    }
-
     public CmisQueryWalker processQuery(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
-        CmisQueryWalker walker = getWalker(statement);
+        CmisQueryWalker walker = AbstractQueryConditionProcessor.getWalker(statement);
         walker.query(queryObj);
         String errMsg = walker.getErrorMessageString();
         if (null != errMsg) {
             throw new RuntimeException("Walking of statement failed with error: \n   " + errMsg + 
                     "\n   Statement was: " + statement);
         }
-        walkerTree = (CommonTree) walker.getTreeNodeStream().getTreeSource();
+        /*CommonTree walkerTree = (CommonTree) */ walker.getTreeNodeStream().getTreeSource();
         return walker;
     }
 
@@ -388,85 +366,85 @@ public class InMemoryQueryProcessor impl
         boolean matches = true;
 
         switch (node.getType()) {
-        case CMISQLLexerStrict.WHERE:
+        case CmisQlStrictLexer.WHERE:
             matches = evalWhereNode(so, node.getChild(0));
             break; // ignore
-        case CMISQLLexerStrict.EQ:
+        case CmisQlStrictLexer.EQ:
             matches = evalWhereEquals(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.NEQ:
+        case CmisQlStrictLexer.NEQ:
             matches = evalWhereNotEquals(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.GT:
+        case CmisQlStrictLexer.GT:
             matches = evalWhereGreaterThan(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.GTEQ:
+        case CmisQlStrictLexer.GTEQ:
             matches = evalWhereGreaterOrEquals(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.LT:
+        case CmisQlStrictLexer.LT:
             matches = evalWhereLessThan(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.LTEQ:
+        case CmisQlStrictLexer.LTEQ:
             matches = evalWhereLessOrEquals(so, node, node.getChild(0), node.getChild(1));
             break;
 
-        case CMISQLLexerStrict.NOT:
+        case CmisQlStrictLexer.NOT:
             matches = evalWhereNot(so, node, node.getChild(0));
             break;
-        case CMISQLLexerStrict.AND:
+        case CmisQlStrictLexer.AND:
             matches = evalWhereAnd(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.OR:
+        case CmisQlStrictLexer.OR:
             matches = evalWhereOr(so, node, node.getChild(0), node.getChild(1));
             break;
 
         // Multi-value:
-        case CMISQLLexerStrict.IN:
+        case CmisQlStrictLexer.IN:
             matches = evalWhereIn(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.NOT_IN:
+        case CmisQlStrictLexer.NOT_IN:
             matches = evalWhereNotIn(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.IN_ANY:
+        case CmisQlStrictLexer.IN_ANY:
             matches = evalWhereInAny(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.NOT_IN_ANY:
+        case CmisQlStrictLexer.NOT_IN_ANY:
             matches = evalWhereNotInAny(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.EQ_ANY:
+        case CmisQlStrictLexer.EQ_ANY:
             matches = evalWhereEqAny(so, node, node.getChild(0), node.getChild(1));
             break;
 
         // Null comparisons:
-        case CMISQLLexerStrict.IS_NULL:
+        case CmisQlStrictLexer.IS_NULL:
             matches = evalWhereIsNull(so, node, node.getChild(0));
             break;
-        case CMISQLLexerStrict.IS_NOT_NULL:
+        case CmisQlStrictLexer.IS_NOT_NULL:
             matches = evalWhereIsNotNull(so, node, node.getChild(0));
             break;
 
         // String matching
-        case CMISQLLexerStrict.LIKE:
+        case CmisQlStrictLexer.LIKE:
             matches = evalWhereIsLike(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.NOT_LIKE:
+        case CmisQlStrictLexer.NOT_LIKE:
             matches = evalWhereIsNotLike(so, node, node.getChild(0), node.getChild(1));
             break;
 
         // Functions
-        case CMISQLLexerStrict.CONTAINS:
+        case CmisQlStrictLexer.CONTAINS:
             if (node.getChildCount() == 1)
                 matches = evalWhereContains(so, node, null, node.getChild(0));
             else
                 matches = evalWhereContains(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.IN_FOLDER:
+        case CmisQlStrictLexer.IN_FOLDER:
             if (node.getChildCount() == 1)
                 matches = evalWhereInFolder(so, node, null, node.getChild(0));
             else
                 matches = evalWhereInFolder(so, node, node.getChild(0), node.getChild(1));
             break;
-        case CMISQLLexerStrict.IN_TREE:
+        case CmisQlStrictLexer.IN_TREE:
             if (node.getChildCount() == 1)
                 matches = evalWhereInTree(so, node, null, node.getChild(0));
             else
@@ -742,37 +720,6 @@ public class InMemoryQueryProcessor impl
         return false;
     }
 
-    private Object onLiteral(Tree node) {
-        int type = node.getType();
-        String text = node.getText();
-        switch (type) {
-        case CMISQLLexerStrict.BOOL_LIT:
-            return Boolean.parseBoolean(node.getText());
-        case CMISQLLexerStrict.NUM_LIT:
-            if (text.contains(".") || text.contains("e") || text.contains("E"))
-                return Double.parseDouble(text);
-            else    
-                return Long.parseLong(text);
-        case CMISQLLexerStrict.STRING_LIT:
-            return text.substring(1, text.length()-1);
-        case CMISQLLexerStrict.TIME_LIT:
-            GregorianCalendar gc = CalendarHelper.fromString(text.substring(text.indexOf('\'')+1, text.lastIndexOf('\'')));
-            return gc; 
-        default:
-            LOG.error("Unknown literal. " + node);
-            return null;
-        }
-    }
- 
-    private List<Object> onLiteralList(Tree node) {
-        List<Object> res = new ArrayList<Object>(node.getChildCount());
-        for (int i=0; i<node.getChildCount(); i++) {
-            Tree literal =  node.getChild(i);
-            res.add(onLiteral(literal));
-        }
-        return res;
-    }
-    
     private Integer compareTo(StoredObject so, Tree leftChild, Tree rightChild) {
         Object rVal = onLiteral(rightChild);
         

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java Mon Jul 12 06:41:49 2010
@@ -30,6 +30,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.inmemory.TypeManager;
 import org.apache.chemistry.opencmis.inmemory.TypeValidator;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -414,90 +415,90 @@ public class QueryObject {
         // Ensure that we receive only valid tokens and nodes in the where clause:
             LOG.debug("evaluating node: " + node.toString());
             switch (node.getType()) {
-            case CMISQLLexerStrict.WHERE:;
+            case CmisQlStrictLexer.WHERE:;
                 break; // ignore
-            case CMISQLLexerStrict.EQ:
+            case CmisQlStrictLexer.EQ:
                 queryProcessor.onEquals(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.NEQ:
+            case CmisQlStrictLexer.NEQ:
                 queryProcessor.onNotEquals(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.GT:
+            case CmisQlStrictLexer.GT:
                 queryProcessor.onGreaterThan(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.GTEQ:
+            case CmisQlStrictLexer.GTEQ:
                 queryProcessor.onGreaterOrEquals(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.LT:
+            case CmisQlStrictLexer.LT:
                 queryProcessor.onLessThan(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.LTEQ:
+            case CmisQlStrictLexer.LTEQ:
                 queryProcessor.onLessOrEquals(node, node.getChild(0), node.getChild(1));
                 break;
                 
-            case CMISQLLexerStrict.NOT:
+            case CmisQlStrictLexer.NOT:
                 queryProcessor.onNot(node, node.getChild(0));
                 break;
-            case CMISQLLexerStrict.AND:
+            case CmisQlStrictLexer.AND:
                 queryProcessor.onAnd(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.OR:
+            case CmisQlStrictLexer.OR:
                 queryProcessor.onOr(node, node.getChild(0), node.getChild(1));
                 break;
                 
             // Multi-value:
-            case CMISQLLexerStrict.IN:
+            case CmisQlStrictLexer.IN:
                 queryProcessor.onIn(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.NOT_IN:
+            case CmisQlStrictLexer.NOT_IN:
                 queryProcessor.onNotIn(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.IN_ANY:
+            case CmisQlStrictLexer.IN_ANY:
                 queryProcessor.onInAny(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.NOT_IN_ANY:
+            case CmisQlStrictLexer.NOT_IN_ANY:
                 queryProcessor.onNotInAny(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.EQ_ANY:
+            case CmisQlStrictLexer.EQ_ANY:
                 queryProcessor.onEqAny(node, node.getChild(0), node.getChild(1));
                 break;
 
             // Null comparisons:
-            case CMISQLLexerStrict.IS_NULL:
+            case CmisQlStrictLexer.IS_NULL:
                 queryProcessor.onIsNull(node, node.getChild(0));
                 break;
-            case CMISQLLexerStrict.IS_NOT_NULL:
+            case CmisQlStrictLexer.IS_NOT_NULL:
                 queryProcessor.onIsNotNull(node, node.getChild(0));
                 break;
 
                 // String matching
-            case CMISQLLexerStrict.LIKE:
+            case CmisQlStrictLexer.LIKE:
                 queryProcessor.onIsLike(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.NOT_LIKE:
+            case CmisQlStrictLexer.NOT_LIKE:
                 queryProcessor.onIsNotLike(node, node.getChild(0), node.getChild(1));
                 break;
 
                 // Functions
-            case CMISQLLexerStrict.CONTAINS:
+            case CmisQlStrictLexer.CONTAINS:
                 if (node.getChildCount()==1)
                     queryProcessor.onContains(node, null, node.getChild(0));
                 else
                     queryProcessor.onContains(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.IN_FOLDER:
+            case CmisQlStrictLexer.IN_FOLDER:
                 if (node.getChildCount()==1)
                     queryProcessor.onInFolder(node, null, node.getChild(0));
                 else
                     queryProcessor.onInFolder(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.IN_TREE:
+            case CmisQlStrictLexer.IN_TREE:
                 if (node.getChildCount()==1)
                     queryProcessor.onInTree(node, null, node.getChild(0));
                 else
                     queryProcessor.onInTree(node, node.getChild(0), node.getChild(1));
                 break;
-            case CMISQLLexerStrict.SCORE:
+            case CmisQlStrictLexer.SCORE:
                 queryProcessor.onScore(node, node.getChild(0));
                 break;
                 

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ExtensionSample.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ExtensionSample.java?rev=963193&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ExtensionSample.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ExtensionSample.java Mon Jul 12 06:41:49 2010
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.inmemory.server;
+
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "cmisExtensionType", propOrder = {
+    "s", "i", "f"
+})
+public class ExtensionSample {
+    private String s;
+    private int i;
+    private double f;
+    
+    public ExtensionSample() {
+        s = "This is an example for a CMIS extension.";
+        i = 42;
+        f = Math.PI;            
+    }
+    
+    public String getString() {
+        return s;
+    }
+    
+    public int getInt() {
+        return i;
+    }
+
+    public double getDouble() {
+        return f;
+    }
+}

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Mon Jul 12 06:41:49 2010
@@ -60,7 +60,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
-import org.apache.chemistry.opencmis.inmemory.TypeValidator;
 import org.apache.chemistry.opencmis.inmemory.NameValidator;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Content;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
@@ -76,6 +75,7 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
+import org.apache.chemistry.opencmis.server.support.TypeValidator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java Mon Jul 12 06:41:49 2010
@@ -27,7 +27,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
-import org.apache.chemistry.opencmis.inmemory.TypeManager;
+import org.apache.chemistry.opencmis.server.support.TypeManager;
 
 /**
  * interface to a repository implementation. This interface is the entry point

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Mon Jul 12 06:41:49 2010
@@ -47,11 +47,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.RepositoryInfoCreator;
 import org.apache.chemistry.opencmis.inmemory.TypeCreator;
-import org.apache.chemistry.opencmis.inmemory.TypeManager;
 import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
 import org.apache.chemistry.opencmis.inmemory.query.InMemoryQueryProcessor;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
+import org.apache.chemistry.opencmis.server.support.TypeManager;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java Mon Jul 12 06:41:49 2010
@@ -49,6 +49,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
+import org.apache.chemistry.opencmis.server.support.TypeManager;
+import org.apache.chemistry.opencmis.server.support.TypeValidator;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java Mon Jul 12 06:41:49 2010
@@ -46,7 +46,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
-import org.apache.chemistry.opencmis.server.support.query.CMISQLParser;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictParser;
+import org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictParser_CmisBaseGrammar.query_return;
 
 public abstract class AbstractQueryTest {
 
@@ -76,14 +80,14 @@ public abstract class AbstractQueryTest 
 
     protected CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
         CharStream input = new ANTLRInputStream(new ByteArrayInputStream(statement.getBytes("UTF-8")));
-        TokenSource lexer = new CMISQLLexerStrict(input);
+        TokenSource lexer = new CmisQlStrictLexer(input);
         TokenStream tokens = new CommonTokenStream(lexer);
-        CMISQLParserStrict parser = new CMISQLParserStrict(tokens);
+        CmisQlStrictParser parser = new CmisQlStrictParser(tokens);
 
-        CMISQLParserStrict.query_return parsedStatement = parser.query();
-        if (parser.errorMessage != null) {
-            throw new RuntimeException("Cannot parse query: " + statement + " (" + parser.errorMessage + ")");
-        }
+        query_return parsedStatement = parser.query();
+//        if (parser.errorMessage != null) {
+//            throw new RuntimeException("Cannot parse query: " + statement + " (" + parser.errorMessage + ")");
+//        }
         parserTree = (CommonTree) parsedStatement.getTree();            
         // printTree(tree);
 
@@ -121,7 +125,7 @@ public abstract class AbstractQueryTest 
         int count = root.getChildCount();
         for (int i=0; i<count; i++) {
             Tree child = root.getChild(i);
-            if (child.getType() == CMISQLLexerStrict.WHERE) {
+            if (child.getType() == CmisQlStrictLexer.WHERE) {
                 return child;
             }
         }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java Mon Jul 12 06:41:49 2010
@@ -32,6 +32,9 @@ import org.antlr.runtime.tree.Tree;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
 import org.apache.chemistry.opencmis.server.support.query.CalendarHelper;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
+import org.apache.chemistry.opencmis.server.support.query.QueryConditionProcessor;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.After;
@@ -40,7 +43,7 @@ import org.junit.Test;
 
 public class ProcessQueryTest extends AbstractQueryTest {
     
-    static private class TestQueryProcessor implements IQueryConditionProcessor {
+    static private class TestQueryProcessor implements QueryConditionProcessor {
 
         private static Log log = LogFactory.getLog(ProcessQueryTest.class);
         
@@ -107,7 +110,7 @@ public class ProcessQueryTest extends Ab
        public void onStartProcessing(Tree node) {
             log.debug("TestQueryProcessor:onStartProcessing()");
             rulesTrackerMap.put(ON_START, true);
-            assertEquals(CMISQLLexerStrict.WHERE, node.getType());
+            assertEquals(CmisQlStrictLexer.WHERE, node.getType());
        }
 
        public void onStopProcessing() {
@@ -118,15 +121,15 @@ public class ProcessQueryTest extends Ab
 
        public void onEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_EQUALS_WASCALLED, true);
-           assertEquals(CMISQLLexerStrict.EQ, eqNode.getType());
-           assertTrue(CMISQLLexerStrict.COL==leftNode.getType() || CMISQLLexerStrict.SCORE==leftNode.getType());
+           assertEquals(CmisQlStrictLexer.EQ, eqNode.getType());
+           assertTrue(CmisQlStrictLexer.COL==leftNode.getType() || CmisQlStrictLexer.SCORE==leftNode.getType());
            assertTrue(isLiteral(rightNode));
        }
 
        public void onNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_NOT_EQUALS, true);
-           assertEquals(CMISQLLexerStrict.NEQ, neNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, leftNode.getType());
+           assertEquals(CmisQlStrictLexer.NEQ, neNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
            assertTrue(isLiteral(rightNode));
            Object value=onLiteral(rightNode, Integer.class);
            assertEquals(100, value);            
@@ -134,8 +137,8 @@ public class ProcessQueryTest extends Ab
 
        public void onLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_LESS_OR_EQUALS, true);
-           assertEquals(CMISQLLexerStrict.LTEQ, leqNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, leftNode.getType());
+           assertEquals(CmisQlStrictLexer.LTEQ, leqNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
            assertTrue(isLiteral(rightNode));
            Object value=onLiteral(rightNode, Integer.class);
            assertEquals(100, value);            
@@ -143,8 +146,8 @@ public class ProcessQueryTest extends Ab
 
        public void onLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_LESS_THAN, true);
-           assertEquals(CMISQLLexerStrict.LT, ltNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, leftNode.getType());
+           assertEquals(CmisQlStrictLexer.LT, ltNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
            assertTrue(isLiteral(rightNode));
            Object value=onLiteral(rightNode, Integer.class);
            assertEquals(100, value);            
@@ -152,8 +155,8 @@ public class ProcessQueryTest extends Ab
 
        public void onGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_GREATER_OR_EQUALS, true);
-           assertEquals(CMISQLLexerStrict.GTEQ, geNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, leftNode.getType());
+           assertEquals(CmisQlStrictLexer.GTEQ, geNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
            assertTrue(isLiteral(rightNode));
            Object value=onLiteral(rightNode, Integer.class);
            assertEquals(100, value);            
@@ -161,8 +164,8 @@ public class ProcessQueryTest extends Ab
 
        public void onGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
            rulesTrackerMap.put(ON_GREATER_THAN, true);
-           assertEquals(CMISQLLexerStrict.GT, gtNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, leftNode.getType());
+           assertEquals(CmisQlStrictLexer.GT, gtNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
            assertTrue(isLiteral(rightNode));
            Object value=onLiteral(rightNode, Integer.class);
            assertEquals(100, value);            
@@ -170,23 +173,23 @@ public class ProcessQueryTest extends Ab
 
        public void onNot(Tree opNode, Tree leftNode) {
            rulesTrackerMap.put(ON_NOT, true);
-           assertEquals(CMISQLLexerStrict.NOT, opNode.getType());
+           assertEquals(CmisQlStrictLexer.NOT, opNode.getType());
        }
 
        public void onAnd(Tree opNode, Tree leftNode, Tree rightNode) {
-           assertEquals(CMISQLLexerStrict.AND, opNode.getType());
+           assertEquals(CmisQlStrictLexer.AND, opNode.getType());
            rulesTrackerMap.put(ON_AND, true);
        }
 
        public void onOr(Tree opNode, Tree leftNode, Tree rightNode) {
-           assertEquals(CMISQLLexerStrict.OR, opNode.getType());
+           assertEquals(CmisQlStrictLexer.OR, opNode.getType());
            rulesTrackerMap.put(ON_OR, true);
        }
 
        public void onIn(Tree opNode, Tree colNode, Tree listNode) {
-           assertEquals(CMISQLLexerStrict.IN, opNode.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IN_LIST, listNode.getType());
+           assertEquals(CmisQlStrictLexer.IN, opNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
            Object value=onLiteral(listNode.getChild(0), String.class);
            assertEquals("'Joe'", value);            
            value=onLiteral(listNode.getChild(1), String.class);
@@ -195,9 +198,9 @@ public class ProcessQueryTest extends Ab
        }
 
        public void onNotIn(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CMISQLLexerStrict.NOT_IN, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IN_LIST, listNode.getType());
+           assertEquals(CmisQlStrictLexer.NOT_IN, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
            Object value=onLiteral(listNode.getChild(0), String.class);
            assertEquals("'Joe'", value);            
            value=onLiteral(listNode.getChild(1), String.class);
@@ -206,8 +209,8 @@ public class ProcessQueryTest extends Ab
        }
 
        public void onEqAny(Tree node, Tree literalNode, Tree colNode) {
-           assertEquals(CMISQLLexerStrict.EQ_ANY, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.EQ_ANY, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
            assertTrue(isLiteral(literalNode));
            Object value=onLiteral(literalNode, String.class);
            assertEquals("'Joe'", value);            
@@ -215,9 +218,9 @@ public class ProcessQueryTest extends Ab
        }
 
        public void onInAny(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CMISQLLexerStrict.IN_ANY, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IN_LIST, listNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_ANY, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
            Object value=onLiteral(listNode.getChild(0), String.class);
            assertEquals("'Joe'", value);            
            value=onLiteral(listNode.getChild(1), String.class);
@@ -226,9 +229,9 @@ public class ProcessQueryTest extends Ab
        }
 
        public void onNotInAny(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CMISQLLexerStrict.NOT_IN_ANY, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IN_LIST, listNode.getType());
+           assertEquals(CmisQlStrictLexer.NOT_IN_ANY, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
            Object value=onLiteral(listNode.getChild(0), String.class);
            assertEquals("'Joe'", value);            
            value=onLiteral(listNode.getChild(1), String.class);
@@ -237,58 +240,58 @@ public class ProcessQueryTest extends Ab
        }
 
        public void onIsNull(Tree nullNode, Tree colNode) {
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IS_NULL, nullNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IS_NULL, nullNode.getType());
            rulesTrackerMap.put(ON_IS_NULL, true);
        }
 
        public void onIsNotNull(Tree notNullNode, Tree colNode) {
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.IS_NOT_NULL, notNullNode.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.IS_NOT_NULL, notNullNode.getType());
            rulesTrackerMap.put(ON_IS_NOT_NULL, true);
        }
 
        public void onIsLike(Tree node, Tree colNode, Tree stringNode) {
-           assertEquals(CMISQLLexerStrict.LIKE, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.STRING_LIT, stringNode.getType());
+           assertEquals(CmisQlStrictLexer.LIKE, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
            Object value=onLiteral(stringNode, String.class);
            assertEquals("'Harry*'", value);            
            rulesTrackerMap.put(ON_IS_LIKE, true);
        }
 
        public void onIsNotLike(Tree node, Tree colNode, Tree stringNode) {
-           assertEquals(CMISQLLexerStrict.NOT_LIKE, node.getType());
-           assertEquals(CMISQLLexerStrict.COL, colNode.getType());
-           assertEquals(CMISQLLexerStrict.STRING_LIT, stringNode.getType());
+           assertEquals(CmisQlStrictLexer.NOT_LIKE, node.getType());
+           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+           assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
            Object value=onLiteral(stringNode, String.class);
            assertEquals("'Harry*'", value);            
            rulesTrackerMap.put(ON_IS_NOT_LIKE, true);
        }
 
        public void onContains(Tree node, Tree colNode, Tree paramNode) {
-           assertEquals(CMISQLLexerStrict.CONTAINS, node.getType());
-           assertTrue(colNode==null || CMISQLLexerStrict.STRING_LIT == paramNode.getType());
-           assertEquals(CMISQLLexerStrict.STRING_LIT, paramNode.getType());
+           assertEquals(CmisQlStrictLexer.CONTAINS, node.getType());
+           assertTrue(colNode==null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
+           assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
            rulesTrackerMap.put(ON_CONTAINS, true);
        }
 
        public void onInFolder(Tree node, Tree colNode, Tree paramNode) {
-           assertEquals(CMISQLLexerStrict.IN_FOLDER, node.getType());
-           assertTrue(colNode==null || CMISQLLexerStrict.STRING_LIT == paramNode.getType());
-           assertEquals(CMISQLLexerStrict.STRING_LIT, paramNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_FOLDER, node.getType());
+           assertTrue(colNode==null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
+           assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
            rulesTrackerMap.put(ON_IN_FOLDER, true);
        }
 
        public void onInTree(Tree node, Tree colNode, Tree paramNode) {
-           assertEquals(CMISQLLexerStrict.IN_TREE, node.getType());
-           assertTrue(colNode==null || CMISQLLexerStrict.STRING_LIT == paramNode.getType());
-           assertEquals(CMISQLLexerStrict.STRING_LIT, paramNode.getType());
+           assertEquals(CmisQlStrictLexer.IN_TREE, node.getType());
+           assertTrue(colNode==null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
+           assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
            rulesTrackerMap.put(ON_IN_TREE, true);
        }
 
        public void onScore(Tree node, Tree paramNode) {
-           assertEquals(CMISQLLexerStrict.SCORE, node.getType());
+           assertEquals(CmisQlStrictLexer.SCORE, node.getType());
            rulesTrackerMap.put(ON_SCORE, true);
        }
 
@@ -297,16 +300,16 @@ public class ProcessQueryTest extends Ab
 
        private boolean isLiteral(Tree node) {
            int type = node.getType();
-           return type==CMISQLLexerStrict.BOOL_LIT || type==CMISQLLexerStrict.NUM_LIT ||
-           type==CMISQLLexerStrict.STRING_LIT || type==CMISQLLexerStrict.TIME_LIT;
+           return type==CmisQlStrictLexer.BOOL_LIT || type==CmisQlStrictLexer.NUM_LIT ||
+           type==CmisQlStrictLexer.STRING_LIT || type==CmisQlStrictLexer.TIME_LIT;
        }
 
        private Object onLiteral(Tree node, Class<?> clazz) {
            int type = node.getType();
            switch (type) {
-           case CMISQLLexerStrict.BOOL_LIT:
+           case CmisQlStrictLexer.BOOL_LIT:
                return clazz==Boolean.class ? Boolean.parseBoolean(node.getText()) : null;
-           case CMISQLLexerStrict.NUM_LIT:
+           case CmisQlStrictLexer.NUM_LIT:
                if (clazz == Integer.class)
                    return Integer.parseInt(node.getText());
                else if (clazz == Long.class)
@@ -318,9 +321,9 @@ public class ProcessQueryTest extends Ab
                else if (clazz == Float.class)
                    return Float.parseFloat(node.getText());
                else return null;
-           case CMISQLLexerStrict.STRING_LIT:
+           case CmisQlStrictLexer.STRING_LIT:
                return clazz==String.class ? node.getText() : null;
-           case CMISQLLexerStrict.TIME_LIT:
+           case CmisQlStrictLexer.TIME_LIT:
                return clazz==GregorianCalendar.class ?  CalendarHelper.fromString(node.getText()) : null; 
            default:
                log.error("Unknown literal. " + node);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java Mon Jul 12 06:41:49 2010
@@ -31,7 +31,14 @@ import org.antlr.runtime.MismatchedToken
 import org.antlr.runtime.RecognitionException;
 import org.antlr.runtime.tree.CommonTree;
 import org.antlr.runtime.tree.Tree;
-import org.apache.chemistry.opencmis.inmemory.query.QueryObject.SortSpec;
+import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
+import org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker;
+import org.apache.chemistry.opencmis.server.support.query.CmisSelector;
+import org.apache.chemistry.opencmis.server.support.query.ColumnReference;
+import org.apache.chemistry.opencmis.server.support.query.FunctionReference;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject;
+import org.apache.chemistry.opencmis.server.support.query.FunctionReference.CmisQlFunction;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.After;
@@ -521,80 +528,80 @@ public class QueryParseTest extends Abst
        
     private String printNode(Tree node) {
         switch (node.getType()) {
-        case CMISQLLexerStrict.TABLE:
+        case CmisQlStrictLexer.TABLE:
             return "#TABLE";
-        case CMISQLLexerStrict.COL:
+        case CmisQlStrictLexer.COL:
             return "#COL";
-        case CMISQLLexerStrict.IN_LIST:
+        case CmisQlStrictLexer.IN_LIST:
             return "#IN_LIST";
-        case CMISQLLexerStrict.SEL_LIST:
+        case CmisQlStrictLexer.SEL_LIST:
             return "#SEL_LIST";
-        case CMISQLLexerStrict.EQ_ANY:
+        case CmisQlStrictLexer.EQ_ANY:
             return "#EQ_ANY";
-        case CMISQLLexerStrict.NOT_LIKE:
+        case CmisQlStrictLexer.NOT_LIKE:
             return "#NOT_LIKE";
-        case CMISQLLexerStrict.NOT_IN:
+        case CmisQlStrictLexer.NOT_IN:
             return "#NOT_IN";
-        case CMISQLLexerStrict.IN_ANY:
+        case CmisQlStrictLexer.IN_ANY:
             return "#IN_ANY";
-        case CMISQLLexerStrict.NOT_IN_ANY:
+        case CmisQlStrictLexer.NOT_IN_ANY:
             return "#NOT_IN_ANY";
-        case CMISQLLexerStrict.IS_NULL:
+        case CmisQlStrictLexer.IS_NULL:
             return "#IS_NULL";
-        case CMISQLLexerStrict.IS_NOT_NULL:
+        case CmisQlStrictLexer.IS_NOT_NULL:
             return "#IS_NOT_NULL";
-        case CMISQLLexerStrict.ORDER_BY:
+        case CmisQlStrictLexer.ORDER_BY:
             return "#ORDER_BY";
           
-        case CMISQLLexerStrict.WHERE:;
-        case CMISQLLexerStrict.LT:
-        case CMISQLLexerStrict.STAR:
-        case CMISQLLexerStrict.BOOL_LIT:
-        case CMISQLLexerStrict.INNER:
-        case CMISQLLexerStrict.TIME_LIT:
-        case CMISQLLexerStrict.ORDER:
-        case CMISQLLexerStrict.STRING_LIT:
-        case CMISQLLexerStrict.CONTAINS:
-        case CMISQLLexerStrict.ExactNumLit:
-        case CMISQLLexerStrict.LTEQ:
-        case CMISQLLexerStrict.NOT:
-        case CMISQLLexerStrict.ID:
-        case CMISQLLexerStrict.AND:
-        case CMISQLLexerStrict.EOF:
-        case CMISQLLexerStrict.AS:
-        case CMISQLLexerStrict.IN:
-        case CMISQLLexerStrict.LPAR:
-        case CMISQLLexerStrict.Digits:
-        case CMISQLLexerStrict.COMMA:
-        case CMISQLLexerStrict.IS:
-        case CMISQLLexerStrict.LEFT:
-        case CMISQLLexerStrict.Sign:
-        case CMISQLLexerStrict.EQ:
-        case CMISQLLexerStrict.DOT:
-        case CMISQLLexerStrict.NUM_LIT:
-        case CMISQLLexerStrict.SELECT:
-        case CMISQLLexerStrict.LIKE:
-        case CMISQLLexerStrict.OUTER:
-        case CMISQLLexerStrict.BY:
-        case CMISQLLexerStrict.ASC:
-        case CMISQLLexerStrict.NULL:
-        case CMISQLLexerStrict.ON:
-        case CMISQLLexerStrict.RIGHT:
-        case CMISQLLexerStrict.GTEQ:
-        case CMISQLLexerStrict.ApproxNumLit:
-        case CMISQLLexerStrict.JOIN:
-        case CMISQLLexerStrict.IN_FOLDER:
-        case CMISQLLexerStrict.WS:
-        case CMISQLLexerStrict.NEQ:
-        case CMISQLLexerStrict.ANY:
-        case CMISQLLexerStrict.SCORE:
-        case CMISQLLexerStrict.IN_TREE:
-        case CMISQLLexerStrict.OR:
-        case CMISQLLexerStrict.GT:
-        case CMISQLLexerStrict.RPAR:
-        case CMISQLLexerStrict.DESC:
-        case CMISQLLexerStrict.FROM:
-        case CMISQLLexerStrict.TIMESTAMP:
+        case CmisQlStrictLexer.WHERE:;
+        case CmisQlStrictLexer.LT:
+        case CmisQlStrictLexer.STAR:
+        case CmisQlStrictLexer.BOOL_LIT:
+        case CmisQlStrictLexer.INNER:
+        case CmisQlStrictLexer.TIME_LIT:
+        case CmisQlStrictLexer.ORDER:
+        case CmisQlStrictLexer.STRING_LIT:
+        case CmisQlStrictLexer.CONTAINS:
+        case CmisQlStrictLexer.ExactNumLit:
+        case CmisQlStrictLexer.LTEQ:
+        case CmisQlStrictLexer.NOT:
+        case CmisQlStrictLexer.ID:
+        case CmisQlStrictLexer.AND:
+        case CmisQlStrictLexer.EOF:
+        case CmisQlStrictLexer.AS:
+        case CmisQlStrictLexer.IN:
+        case CmisQlStrictLexer.LPAR:
+        case CmisQlStrictLexer.Digits:
+        case CmisQlStrictLexer.COMMA:
+        case CmisQlStrictLexer.IS:
+        case CmisQlStrictLexer.LEFT:
+        case CmisQlStrictLexer.Sign:
+        case CmisQlStrictLexer.EQ:
+        case CmisQlStrictLexer.DOT:
+        case CmisQlStrictLexer.NUM_LIT:
+        case CmisQlStrictLexer.SELECT:
+        case CmisQlStrictLexer.LIKE:
+        case CmisQlStrictLexer.OUTER:
+        case CmisQlStrictLexer.BY:
+        case CmisQlStrictLexer.ASC:
+        case CmisQlStrictLexer.NULL:
+        case CmisQlStrictLexer.ON:
+        case CmisQlStrictLexer.RIGHT:
+        case CmisQlStrictLexer.GTEQ:
+        case CmisQlStrictLexer.ApproxNumLit:
+        case CmisQlStrictLexer.JOIN:
+        case CmisQlStrictLexer.IN_FOLDER:
+        case CmisQlStrictLexer.WS:
+        case CmisQlStrictLexer.NEQ:
+        case CmisQlStrictLexer.ANY:
+        case CmisQlStrictLexer.SCORE:
+        case CmisQlStrictLexer.IN_TREE:
+        case CmisQlStrictLexer.OR:
+        case CmisQlStrictLexer.GT:
+        case CmisQlStrictLexer.RPAR:
+        case CmisQlStrictLexer.DESC:
+        case CmisQlStrictLexer.FROM:
+        case CmisQlStrictLexer.TIMESTAMP:
             return node.toString();
         default:
             return "[Unknown token: " + node.toString() + "]";
@@ -606,101 +613,101 @@ public class QueryParseTest extends Abst
     private void evaluateWhereNode(Tree node) {
         System.out.println("evaluating node: " + node.toString());
         switch (node.getType()) {
-        case CMISQLLexerStrict.WHERE:;
+        case CmisQlStrictLexer.WHERE:;
             break; // ignore
-        case CMISQLLexerStrict.COL:
+        case CmisQlStrictLexer.COL:
             evalColumn(node);
-        case CMISQLLexerStrict.IN_LIST:
+        case CmisQlStrictLexer.IN_LIST:
             evalInList(node);
             break;
-        case CMISQLLexerStrict.IN_ANY:
+        case CmisQlStrictLexer.IN_ANY:
             evalInAny(node);
             break;
-        case CMISQLLexerStrict.EQ_ANY:
+        case CmisQlStrictLexer.EQ_ANY:
             evalEqAny(node);
             break;
-        case CMISQLLexerStrict.NOT_LIKE:
+        case CmisQlStrictLexer.NOT_LIKE:
             evalNotLike(node);
             break;
-        case CMISQLLexerStrict.NOT_IN:
+        case CmisQlStrictLexer.NOT_IN:
             evalNotIn(node);
             break;
-        case CMISQLLexerStrict.IS_NULL:
+        case CmisQlStrictLexer.IS_NULL:
             evalIsNull(node);
             break;
-        case CMISQLLexerStrict.IS_NOT_NULL:
+        case CmisQlStrictLexer.IS_NOT_NULL:
             evalIsNotNull(node);
             break;
-        case CMISQLLexerStrict.LT:
+        case CmisQlStrictLexer.LT:
             evalLessThan(node);
             break;
-        case CMISQLLexerStrict.BOOL_LIT:
+        case CmisQlStrictLexer.BOOL_LIT:
             evalBooleanLiteral(node);
             break;
-        case CMISQLLexerStrict.TIME_LIT:
+        case CmisQlStrictLexer.TIME_LIT:
             evalTimeLiteral(node);
             break;
-        case CMISQLLexerStrict.STRING_LIT:
+        case CmisQlStrictLexer.STRING_LIT:
             evalStringLiteral(node);
             break;
-        case CMISQLLexerStrict.CONTAINS:
+        case CmisQlStrictLexer.CONTAINS:
             evalContains(node);
             break;
-        case CMISQLLexerStrict.ExactNumLit:
+        case CmisQlStrictLexer.ExactNumLit:
             evalExactNumLiteral(node);
             break;
-        case CMISQLLexerStrict.LTEQ:
+        case CmisQlStrictLexer.LTEQ:
             evalLessOrEqual(node);
             break;
-        case CMISQLLexerStrict.NOT:
+        case CmisQlStrictLexer.NOT:
             evalNot(node);
             break;
-        case CMISQLLexerStrict.ID:
+        case CmisQlStrictLexer.ID:
             evalId(node);
             break;
-        case CMISQLLexerStrict.AND:
+        case CmisQlStrictLexer.AND:
             evalAnd(node);
             break;
-        case CMISQLLexerStrict.IN:
+        case CmisQlStrictLexer.IN:
             evalIn(node);
             break;
-        case CMISQLLexerStrict.EQ:
+        case CmisQlStrictLexer.EQ:
             evalEquals(node);
             break;
-        case CMISQLLexerStrict.NUM_LIT:
+        case CmisQlStrictLexer.NUM_LIT:
             evalNumLiteral(node);
             break;
-        case CMISQLLexerStrict.LIKE:
+        case CmisQlStrictLexer.LIKE:
             evalLike(node);
             break;
-        case CMISQLLexerStrict.NULL:
+        case CmisQlStrictLexer.NULL:
             evalNull(node);
             break;
-        case CMISQLLexerStrict.GTEQ:
+        case CmisQlStrictLexer.GTEQ:
             evalGreaterThan(node);
             break;
-        case CMISQLLexerStrict.ApproxNumLit:
+        case CmisQlStrictLexer.ApproxNumLit:
             evalApproxNumLiteral(node);
             break;
-        case CMISQLLexerStrict.IN_FOLDER:
+        case CmisQlStrictLexer.IN_FOLDER:
             evalInFolder(node);
             break;
-        case CMISQLLexerStrict.NEQ:
+        case CmisQlStrictLexer.NEQ:
             evalNotEquals(node);
             break;
-        case CMISQLLexerStrict.SCORE:
+        case CmisQlStrictLexer.SCORE:
             evalScore(node);
             break;
-        case CMISQLLexerStrict.IN_TREE:
+        case CmisQlStrictLexer.IN_TREE:
             evalInTree(node);
             break;
-        case CMISQLLexerStrict.OR:
+        case CmisQlStrictLexer.OR:
             evalOr(node);
             break;
-        case CMISQLLexerStrict.GT:
+        case CmisQlStrictLexer.GT:
             evalGreaterThan(node);
             break;
-        case CMISQLLexerStrict.TIMESTAMP:
+        case CmisQlStrictLexer.TIMESTAMP:
             evalTimeLiteral(node);
             break;
         default:
@@ -713,7 +720,7 @@ public class QueryParseTest extends Abst
 
     private void evalColumn(Tree node) {
         assertEquals(1, node.getChildCount());
-        assertEquals(CMISQLLexerStrict.ID, node.getChild(0).getType());
+        assertEquals(CmisQlStrictLexer.ID, node.getChild(0).getType());
     }
 
     private void evalEquals(Tree node) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java Mon Jul 12 06:41:49 2010
@@ -28,11 +28,11 @@ import java.util.Map;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
-import org.apache.chemistry.opencmis.inmemory.query.CmisQueryWalker;
-import org.apache.chemistry.opencmis.inmemory.query.CmisSelector;
-import org.apache.chemistry.opencmis.inmemory.query.ColumnReference;
-import org.apache.chemistry.opencmis.inmemory.query.QueryObject;
-import org.apache.chemistry.opencmis.inmemory.query.QueryObject.SortSpec;
+import org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker;
+import org.apache.chemistry.opencmis.server.support.query.CmisSelector;
+import org.apache.chemistry.opencmis.server.support.query.ColumnReference;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject;
+import org.apache.chemistry.opencmis.server.support.query.QueryObject.SortSpec;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml?rev=963193&r1=963192&r2=963193&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/pom.xml Mon Jul 12 06:41:49 2010
@@ -49,7 +49,7 @@
         <dependency>
             <groupId>org.antlr</groupId>
             <artifactId>antlr-runtime</artifactId>
-            <version>3.1.3</version>
+            <version>3.2</version>
         </dependency>
     </dependencies>
 
@@ -62,7 +62,13 @@
         <plugins>
             <plugin>
                 <groupId>org.antlr</groupId>
-                <artifactId>antlr3-maven-plugin</artifactId>
+                <artifactId>antlr3-maven-plugin</artifactId>               
+                <configuration>
+		           <excludes>
+			          <exclude>**/CmisBaseGrammar.g</exclude>
+			          <exclude>**/Java*.g</exclude>
+		           </excludes>
+                </configuration>
                 <executions>
                     <execution>
                         <!-- default phase: process-sources -->
@@ -96,18 +102,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.antlr</groupId>
-                <artifactId>maven-gunit-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <!-- default phase: test -->
-                        <goals>
-                            <goal>gunit</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
 

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisBaseGrammar.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisBaseGrammar.g?rev=963193&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisBaseGrammar.g (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisBaseGrammar.g Mon Jul 12 06:41:49 2010
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ *     Stefane Fermigier, Nuxeo
+ *     Florent Guillaume, Nuxeo
+ */
+ 
+parser grammar CmisBaseGrammar;
+
+// Note: The following tokenVocab option generates a warning: 
+// warning(160): CMISBaseGrammar.g:27:5: tokenVocab option ignored in imported gram
+// mar CMISBaseGrammar
+// If you omit this it results in compilation errors, may be a maven issue (not sure
+// of outside of maven this needs file needs to be compilable
+// options must have AST options otherwise 
+
+options {
+    tokenVocab = CmisQlStrictLexer;
+    output = AST;
+}
+
+@rulecatch {
+	catch (RecognitionException e) {
+		throw e;
+	}
+}
+
+query: 
+	SELECT select_list from_clause where_clause? order_by_clause?
+		-> ^(SELECT select_list from_clause order_by_clause? where_clause?)
+	;
+
+select_list
+    : STAR
+    | select_sublist ( COMMA select_sublist )*
+      -> ^(SEL_LIST select_sublist+)
+    ;
+
+select_sublist
+    : value_expression ( AS!? column_name )?
+    | qualifier DOT STAR
+    //| multi_valued_column_reference
+    ;
+
+value_expression:
+      column_reference
+    | numeric_value_function
+    ;
+
+column_reference:
+    ( qualifier DOT )? column_name
+      -> ^(COL qualifier? column_name)
+    ;
+
+multi_valued_column_reference:
+    ( qualifier DOT )? multi_valued_column_name
+      -> ^(COL qualifier? multi_valued_column_name)
+    ;
+
+numeric_value_function:
+    SCORE LPAR RPAR -> ^(SCORE);
+
+qualifier:
+      table_name
+    //| correlation_name
+    ;
+
+from_clause: FROM^ table_reference;
+
+table_reference:
+    one_table table_join*
+    ;
+
+table_join:
+    join_kind one_table join_specification?
+    -> ^(JOIN join_kind one_table join_specification?)
+    ;
+
+one_table:
+      LPAR! table_reference RPAR!
+    | table_name
+        -> ^(TABLE table_name)
+    | table_name AS? correlation_name
+        -> ^(TABLE table_name correlation_name)
+    ;
+
+join_kind:
+      JOIN
+        -> INNER
+    | INNER JOIN
+        -> INNER
+    | LEFT OUTER? JOIN
+        -> LEFT
+    | RIGHT OUTER? JOIN
+        -> RIGHT
+    ;
+
+join_specification:
+    ON^ column_reference EQ column_reference
+    ;
+
+///////////////////////////////////////////////////////////
+// Begin Where
+
+where_clause: WHERE^ search_condition;
+
+search_condition:
+    boolean_term (OR^ boolean_term)*;
+
+boolean_term:
+    boolean_factor (AND^ boolean_factor)*;
+
+boolean_factor:
+    NOT^ boolean_test
+    | boolean_test
+	;
+	
+boolean_test:
+      predicate
+    | LPAR search_condition RPAR -> search_condition
+    ;
+
+predicate:
+      comparison_predicate
+    | in_predicate
+    | like_predicate
+    | null_predicate
+    | quantified_comparison_predicate
+    | quantified_in_predicate
+    | text_search_predicate
+    | folder_predicate
+    ;
+
+comparison_predicate:
+    value_expression EQ literal
+      -> ^(EQ value_expression literal)
+    | value_expression NEQ literal
+      -> ^(NEQ value_expression literal)
+    | value_expression LT literal
+      -> ^(LT value_expression literal)
+    | value_expression GT literal
+      -> ^(GT value_expression literal)
+    | value_expression LTEQ literal
+      -> ^(LTEQ value_expression literal)
+    | value_expression GTEQ literal
+      -> ^(GTEQ value_expression literal)
+    ;
+
+literal:
+      NUM_LIT
+    | STRING_LIT
+    | TIME_LIT
+    | BOOL_LIT
+    ;
+
+in_predicate:
+      column_reference IN LPAR in_value_list RPAR
+        -> ^(IN column_reference in_value_list)
+    | column_reference NOT IN LPAR in_value_list RPAR
+        -> ^(NOT_IN column_reference in_value_list)
+    ;
+
+in_value_list:
+    literal ( COMMA literal )*
+      -> ^(IN_LIST literal+)
+    ;
+
+like_predicate:
+      column_reference LIKE STRING_LIT
+        -> ^(LIKE column_reference STRING_LIT)
+    | column_reference NOT LIKE STRING_LIT
+        -> ^(NOT_LIKE column_reference STRING_LIT)
+    ;
+
+null_predicate:
+    // second alternative commented out to remove left recursion for now.
+    //( column_reference | multi_valued_column_reference ) 'IS' 'NOT'? 'NULL';
+    column_reference IS
+      ( NOT NULL -> ^(IS_NOT_NULL column_reference)
+      | NULL     -> ^(IS_NULL     column_reference)
+      )
+    ;
+
+quantified_comparison_predicate:
+    literal EQ ANY multi_valued_column_reference
+      -> ^(EQ_ANY literal multi_valued_column_reference)
+    ;
+
+quantified_in_predicate:
+    ANY multi_valued_column_reference
+      ( NOT IN LPAR in_value_list RPAR
+          -> ^(NOT_IN_ANY multi_valued_column_reference in_value_list )
+      | IN     LPAR in_value_list RPAR
+          -> ^(IN_ANY    multi_valued_column_reference in_value_list )
+      )
+    ;
+
+text_search_predicate:
+    CONTAINS LPAR (qualifier COMMA)? text_search_expression RPAR
+      -> ^(CONTAINS qualifier? text_search_expression)
+    ;
+
+// end where
+/////////////////////////////////////////////////////////////////
+
+folder_predicate:
+    ( f=IN_FOLDER | f=IN_TREE ) LPAR (qualifier COMMA)? folder_id RPAR
+      -> ^($f qualifier? folder_id)
+    ;
+
+order_by_clause:
+    ORDER BY sort_specification ( COMMA sort_specification )*
+      -> ^(ORDER_BY sort_specification+)
+    ;
+
+sort_specification:
+      column_reference -> column_reference ASC
+    | column_reference ( ASC | DESC )
+    ;
+
+correlation_name:
+    ID;
+
+table_name:
+    ID;
+
+column_name:
+    ID;
+
+multi_valued_column_name:
+    ID;
+
+folder_id:
+    STRING_LIT;
+
+text_search_expression:
+    STRING_LIT;

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlExtParser.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlExtParser.g?rev=963193&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlExtParser.g (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlExtParser.g Mon Jul 12 06:41:49 2010
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ *     Stefane Fermigier, Nuxeo
+ *     Florent Guillaume, Nuxeo
+ */
+/**
+ * CMISQL parser.
+ */
+parser grammar CmisQlExtParser;
+
+options {
+    tokenVocab = CmisQlStrictLexer;
+    output = AST;
+}
+
+import CmisBaseGrammar;
+
+tokens {
+    FUNC;
+    OP_ANY;
+}
+
+@header {
+/*
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ *     Stefane Fermigier, Nuxeo
+ *     Florent Guillaume, Nuxeo
+ *
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ */
+package org.apache.chemistry.opencmis.server.support.query;
+}
+
+
+query: SELECT^ DISTINCT? select_list from_clause where_clause? order_by_clause?;
+
+value_expression:
+      column_reference
+    | string_value_function
+    | numeric_value_function
+    ;
+
+quantified_comparison_predicate:
+    literal comp_op ANY multi_valued_column_reference
+      -> ^(OP_ANY comp_op literal multi_valued_column_reference)
+    ;
+
+comp_op:
+    EQ | NEQ | LT | GT | LTEQ | GTEQ
+    ;
+
+string_value_function:
+    ID LPAR column_reference RPAR
+      -> ^(FUNC ID column_reference)
+    ;

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g?rev=963193&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g Mon Jul 12 06:41:49 2010
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ *     Stefane Fermigier, Nuxeo
+ *     Florent Guillaume, Nuxeo
+ */
+/**
+ * CMISQL lexer.
+ */
+lexer grammar CmisQlStrictLexer;
+
+tokens {
+    TABLE;
+    COL;
+    SEL_LIST;
+    IN_LIST;
+    IN_ANY;
+    NOT_IN_ANY;
+    EQ_ANY;
+    NOT_IN;
+    NOT_LIKE;
+    IS_NULL;
+    IS_NOT_NULL;
+    ORDER_BY;
+}
+
+@header {
+/*
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Authors:
+ *     Stefane Fermigier, Nuxeo
+ *     Florent Guillaume, Nuxeo
+ *
+ * THIS FILE IS AUTO-GENERATED, DO NOT EDIT.
+ */
+package org.apache.chemistry.opencmis.server.support.query;
+}
+
+// ----- Generic SQL -----
+
+SELECT : ('S'|'s')('E'|'e')('L'|'l')('E'|'e')('C'|'c')('T'|'t');
+//DISTINCT : ('D'|'d')('I'|'i')('S'|'s')('T'|'t')('I'|'i')('N'|'n')('C'|'c')('T'|'t');
+FROM : ('F'|'f')('R'|'r')('O'|'o')('M'|'m');
+AS : ('A'|'a')('S'|'s');
+JOIN : ('J'|'j')('O'|'o')('I'|'i')('N'|'n');
+INNER : ('I'|'i')('N'|'n')('N'|'n')('E'|'e')('R'|'r');
+OUTER : ('O'|'o')('U'|'u')('T'|'t')('E'|'e')('R'|'r');
+LEFT : ('L'|'l')('E'|'e')('F'|'f')('T'|'t');
+RIGHT : ('R'|'r')('I'|'i')('G'|'g')('H'|'h')('T'|'t');
+ON : ('O'|'o')('N'|'n');
+WHERE : ('W'|'w')('H'|'h')('E'|'e')('R'|'r')('E'|'e');
+ORDER : ('O'|'o')('R'|'r')('D'|'d')('E'|'e')('R'|'r');
+BY : ('B'|'b')('Y'|'y');
+ASC : ('A'|'a')('S'|'s')('C'|'c');
+DESC : ('D'|'d')('E'|'e')('S'|'s')('C'|'c');
+
+// ----- Operators -----
+
+IS : ('I'|'i')('S'|'s');
+NULL : ('N'|'n')('U'|'u')('L'|'l')('L'|'l');
+AND : ('A'|'a')('N'|'n')('D'|'d');
+OR : ('O'|'o')('R'|'r');
+NOT : ('N'|'n')('O'|'o')('T'|'t');
+IN : ('I'|'i')('N'|'n');
+LIKE : ('L'|'l')('I'|'i')('K'|'k')('E'|'e');
+ANY : ('A'|'a')('N'|'n')('Y'|'y');
+CONTAINS : ('C'|'c')('O'|'o')('N'|'n')('T'|'t')('A'|'a')('I'|'i')('N'|'n')('S'|'s');
+SCORE : ('S'|'s')('C'|'c')('O'|'o')('R'|'r')('E'|'e');
+IN_FOLDER : ('I'|'i')('N'|'n')'_'('F'|'f')('O'|'o')('L'|'l')('D'|'d')('E'|'e')('R'|'r');
+IN_TREE : ('I'|'i')('N'|'n')'_'('T'|'t')('R'|'r')('E'|'e')('E'|'e');
+TIMESTAMP : 'TIMESTAMP'|'timestamp';
+
+STAR : '*';
+LPAR : '(';
+RPAR : ')';
+COMMA : ',';
+DOT : '.';
+EQ : '=';
+NEQ : '<>';
+LT : '<';
+GT : '>';
+LTEQ : '<=';
+GTEQ : '>=';
+
+// ----- Literals -----
+
+BOOL_LIT : 'TRUE' | 'true' | 'FALSE' | 'false';
+
+fragment Sign : ('+'|'-')?;
+fragment Digits : ('0'..'9')+;
+fragment ExactNumLit : Digits DOT Digits | Digits DOT | DOT Digits | Digits;
+fragment ApproxNumLit : ExactNumLit ('e'|'E') Sign Digits;
+NUM_LIT : Sign (ExactNumLit | ApproxNumLit);
+
+STRING_LIT : '\'' (~'\''|'\'\'')* '\'';
+
+WS : ( ' ' | '\t' | '\r'? '\n' )+ { $channel=HIDDEN; };
+
+TIME_LIT : TIMESTAMP WS STRING_LIT;
+
+ID :
+    ('a'..'z'|'A'..'Z'|'_')
+    ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|':')*
+    ;



Mime
View raw message