jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1292828 [2/3] - in /jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query: ./ index/ qom/ qom/tree/
Date Thu, 23 Feb 2012 15:34:29 GMT
Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelFactoryImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelFactoryImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelFactoryImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,226 @@
+/*
+ * 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.jackrabbit.query.qom;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.Query;
+import javax.jcr.query.qom.ChildNode;
+import javax.jcr.query.qom.ChildNodeJoinCondition;
+import javax.jcr.query.qom.Column;
+import javax.jcr.query.qom.Comparison;
+import javax.jcr.query.qom.Constraint;
+import javax.jcr.query.qom.DescendantNode;
+import javax.jcr.query.qom.DescendantNodeJoinCondition;
+import javax.jcr.query.qom.DynamicOperand;
+import javax.jcr.query.qom.EquiJoinCondition;
+import javax.jcr.query.qom.FullTextSearch;
+import javax.jcr.query.qom.FullTextSearchScore;
+import javax.jcr.query.qom.Join;
+import javax.jcr.query.qom.JoinCondition;
+import javax.jcr.query.qom.Length;
+import javax.jcr.query.qom.Literal;
+import javax.jcr.query.qom.LowerCase;
+import javax.jcr.query.qom.NodeLocalName;
+import javax.jcr.query.qom.NodeName;
+import javax.jcr.query.qom.Not;
+import javax.jcr.query.qom.Or;
+import javax.jcr.query.qom.Ordering;
+import javax.jcr.query.qom.PropertyExistence;
+import javax.jcr.query.qom.PropertyValue;
+import javax.jcr.query.qom.QueryObjectModel;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.SameNode;
+import javax.jcr.query.qom.SameNodeJoinCondition;
+import javax.jcr.query.qom.Selector;
+import javax.jcr.query.qom.Source;
+import javax.jcr.query.qom.StaticOperand;
+import javax.jcr.query.qom.UpperCase;
+import org.apache.jackrabbit.query.qom.tree.AndImpl;
+import org.apache.jackrabbit.query.qom.tree.BindVariableValueImpl;
+import org.apache.jackrabbit.query.qom.tree.ChildNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.ChildNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.ColumnImpl;
+import org.apache.jackrabbit.query.qom.tree.ComparisonImpl;
+import org.apache.jackrabbit.query.qom.tree.ConstraintImpl;
+import org.apache.jackrabbit.query.qom.tree.DescendantNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.DescendantNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.DynamicOperandImpl;
+import org.apache.jackrabbit.query.qom.tree.EquiJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.FullTextSearchImpl;
+import org.apache.jackrabbit.query.qom.tree.FullTextSearchScoreImpl;
+import org.apache.jackrabbit.query.qom.tree.JoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.JoinImpl;
+import org.apache.jackrabbit.query.qom.tree.JoinType;
+import org.apache.jackrabbit.query.qom.tree.LengthImpl;
+import org.apache.jackrabbit.query.qom.tree.LiteralImpl;
+import org.apache.jackrabbit.query.qom.tree.LowerCaseImpl;
+import org.apache.jackrabbit.query.qom.tree.NodeLocalNameImpl;
+import org.apache.jackrabbit.query.qom.tree.NodeNameImpl;
+import org.apache.jackrabbit.query.qom.tree.NotImpl;
+import org.apache.jackrabbit.query.qom.tree.Operator;
+import org.apache.jackrabbit.query.qom.tree.OrImpl;
+import org.apache.jackrabbit.query.qom.tree.Order;
+import org.apache.jackrabbit.query.qom.tree.OrderingImpl;
+import org.apache.jackrabbit.query.qom.tree.PropertyExistenceImpl;
+import org.apache.jackrabbit.query.qom.tree.PropertyValueImpl;
+import org.apache.jackrabbit.query.qom.tree.SameNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.SameNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.SelectorImpl;
+import org.apache.jackrabbit.query.qom.tree.SourceImpl;
+import org.apache.jackrabbit.query.qom.tree.StaticOperandImpl;
+import org.apache.jackrabbit.query.qom.tree.UpperCaseImpl;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class QueryObjectModelFactoryImpl implements QueryObjectModelFactory {
+
+    public AndImpl and(Constraint constraint1, Constraint constraint2) throws RepositoryException {
+        return new AndImpl((ConstraintImpl) constraint1, (ConstraintImpl) constraint2);
+    }
+
+    public OrderingImpl ascending(DynamicOperand operand) throws RepositoryException {
+        return new OrderingImpl((DynamicOperandImpl)operand, Order.ASCENDING);
+    }
+
+    public BindVariableValueImpl bindVariable(String bindVariableName) throws RepositoryException {
+        return new BindVariableValueImpl(bindVariableName);
+    }
+
+    public ChildNode childNode(String selectorName, String path) throws RepositoryException {
+        return new ChildNodeImpl(selectorName, path);
+    }
+
+    public ChildNodeJoinCondition childNodeJoinCondition(String childSelectorName, String parentSelectorName)
+            throws RepositoryException {
+        return new ChildNodeJoinConditionImpl(childSelectorName, parentSelectorName);
+    }
+
+    public Column column(String selectorName, String propertyName, String columnName) throws RepositoryException {
+        return new ColumnImpl(selectorName, propertyName, columnName);
+    }
+
+    public Comparison comparison(DynamicOperand operand1, String operator, StaticOperand operand2)
+            throws RepositoryException {
+        return new ComparisonImpl((DynamicOperandImpl)operand1, Operator.getOperatorByName(operator), (StaticOperandImpl)operand2);
+    }
+
+    public QueryObjectModel createQuery(Source source, Constraint constraint, Ordering[] orderings, Column[] columns)
+            throws RepositoryException {
+        String statement = null;
+        if (orderings != null && !(orderings instanceof OrderingImpl[])) {
+            OrderingImpl[] orderings2 = new OrderingImpl[orderings.length];
+            System.arraycopy(orderings, 0, orderings2, 0, orderings.length);
+            orderings = orderings2;
+        }
+        if (columns != null && !(columns instanceof ColumnImpl[])) {
+            ColumnImpl[] columns2 = new ColumnImpl[columns.length];
+            System.arraycopy(columns, 0, columns2, 0, columns.length);
+            columns = columns2;
+        }
+        QueryObjectModelImpl qom = new QueryObjectModelImpl(Query.JCR_SQL2, statement, (SourceImpl) source,
+                (ConstraintImpl) constraint, (OrderingImpl[]) orderings, (ColumnImpl[]) columns);
+        qom.init();
+        return qom;
+    }
+
+    public DescendantNode descendantNode(String selectorName, String path) throws RepositoryException {
+        return new DescendantNodeImpl(selectorName, path);
+    }
+
+    public DescendantNodeJoinCondition descendantNodeJoinCondition(String descendantSelectorName,
+            String ancestorSelectorName) throws RepositoryException {
+        return new DescendantNodeJoinConditionImpl(descendantSelectorName, ancestorSelectorName);
+    }
+
+    public Ordering descending(DynamicOperand operand) throws RepositoryException {
+        return new OrderingImpl((DynamicOperandImpl)operand, Order.DESCENDING);
+    }
+
+    public EquiJoinCondition equiJoinCondition(String selector1Name, String property1Name, String selector2Name,
+            String property2Name) throws RepositoryException {
+        return new EquiJoinConditionImpl(selector1Name, property1Name, selector2Name, property2Name);
+    }
+
+    public FullTextSearch fullTextSearch(String selectorName, String propertyName,
+            StaticOperand fullTextSearchExpression) throws RepositoryException {
+        return new FullTextSearchImpl(selectorName, propertyName, (StaticOperandImpl) fullTextSearchExpression);
+    }
+
+    public FullTextSearchScore fullTextSearchScore(String selectorName) throws RepositoryException {
+        return new FullTextSearchScoreImpl(selectorName);
+    }
+
+    public Join join(Source left, Source right, String joinType, JoinCondition joinCondition) throws RepositoryException {
+        return new JoinImpl((SourceImpl) left, (SourceImpl) right, JoinType.getJoinTypeByName(joinType), (JoinConditionImpl) joinCondition);
+    }
+
+    public Length length(PropertyValue propertyValue) throws  RepositoryException {
+        return new LengthImpl((PropertyValueImpl)propertyValue);
+    }
+
+    public Literal literal(Value literalValue) throws  RepositoryException {
+        return new LiteralImpl(literalValue);
+    }
+
+    public LowerCase lowerCase(DynamicOperand operand) throws  RepositoryException {
+        return new LowerCaseImpl((DynamicOperandImpl)operand);
+    }
+
+    public NodeLocalName nodeLocalName(String selectorName) throws  RepositoryException {
+        return new NodeLocalNameImpl(selectorName);
+    }
+
+    public NodeName nodeName(String selectorName) throws  RepositoryException {
+        return new NodeNameImpl(selectorName);
+    }
+
+    public Not not(Constraint constraint) throws  RepositoryException {
+        return new NotImpl((ConstraintImpl)constraint);
+    }
+
+    public Or or(Constraint constraint1, Constraint constraint2) throws  RepositoryException {
+        return new OrImpl((ConstraintImpl)constraint1, (ConstraintImpl)constraint2);
+    }
+
+    public PropertyExistence propertyExistence(String selectorName, String propertyName) throws
+            RepositoryException {
+        return new PropertyExistenceImpl(selectorName, propertyName);
+    }
+
+    public PropertyValue propertyValue(String selectorName, String propertyName) throws
+            RepositoryException {
+        return new PropertyValueImpl(selectorName, propertyName);
+    }
+
+    public SameNode sameNode(String selectorName, String path) throws  RepositoryException {
+        return new SameNodeImpl(selectorName, path);
+    }
+
+    public SameNodeJoinCondition sameNodeJoinCondition(String selector1Name, String selector2Name, String selector2Path)
+            throws  RepositoryException {
+        return new SameNodeJoinConditionImpl(selector1Name, selector2Name, selector2Path);
+    }
+
+    public Selector selector(String nodeTypeName, String selectorName) throws
+            RepositoryException {
+        return new SelectorImpl(nodeTypeName, selectorName);
+    }
+
+    public UpperCase upperCase(DynamicOperand operand) throws  RepositoryException {
+        return new UpperCaseImpl((DynamicOperandImpl)operand);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,225 @@
+/*
+ * 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.jackrabbit.query.qom;
+
+import java.util.HashMap;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.qom.QueryObjectModel;
+import org.apache.jackrabbit.commons.SimpleValueFactory;
+import org.apache.jackrabbit.query.qom.tree.BindVariableValueImpl;
+import org.apache.jackrabbit.query.qom.tree.ChildNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.ChildNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.ColumnImpl;
+import org.apache.jackrabbit.query.qom.tree.ConstraintImpl;
+import org.apache.jackrabbit.query.qom.tree.DescendantNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.DescendantNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.EquiJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.FullTextSearchScoreImpl;
+import org.apache.jackrabbit.query.qom.tree.LiteralImpl;
+import org.apache.jackrabbit.query.qom.tree.NodeLocalNameImpl;
+import org.apache.jackrabbit.query.qom.tree.NodeNameImpl;
+import org.apache.jackrabbit.query.qom.tree.OrderingImpl;
+import org.apache.jackrabbit.query.qom.tree.PropertyExistenceImpl;
+import org.apache.jackrabbit.query.qom.tree.PropertyValueImpl;
+import org.apache.jackrabbit.query.qom.tree.QOMTreeVisitor;
+import org.apache.jackrabbit.query.qom.tree.SameNodeImpl;
+import org.apache.jackrabbit.query.qom.tree.SameNodeJoinConditionImpl;
+import org.apache.jackrabbit.query.qom.tree.SelectorImpl;
+import org.apache.jackrabbit.query.qom.tree.SourceImpl;
+
+/**
+ * The implementation of the corresponding JCR interface. Lifecycle: use the
+ * constructor to create a new object. Call init() to initialize the bind
+ * variable map.
+ */
+public class QueryObjectModelImpl implements QueryObjectModel {
+
+    private final String language;
+    private final String statement;
+    private final SourceImpl source;
+    private final ConstraintImpl constraint;
+    private final OrderingImpl[] orderings;
+    private final ColumnImpl[] columns;
+    final HashMap<String, Value> bindVariableMap = new HashMap<String, Value>();
+    private long limit;
+    private long offset;
+
+    private ValueFactory valueFactory = new SimpleValueFactory();
+
+    public QueryObjectModelImpl(String language, String statement, SourceImpl source, ConstraintImpl constraint, OrderingImpl[] orderings,
+            ColumnImpl[] columns) {
+        this.language = language;
+        this.statement = statement;
+        this.source = source;
+        this.constraint = constraint;
+        this.orderings = orderings;
+        this.columns = columns;
+    }
+
+    void init() {
+        new QOMTreeVisitor() {
+
+            @Override
+            public boolean visit(BindVariableValueImpl node) {
+                bindVariableMap.put(node.getBindVariableName(), null);
+                return true;
+            }
+
+            @Override
+            public boolean visit(ChildNodeImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(ChildNodeJoinConditionImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(ColumnImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(DescendantNodeImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(DescendantNodeJoinConditionImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(EquiJoinConditionImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(FullTextSearchScoreImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(LiteralImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(NodeLocalNameImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(NodeNameImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(PropertyExistenceImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(PropertyValueImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(SameNodeImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(SameNodeJoinConditionImpl node) {
+                return true;
+            }
+
+            @Override
+            public boolean visit(SelectorImpl node) {
+                return true;
+            }
+
+        }.visit(this);
+        source.init(this);
+    }
+
+    public ColumnImpl[] getColumns() {
+        return columns;
+    }
+
+    public ConstraintImpl getConstraint() {
+        return constraint;
+    }
+
+    public OrderingImpl[] getOrderings() {
+        return orderings;
+    }
+
+    public SourceImpl getSource() {
+        return source;
+    }
+
+    public void bindValue(String varName, Value value) throws RepositoryException {
+        bindVariableMap.put(varName, value);
+    }
+
+    public QueryResult execute() throws RepositoryException {
+
+        // TODO
+        return null;
+    }
+
+    public String[] getBindVariableNames() throws RepositoryException {
+        String[] array = new String[bindVariableMap.size()];
+        array = bindVariableMap.keySet().toArray(array);
+        return array;
+    }
+
+    public String getLanguage() {
+        return language;
+    }
+
+    public String getStatement() {
+        return statement;
+    }
+
+    public String getStoredQueryPath() throws RepositoryException {
+
+        // TODO
+        return null;
+    }
+
+    public void setLimit(long limit) {
+        this.limit = limit;
+    }
+
+    public void setOffset(long offset) {
+        this.offset = offset;
+    }
+
+    public Node storeAsNode(String absPath) throws RepositoryException {
+        // TODO
+        return null;
+    }
+
+    public ValueFactory getValueFactory() {
+        return valueFactory;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/AndImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/AndImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/AndImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/AndImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.And;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class AndImpl extends ConstraintImpl implements And {
+
+    private final ConstraintImpl constraint1, constraint2;
+
+    public AndImpl(ConstraintImpl constraint1, ConstraintImpl constraint2) {
+        this.constraint1 = constraint1;
+        this.constraint2 = constraint2;
+    }
+
+    public ConstraintImpl getConstraint1() {
+        return constraint1;
+    }
+
+    public ConstraintImpl getConstraint2() {
+        return constraint2;
+    }
+
+    boolean evaluate() throws RepositoryException {
+        return constraint1.evaluate() && constraint2.evaluate();
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return protect(constraint1) + " AND " + protect(constraint2);
+    }
+
+}
+

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/BindVariableValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/BindVariableValueImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/BindVariableValueImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/BindVariableValueImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,54 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.Value;
+import javax.jcr.query.qom.BindVariableValue;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class BindVariableValueImpl extends StaticOperandImpl implements BindVariableValue {
+
+    private final String bindVariableName;
+    private Value value;
+
+    public BindVariableValueImpl(String bindVariableName) {
+        this.bindVariableName = bindVariableName;
+    }
+
+    public String getBindVariableName() {
+        return bindVariableName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return '$' + bindVariableName;
+    }
+
+    @Override
+    Value currentValue() {
+        return value;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,61 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.ChildNode;
+
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class ChildNodeImpl extends ConstraintImpl implements ChildNode {
+
+    private final String selectorName;
+    private final String parentPath;
+
+    public ChildNodeImpl(String selectorName, String parentPath) {
+        this.selectorName = selectorName;
+        this.parentPath = parentPath;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    public String getParentPath() {
+        return parentPath;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "ISCHILDNODE(" + selectorName + ", " + quotePath(parentPath) + ')';
+    }
+
+    @Override
+    boolean evaluate() throws RepositoryException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
\ No newline at end of file

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.ChildNodeJoinCondition;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class ChildNodeJoinConditionImpl extends JoinConditionImpl implements ChildNodeJoinCondition {
+
+    private final String childSelectorName;
+    private final String parentSelectorName;
+
+    public ChildNodeJoinConditionImpl(String childSelectorName, String parentSelectorName) {
+        this.childSelectorName = childSelectorName;
+        this.parentSelectorName = parentSelectorName;
+    }
+
+    public String getChildSelectorName() {
+        return childSelectorName;
+    }
+
+    public String getParentSelectorName() {
+        return parentSelectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        String child = getChildSelectorName();
+        String parent = getParentSelectorName();
+        return "ISCHILDNODE(" + child + ", " + parent + ')';
+    }
+
+}
\ No newline at end of file

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,62 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.Column;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class ColumnImpl extends QOMNode implements Column {
+
+    private final String selectorName, propertyName, columnName;
+
+    public ColumnImpl(String selectorName, String propertyName, String columnName) {
+        this.selectorName = selectorName;
+        this.propertyName = propertyName;
+        this.columnName = columnName;
+    }
+
+    public String getColumnName() {
+        return columnName;
+    }
+
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        if (propertyName != null) {
+            return getSelectorName() + '.' + getPropertyName()
+                    + " AS " + getColumnName();
+        } else {
+            return getSelectorName() + ".*";
+        }
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ComparisonImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ComparisonImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ComparisonImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ComparisonImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,77 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Comparison;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class ComparisonImpl extends ConstraintImpl implements Comparison {
+
+    private final DynamicOperandImpl operand1;
+    private final Operator operator;
+    private final StaticOperandImpl operand2;
+
+    public ComparisonImpl(DynamicOperandImpl operand1, Operator operator, StaticOperandImpl operand2) {
+        this.operand1 = operand1;
+        this.operator = operator;
+        this.operand2 = operand2;
+    }
+
+    public DynamicOperandImpl getOperand1() {
+        return operand1;
+    }
+
+    public String getOperator() {
+        return operator.toString();
+    }
+
+    public StaticOperandImpl getOperand2() {
+        return operand2;
+    }
+
+    boolean evaluate() throws RepositoryException {
+        switch (operator) {
+        case EQ:
+            return operand1.currentValue().equals(operand2.currentValue());
+        case GE:
+        case GT:
+        case LE:
+        case LIKE:
+        case LT:
+            return operand1.currentValue() .equals(operand2.currentValue());
+        case NE:
+            return !operand1.currentValue().equals(operand2.currentValue());
+        }
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return operator.formatSql(operand1.toString(), operand2.toString());
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ConstraintImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ConstraintImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ConstraintImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ConstraintImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Constraint;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public abstract class ConstraintImpl extends QOMNode implements Constraint {
+
+    abstract boolean evaluate() throws RepositoryException;
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.DescendantNode;
+import org.apache.jackrabbit.mk.util.PathUtils;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class DescendantNodeImpl extends ConstraintImpl implements DescendantNode {
+
+    private final String selectorName;
+    private final String ancestorPath;
+    private SelectorImpl selector;
+
+    public DescendantNodeImpl(String selectorName, String ancestorPath) {
+        this.selectorName = selectorName;
+        this.ancestorPath = ancestorPath;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    public String getAncestorPath() {
+        return ancestorPath;
+    }
+
+    boolean evaluate() {
+        return PathUtils.isAncestor(ancestorPath, selector.currentNode().getPath());
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "ISDESCENDANTNODE(" + getSelectorName() + ", " + quotePath(ancestorPath) + ')';
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeJoinConditionImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeJoinConditionImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeJoinConditionImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.DescendantNodeJoinCondition;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class DescendantNodeJoinConditionImpl extends JoinConditionImpl implements
+        DescendantNodeJoinCondition {
+
+    private final String descendantSelectorName;
+    private final String ancestorSelectorName;
+
+    public DescendantNodeJoinConditionImpl(String descendantSelectorName,
+            String ancestorSelectorName) {
+        this.descendantSelectorName = descendantSelectorName;
+        this.ancestorSelectorName = ancestorSelectorName;
+    }
+
+    public String getDescendantSelectorName() {
+        return descendantSelectorName;
+    }
+
+    public String getAncestorSelectorName() {
+        return ancestorSelectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        String descendant = getDescendantSelectorName();
+        String ancestor = getAncestorSelectorName();
+        return "ISDESCENDANTNODE(" + descendant + ", " + ancestor + ')';
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DynamicOperandImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DynamicOperandImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DynamicOperandImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DynamicOperandImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.DynamicOperand;
+
+public abstract class DynamicOperandImpl extends QOMNode implements DynamicOperand {
+
+    abstract Value currentValue() throws RepositoryException;
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,68 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.EquiJoinCondition;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class EquiJoinConditionImpl extends JoinConditionImpl implements EquiJoinCondition {
+
+    private final String property1Name;
+    private final String property2Name;
+    private final String selector1Name;
+    private final String selector2Name;
+
+    public EquiJoinConditionImpl(String selector1Name, String property1Name, String selector2Name,
+            String property2Name) {
+        this.selector1Name = selector1Name;
+        this.property1Name = property1Name;
+        this.selector2Name = selector2Name;
+        this.property2Name = property2Name;
+    }
+
+    public String getSelector1Name() {
+        return selector1Name;
+    }
+
+    public String getProperty1Name() {
+        return property1Name;
+    }
+
+    public String getSelector2Name() {
+        return selector2Name;
+    }
+
+    public String getProperty2Name() {
+        return property2Name;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        // TODO quote property names?
+        return getSelector1Name() + '.' + getProperty2Name()
+                + " = " + getSelector2Name() + '.' + getProperty2Name();
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,80 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.FullTextSearch;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class FullTextSearchImpl extends ConstraintImpl implements FullTextSearch {
+
+    private final String selectorName;
+    private final String propertyName;
+    private final StaticOperandImpl fullTextSearchExpression;
+
+    public FullTextSearchImpl(String selectorName, String propertyName,
+            StaticOperandImpl fullTextSearchExpression) {
+        this.selectorName = selectorName;
+        this.propertyName = propertyName;
+        this.fullTextSearchExpression = fullTextSearchExpression;
+    }
+
+    public StaticOperandImpl getFullTextSearchExpression() {
+        return fullTextSearchExpression;
+    }
+
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        // TODO quote property names?
+        StringBuilder builder = new StringBuilder();
+        builder.append("CONTAINS(");
+        builder.append(getSelectorName());
+        if (propertyName != null) {
+            builder.append('.');
+            builder.append(propertyName);
+            builder.append(", ");
+        } else {
+            builder.append(".*, ");
+        }
+        builder.append(getFullTextSearchExpression());
+        builder.append(')');
+        return builder.toString();
+    }
+
+    @Override
+    boolean evaluate() throws RepositoryException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchScoreImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchScoreImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchScoreImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/FullTextSearchScoreImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.FullTextSearchScore;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class FullTextSearchScoreImpl extends DynamicOperandImpl implements FullTextSearchScore {
+
+    private final String selectorName;
+
+    public FullTextSearchScoreImpl(String selectorName) {
+        this.selectorName = selectorName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "SCORE(" + getSelectorName() + ')';
+    }
+
+    @Override
+    Value currentValue() throws RepositoryException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinConditionImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinConditionImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinConditionImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,22 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.JoinCondition;
+
+public abstract class JoinConditionImpl extends QOMNode implements JoinCondition {
+
+    // marker class
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinImpl.java Thu Feb 23 15:34:27 2012
@@ -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.
+ */
+package org.apache.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.Join;
+import org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class JoinImpl extends SourceImpl implements Join {
+
+    private final SourceImpl left;
+    private final SourceImpl right;
+    private final JoinType joinType;
+    private final JoinConditionImpl joinCondition;
+
+    public JoinImpl(SourceImpl left, SourceImpl right, JoinType joinType,
+            JoinConditionImpl joinCondition) {
+        this.left = left;
+        this.right = right;
+        this.joinType = joinType;
+        this.joinCondition = joinCondition;
+    }
+
+    public JoinConditionImpl getJoinCondition() {
+        return joinCondition;
+    }
+
+    public String getJoinType() {
+        return joinType.toString();
+    }
+
+    public SourceImpl getLeft() {
+        return left;
+    }
+
+    public SourceImpl getRight() {
+        return right;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return joinType.formatSql(left, right, joinCondition);
+    }
+
+    @Override
+    public void init(QueryObjectModelImpl qom) {
+        switch (joinType) {
+        case INNER:
+            left.setQueryConstraint(queryConstraint);
+            right.setQueryConstraint(queryConstraint);
+            right.setJoinCondition(joinCondition);
+            left.init(qom);
+            right.init(qom);
+            break;
+        case LEFT:
+            left.setQueryConstraint(queryConstraint);
+            right.setOuterJoin(true);
+            right.setQueryConstraint(queryConstraint);
+            right.setJoinCondition(joinCondition);
+            left.init(qom);
+            right.init(qom);
+            break;
+        case RIGHT:
+            right.setQueryConstraint(queryConstraint);
+            left.setOuterJoin(true);
+            left.setQueryConstraint(queryConstraint);
+            left.setJoinCondition(joinCondition);
+            right.init(qom);
+            left.init(qom);
+            break;
+        }
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinType.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinType.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinType.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/JoinType.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,109 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Join;
+import javax.jcr.query.qom.JoinCondition;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.Source;
+
+/**
+ * Enumeration of the JCR 2.0 join types.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum JoinType {
+
+    INNER(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, "INNER JOIN"),
+
+    LEFT(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, "LEFT OUTER JOIN"),
+
+    RIGHT(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, "RIGHT OUTER JOIN");
+
+    /**
+     * JCR name of this join type.
+     */
+    private final String name;
+
+    private final String sql;
+
+    private JoinType(String name, String sql) {
+        this.name = name;
+        this.sql = sql;
+    }
+
+    /**
+     * Returns the join of the given sources.
+     *
+     * @param factory factory for creating the join
+     * @param left left join source
+     * @param right right join source
+     * @param condition join condition
+     * @return join
+     * @throws RepositoryException if the join can not be created
+     */
+    public Join join(
+            QueryObjectModelFactory factory,
+            Source left, Source right, JoinCondition condition)
+            throws RepositoryException {
+        return factory.join(left, right, name, condition);
+    }
+
+    /**
+     * Formats an SQL join with this join type and the given sources and
+     * join condition. The sources and condition are simply used as-is,
+     * without any quoting or escaping.
+     *
+     * @param left left source
+     * @param right right source
+     * @param condition join condition
+     * @return SQL join, <code>left join right</code>
+     */
+    public String formatSql(Object left, Object right, Object condition) {
+        return left + " " + sql + " " + right + " ON " + condition;
+    }
+
+    /**
+     * Returns the JCR 2.0 name of this join type.
+     *
+     * @see QueryObjectModelConstants
+     * @return JCR name of this join type
+     */
+    public String toString() {
+        return name;
+    }
+
+    /**
+     * Returns the join type with the given JCR name.
+     *
+     * @param name JCR name of a join type
+     * @return join type with the given name
+     * @throws RepositoryException if the given name is unknown
+     */
+    public static JoinType getJoinTypeByName(String name)
+            throws RepositoryException {
+        for (JoinType type : JoinType.values()) {
+            if (type.name.equals(name)) {
+                return type;
+            }
+        }
+        throw new RepositoryException("Unknown join type name: " + name);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LengthImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LengthImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LengthImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LengthImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.Length;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class LengthImpl extends DynamicOperandImpl implements Length {
+
+    private final PropertyValueImpl propertyValue;
+
+    public LengthImpl(PropertyValueImpl propertyValue) {
+        this.propertyValue = propertyValue;
+    }
+
+    public PropertyValueImpl getPropertyValue() {
+        return propertyValue;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "LENGTH(" + getPropertyValue() + ')';
+    }
+
+    @Override
+    Value currentValue() throws RepositoryException {
+        String value = propertyValue.currentValue().getString();
+        return query.getValueFactory().createValue(value.length());
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LiteralImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LiteralImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LiteralImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LiteralImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,93 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.Literal;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class LiteralImpl extends StaticOperandImpl implements Literal {
+
+    private final Value value;
+
+    public LiteralImpl(Value value) {
+        this.value = value;
+    }
+
+    public Value getLiteralValue() {
+        return value;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        try {
+            switch (value.getType()) {
+            case PropertyType.BINARY:
+                return cast("BINARY");
+            case PropertyType.BOOLEAN:
+                return cast("BOOLEAN");
+            case PropertyType.DATE:
+                return cast("DATE");
+            case PropertyType.DECIMAL:
+                return cast("DECIMAL");
+            case PropertyType.DOUBLE:
+            case PropertyType.LONG:
+                return value.getString();
+            case PropertyType.NAME:
+                return cast("NAME");
+            case PropertyType.PATH:
+                return cast("PATH");
+            case PropertyType.REFERENCE:
+                return cast("REFERENCE");
+            case PropertyType.STRING:
+                return escape();
+            case PropertyType.URI:
+                return cast("URI");
+            case PropertyType.WEAKREFERENCE:
+                return cast("WEAKREFERENCE");
+            default:
+                return escape();
+            }
+        } catch (RepositoryException e) {
+            return value.toString();
+        }
+    }
+
+    private String cast(String type) throws RepositoryException {
+        return "CAST(" + escape() + " AS " + type + ')';
+    }
+
+    private String escape() throws RepositoryException {
+        return '\'' + value.getString().replace("'", "''") + '\'';
+    }
+
+    @Override
+    Value currentValue() {
+        return value;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LowerCaseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LowerCaseImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LowerCaseImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/LowerCaseImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.LowerCase;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class LowerCaseImpl extends DynamicOperandImpl implements LowerCase {
+
+    private final DynamicOperandImpl operand;
+
+    public LowerCaseImpl(DynamicOperandImpl operand) {
+        this.operand = operand;
+    }
+
+    public DynamicOperandImpl getOperand() {
+        return operand;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "LOWER(" + operand + ')';
+    }
+
+    @Override
+    Value currentValue() throws RepositoryException {
+        Value value = operand.currentValue();
+        return query.getValueFactory().createValue(value.getString().toUpperCase());
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.NodeLocalName;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class NodeLocalNameImpl extends DynamicOperandImpl implements NodeLocalName {
+
+    private final String selectorName;
+
+    public NodeLocalNameImpl(String selectorName) {
+        this.selectorName = selectorName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "LOCALNAME(" + getSelectorName() + ')';
+    }
+
+    @Override
+    Value currentValue() throws RepositoryException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.query.qom.NodeName;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class NodeNameImpl extends DynamicOperandImpl implements NodeName {
+
+    private final String selectorName;
+
+    public NodeNameImpl(String selectorName) {
+        this.selectorName = selectorName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "NAME(" + getSelectorName() + ')';
+    }
+
+    @Override
+    Value currentValue() throws RepositoryException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NotImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NotImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NotImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NotImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,52 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Not;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class NotImpl extends ConstraintImpl implements Not {
+
+    private final ConstraintImpl constraint;
+
+    public NotImpl(ConstraintImpl constraint) {
+        this.constraint = constraint;
+    }
+
+    public ConstraintImpl getConstraint() {
+        return constraint;
+    }
+
+    boolean evaluate() throws RepositoryException {
+        return !constraint.evaluate();
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "NOT " + protect(constraint);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Operator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Operator.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Operator.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Operator.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,161 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Comparison;
+import javax.jcr.query.qom.DynamicOperand;
+import javax.jcr.query.qom.QueryObjectModelConstants;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+import javax.jcr.query.qom.StaticOperand;
+
+/**
+ * Enumeration of the JCR 2.0 query operators.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum Operator {
+
+    EQ(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, "="),
+
+    NE(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO, "!=", "<>"),
+
+    GT(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN, ">"),
+
+    GE(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO, ">="),
+
+    LT(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN, "<"),
+
+    LE(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO, "<="),
+
+    LIKE(QueryObjectModelConstants.JCR_OPERATOR_LIKE, null, "like");
+
+    /**
+     * JCR name of this operator.
+     */
+    private final String name;
+
+    /**
+     * This operator in XPath syntax.
+     */
+    private final String xpath;
+
+    /**
+     * This operator in SQL syntax.
+     */
+    private final String sql;
+
+    private Operator(String name, String op) {
+        this(name, op, op);
+    }
+
+    private Operator(String name, String xpath, String sql) {
+        this.name = name;
+        this.xpath = xpath;
+        this.sql = sql;
+    }
+
+    /**
+     * Returns a comparison between the given operands using this operator.
+     *
+     * @param factory factory for creating the comparison
+     * @param left operand on the left hand side
+     * @param right operand on the right hand side
+     * @return comparison
+     * @throws RepositoryException if the comparison can not be created
+     */
+    public Comparison comparison(
+            QueryObjectModelFactory factory,
+            DynamicOperand left, StaticOperand right)
+            throws RepositoryException {
+        return factory.comparison(left, name, right);
+    }
+
+    /**
+     * Formats an XPath constraint with this operator and the given operands.
+     * The operands are simply used as-is, without any quoting or escaping.
+     *
+     * @param a first operand
+     * @param b second operand
+     * @return XPath constraint, <code>a op b</code> or
+     *         <code>jcr:like(a, b)</code> for {@link #LIKE}
+     */
+    public String formatXpath(String a, String b) {
+        if (this == LIKE) {
+            return "jcr:like(" + a + ", " + b + ")";
+        } else {
+            return a + " " + xpath + " " + b;
+        }
+    }
+
+    /**
+     * Formats an SQL constraint with this operator and the given operands.
+     * The operands are simply used as-is, without any quoting or escaping.
+     *
+     * @param a first operand
+     * @param b second operand
+     * @return SQL constraint, <code>a op b</code>
+     */
+    public String formatSql(String a, String b) {
+        return a + " " + sql + " " + b;
+    }
+
+    /**
+     * Returns the JCR 2.0 name of this query operator.
+     *
+     * @see QueryObjectModelConstants
+     * @return JCR name of this operator
+     */
+    public String toString() {
+        return name;
+    }
+
+    /**
+     * Returns an array of the names of all the JCR 2.0 query operators.
+     *
+     * @return names of all query operators
+     */
+    public static String[] getAllQueryOperators() {
+        return new String[] {
+                EQ.toString(),
+                NE.toString(),
+                GT.toString(),
+                GE.toString(),
+                LT.toString(),
+                LE.toString(),
+                LIKE.toString()
+        };
+    }
+
+    /**
+     * Returns the operator with the given JCR name.
+     *
+     * @param name JCR name of an operator
+     * @return operator with the given name
+     * @throws RepositoryException if the given name is unknown
+     */
+    public static Operator getOperatorByName(String name)
+            throws RepositoryException {
+        for (Operator operator : Operator.values()) {
+            if (operator.name.equals(name)) {
+                return operator;
+            }
+        }
+        throw new RepositoryException("Unknown operator name: " + name);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrImpl.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrImpl.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.qom.Or;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class OrImpl extends ConstraintImpl implements Or {
+
+    private final ConstraintImpl constraint1;
+    private final ConstraintImpl constraint2;
+
+    public OrImpl(ConstraintImpl constraint1, ConstraintImpl constraint2) {
+        this.constraint1 = constraint1;
+        this.constraint2 = constraint2;
+    }
+
+    public ConstraintImpl getConstraint1() {
+        return constraint1;
+    }
+
+    public ConstraintImpl getConstraint2() {
+        return constraint2;
+    }
+
+    boolean evaluate() throws RepositoryException {
+        return constraint1.evaluate() || constraint2.evaluate();
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return protect(constraint1) + " OR " + protect(constraint2);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Order.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Order.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Order.java (added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/Order.java Thu Feb 23 15:34:27 2012
@@ -0,0 +1,64 @@
+/*
+ * 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.jackrabbit.query.qom.tree;
+
+import javax.jcr.query.qom.QueryObjectModelConstants;
+
+/**
+ * Enumeration of the JCR 2.0 query order.
+ *
+ * @since Apache Jackrabbit 2.0
+ */
+public enum Order {
+
+    ASCENDING(QueryObjectModelConstants.JCR_ORDER_ASCENDING),
+
+    DESCENDING(QueryObjectModelConstants.JCR_ORDER_DESCENDING);
+
+    /**
+     * JCR name of this order.
+     */
+    private final String name;
+
+    private Order(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the JCR name of this order.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Return the order with the given JCR name.
+     *
+     * @param name the JCR name of an order.
+     * @return the order with the given name.
+     * @throws IllegalArgumentException if <code>name</code> is not a known JCR
+     *                                  order name.
+     */
+    public static Order getOrderByName(String name) {
+        for (Order order : Order.values()) {
+            if (order.name.equals(name)) {
+                return order;
+            }
+        }
+        throw new IllegalArgumentException("Unknown order name: " + name);
+    }
+}



Mime
View raw message