jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1292828 [3/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/tree/OrderingImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrderingImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrderingImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/OrderingImpl.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.Ordering;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class OrderingImpl extends QOMNode implements Ordering {
+
+    private final DynamicOperandImpl operand;
+    private final Order order;
+
+    public OrderingImpl(DynamicOperandImpl operand, Order order) {
+        this.operand = operand;
+        this.order = order;
+    }
+
+    public DynamicOperandImpl getOperand() {
+        return operand;
+    }
+
+    public String getOrder() {
+        return order.getName();
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        if (order == Order.ASCENDING) {
+            return operand + " ASC";
+        } else {
+            return operand + " DESC";
+        }
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.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.PropertyExistence;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class PropertyExistenceImpl extends ConstraintImpl implements PropertyExistence {
+
+    private final String selectorName;
+    private final String propertyName;
+    private SelectorImpl selector;
+
+    public PropertyExistenceImpl(String selectorName, String propertyName) {
+        this.selectorName = selectorName;
+        this.propertyName = propertyName;
+    }
+
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    boolean evaluate() {
+        return selector.currentNode().hasProperty(propertyName);
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        // TODO quote property names?
+        return getSelectorName() + '.' + propertyName + " IS NOT NULL";
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.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.Value;
+import javax.jcr.query.qom.PropertyValue;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class PropertyValueImpl extends DynamicOperandImpl implements PropertyValue {
+
+    private final String selectorName;
+    private final String propertyName;
+    private SelectorImpl selector;
+
+    public PropertyValueImpl(String selectorName, String propertyName) {
+        this.selectorName = selectorName;
+        this.propertyName = propertyName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        // TODO quote property names?
+        return getSelectorName() + '.' + propertyName;
+    }
+
+    @Override
+    Value currentValue() {
+        String value = selector.currentNode().getProperty(propertyName);
+        return query.getValueFactory().createValue(value);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMNode.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMNode.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMNode.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,44 @@
+/*
+ * 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 org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
+
+
+abstract class QOMNode {
+
+    protected QueryObjectModelImpl query;
+
+    abstract boolean accept(QOMVisitor v);
+
+    protected String protect(Object expression) {
+        String str = expression.toString();
+        if (str.indexOf(' ') >= 0) {
+            return '(' + str + ')';
+        } else {
+            return str;
+        }
+    }
+
+    protected String quotePath(String path) {
+        return '[' + path + ']';
+    }
+
+}
+

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMTreeVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMTreeVisitor.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMTreeVisitor.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMTreeVisitor.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,139 @@
+/*
+ * 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 org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
+
+public abstract class QOMTreeVisitor implements QOMVisitor {
+
+    /**
+     * Calls accept on each of the attached constraints of the AND node.
+     */
+    @Override
+    public boolean visit(AndImpl node) {
+        node.getConstraint1().accept(this);
+        node.getConstraint2().accept(this);
+        return true;
+    }
+
+    /**
+     * Calls accept on the two operands in the comparison node.
+     */
+    @Override
+    public boolean visit(ComparisonImpl node) {
+        node.getOperand1().accept(this);
+        node.getOperand2().accept(this);
+        return true;
+    }
+
+    /**
+     * Calls accept on the static operand in the fulltext search constraint.
+     */
+    @Override
+    public boolean visit(FullTextSearchImpl node) {
+        node.getFullTextSearchExpression().accept(this);
+        return true;
+    }
+
+    /**
+     * Calls accept on the two sources and the join condition in the join node.
+     */
+    @Override
+    public boolean visit(JoinImpl node) {
+        node.getRight().accept(this);
+        node.getLeft().accept(this);
+        node.getJoinCondition().accept(this);
+        return true;
+    }
+
+    /**
+     * Calls accept on the property value in the length node.
+     */
+    @Override
+    public boolean visit(LengthImpl node) {
+        return node.getPropertyValue().accept(this);
+    }
+
+    /**
+     * Calls accept on the dynamic operand in the lower-case node.
+     */
+    @Override
+    public boolean visit(LowerCaseImpl node) {
+        return node.getOperand().accept(this);
+    }
+
+    /**
+     * Calls accept on the constraint in the NOT node.
+     */
+    @Override
+    public boolean visit(NotImpl node) {
+        return node.getConstraint().accept(this);
+    }
+
+    /**
+     * Calls accept on the dynamic operand in the ordering node.
+     */
+    @Override
+    public boolean visit(OrderingImpl node) {
+        return node.getOperand().accept(this);
+    }
+
+    /**
+     * Calls accept on each of the attached constraints of the OR node.
+     */
+    @Override
+    public boolean visit(OrImpl node) {
+        node.getConstraint1().accept(this);
+        node.getConstraint2().accept(this);
+        return true;
+    }
+
+    /**
+     * Calls accept on the following contained QOM nodes:
+     * <ul>
+     * <li>Source</li>
+     * <li>Constraints</li>
+     * <li>Orderings</li>
+     * <li>Columns</li>
+     * </ul>
+     */
+    public boolean visit(QueryObjectModelImpl node) {
+        node.getSource().accept(this);
+        ConstraintImpl constraint = node.getConstraint();
+        if (constraint != null) {
+            constraint.accept(this);
+        }
+        OrderingImpl[] orderings = node.getOrderings();
+        for (OrderingImpl ordering : orderings) {
+            ordering.accept(this);
+        }
+        ColumnImpl[] columns = node.getColumns();
+        for (ColumnImpl column : columns) {
+            column.accept(this);
+        }
+        return true;
+    }
+
+    /**
+     * Calls accept on the dynamic operand in the lower-case node.
+     */
+    @Override
+    public boolean visit(UpperCaseImpl node) {
+        return node.getOperand().accept(this);
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMVisitor.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMVisitor.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/QOMVisitor.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+public interface QOMVisitor {
+
+    boolean visit(AndImpl node);
+
+    boolean visit(BindVariableValueImpl node);
+
+    boolean visit(ChildNodeImpl node);
+
+    boolean visit(ChildNodeJoinConditionImpl node);
+
+    boolean visit(ColumnImpl node);
+
+    boolean visit(ComparisonImpl node);
+
+    boolean visit(DescendantNodeImpl node);
+
+    boolean visit(DescendantNodeJoinConditionImpl node);
+
+    boolean visit(EquiJoinConditionImpl node);
+
+    boolean visit(FullTextSearchImpl node);
+
+    boolean visit(FullTextSearchScoreImpl node);
+
+    boolean visit(JoinImpl node);
+
+    boolean visit(LengthImpl node);
+
+    boolean visit(LiteralImpl node);
+
+    boolean visit(LowerCaseImpl node);
+
+    boolean visit(NodeLocalNameImpl node);
+
+    boolean visit(NodeNameImpl node);
+
+    boolean visit(NotImpl node);
+
+    boolean visit(OrderingImpl node);
+
+    boolean visit(OrImpl node);
+
+    boolean visit(PropertyExistenceImpl node);
+
+    boolean visit(PropertyValueImpl node);
+
+    boolean visit(SameNodeImpl node);
+
+    boolean visit(SameNodeJoinConditionImpl node);
+
+    boolean visit(SelectorImpl node);
+
+    boolean visit(UpperCaseImpl node);
+
+}
\ No newline at end of file

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.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.query.qom.SameNode;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class SameNodeImpl extends ConstraintImpl implements SameNode {
+
+    private final String path;
+    private final String selectorName;
+    private SelectorImpl selector;
+
+    public SameNodeImpl(String selectorName, String path) {
+        this.selectorName = selectorName;
+        this.path = path;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    boolean evaluate() {
+        return selector.currentNode().getPath().equals(path);
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        return "ISSAMENODE(" + getSelectorName() + ", " + quotePath(path) + ')';
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.SameNodeJoinCondition;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class SameNodeJoinConditionImpl extends JoinConditionImpl implements SameNodeJoinCondition
{
+
+    private final String selector1Name;
+    private final String selector2Name;
+    private final String selector2Path;
+
+    public SameNodeJoinConditionImpl(String selector1Name, String selector2Name,
+            String selector2Path) {
+        this.selector1Name = selector1Name;
+        this.selector2Name = selector2Name;
+        this.selector2Path = selector2Path;
+    }
+
+    public String getSelector1Name() {
+        return selector1Name;
+    }
+
+    public String getSelector2Name() {
+        return selector2Name;
+    }
+
+    public String getSelector2Path() {
+        return selector2Path;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("ISSAMENODE(");
+        builder.append(getSelector1Name());
+        builder.append(", ");
+        builder.append(getSelector2Name());
+        if (selector2Path != null) {
+            builder.append(", ");
+            builder.append(quotePath(selector2Path));
+        }
+        builder.append(')');
+        return builder.toString();
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,66 @@
+/*
+ * 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.Selector;
+import org.apache.jackrabbit.mk.mem.NodeImpl;
+import org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
+
+/**
+ * The implementation of the corresponding JCR interface.
+ */
+public class SelectorImpl extends SourceImpl implements Selector {
+
+    private final String nodeTypeName, selectorName;
+    private NodeImpl currentNode;
+
+    public SelectorImpl(String nodeTypeName, String selectorName) {
+        this.nodeTypeName = nodeTypeName;
+        this.selectorName = selectorName;
+    }
+
+    public String getNodeTypeName() {
+        return nodeTypeName;
+    }
+
+    public String getSelectorName() {
+        return selectorName;
+    }
+
+    @Override
+    boolean accept(QOMVisitor v) {
+        return v.visit(this);
+    }
+
+    public String toString() {
+        // TODO quote nodeTypeName?
+        return nodeTypeName + " AS " + getSelectorName();
+    }
+
+    @Override
+    public void init(QueryObjectModelImpl qom) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public NodeImpl currentNode() {
+        return currentNode;
+    }
+
+}

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SourceImpl.java?rev=1292828&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SourceImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SourceImpl.java
Thu Feb 23 15:34:27 2012
@@ -0,0 +1,43 @@
+/*
+ * 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.Source;
+import org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
+
+public abstract class SourceImpl extends QOMNode implements Source {
+
+    protected ConstraintImpl queryConstraint;
+    protected JoinConditionImpl joinCondition;
+    protected boolean outerJoin;
+
+    public void setQueryConstraint(ConstraintImpl queryConstraint) {
+        this.queryConstraint = queryConstraint;
+    }
+
+    public void setJoinCondition(JoinConditionImpl joinCondition) {
+        this.joinCondition = joinCondition;
+    }
+
+    public void setOuterJoin(boolean outerJoin) {
+        this.outerJoin = outerJoin;
+    }
+
+    public abstract void init(QueryObjectModelImpl qom);
+}

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

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



Mime
View raw message