jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r497844 - in /jackrabbit/trunk/contrib/spi: jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ spi/src/main/java/org/apache/jackrabbit/spi/ spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/
Date Fri, 19 Jan 2007 15:35:40 GMT
Author: reschke
Date: Fri Jan 19 07:35:38 2007
New Revision: 497844

URL: http://svn.apache.org/viewvc?view=rev&rev=497844
Log:
spi - QueryInfo: change to return QueryResultRowIterator
spi - QueryResultRow/QueryResultRowIterator: new
jcr2spi - Update implementation accordingly (note jcr:score now is returned with property
type Double)
spi2dav - Minor changes to keep it compiling; full implementation of changed interface to
be done

Added:
    jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
  (with props)
    jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
  (with props)
Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java
    jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
    jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryInfoImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/NodeIteratorImpl.java
Fri Jan 19 07:35:38 2007
@@ -16,22 +16,21 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateManager;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.QueryInfo;
-import org.apache.jackrabbit.spi.ItemId;
-import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.spi.QueryResultRow;
+import org.apache.jackrabbit.spi.QueryResultRowIterator;
 import org.slf4j.Logger;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Item;
-
-import java.util.NoSuchElementException;
-import java.util.Iterator;
+import org.slf4j.LoggerFactory;
 
 /**
  * Implements a {@link javax.jcr.NodeIterator} returned by
@@ -48,14 +47,8 @@
     /** ItemManager to turn Ids into Node instances */
     private final ItemStateManager itemStateMgr;
 
-    /** The query result info */
-    private final QueryInfo queryInfo;
-
-    /** The ItemId's of the result nodes */
-    private final IdIterator ids;
-
-    /** Index of the jcr:score column. */
-    private final int scoreIndex;
+    /** The QueryResultRows */
+    private final QueryResultRowIterator rows;
 
     /** Current position of this node iterator */
     private int pos = -1;
@@ -69,6 +62,9 @@
     /** Reference to the next node instance */
     private Node next;
 
+    /** Score for the next node */
+    private double nextScore;
+
     /**
      * Creates a new <code>NodeIteratorImpl</code> instance.
      *
@@ -82,22 +78,8 @@
                             QueryInfo queryInfo) throws RepositoryException {
         this.itemMgr = itemMgr;
         this.itemStateMgr = itemStateMgr;
-        this.queryInfo = queryInfo;
-        this.ids = queryInfo.getNodeIds();
+        this.rows = queryInfo.getRows();
         
-        QName[] columnNames = queryInfo.getColumnNames();
-        int idx = -1;
-        for (int i = 0; i < columnNames.length; i++) {
-            if (columnNames[i].getNamespaceURI().equals(QName.NS_JCR_URI)
-                && columnNames[i].getLocalName().startsWith(QName.JCR_SCORE.getLocalName()))
{
-                idx = i;
-                break;
-            }
-        }
-        if (idx == -1) {
-            throw new RepositoryException("no jcr:score column in query result");
-        }
-        this.scoreIndex = idx;
         fetchNext();
     }
 
@@ -110,16 +92,11 @@
      * @throws NoSuchElementException if there is no next node.
      * @see ScoreNodeIterator#getScore()
      */
-    public float getScore() throws NoSuchElementException {
+    public double getScore() throws NoSuchElementException {
         if (!hasNext()) {
             throw new NoSuchElementException();
         }
-        String scoreString = queryInfo.getValues(nextId)[scoreIndex];
-        try {
-            return Float.parseFloat(scoreString);
-        } catch (NumberFormatException e) {
-            throw new NoSuchElementException();
-        }
+        return nextScore;
     }
 
     //-------------------------------------------------------< NodeIterator >---
@@ -155,7 +132,7 @@
         if (skipNum == 0) {
             // do nothing
         } else {
-            ids.skip(skipNum - 1);
+            rows.skip(skipNum - 1);
             pos += skipNum - 1;
             fetchNext();
         }
@@ -175,8 +152,8 @@
      * @see javax.jcr.RangeIterator#getSize()
      */
     public long getSize() {
-        if (ids.getSize() != -1) {
-            return ids.getSize() - invalid;
+        if (rows.getSize() != -1) {
+            return rows.getSize() - invalid;
         } else {
             return -1;
         }
@@ -233,18 +210,17 @@
     private void fetchNext() {
         // reset
         next = null;
-        while (next == null && ids.hasNext()) {
+        nextScore = 0;
+        
+        while (next == null && rows.hasNext()) {
             try {
-                ItemId id = ids.nextId();
-                if (!id.denotesNode()) {
-                    log.error("NodeId expected. Found PropertyId: " + id);
-                    continue;
-                }
-                nextId = (NodeId)id;
+                QueryResultRow row = rows.nextQueryResultRow();
+                nextId = row.getNodeId();
                 Item tmp = itemMgr.getItem(itemStateMgr.getItemState(nextId));
 
                 if (tmp.isNode()) {
                     next = (Node) tmp;
+                    nextScore = row.getScore();
                 } else {
                     log.warn("Item with Id is not a Node: " + nextId);
                     // try next

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
Fri Jan 19 07:35:38 2007
@@ -16,30 +16,32 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
-import org.apache.jackrabbit.name.IllegalNameException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.value.LongValue;
-import org.apache.jackrabbit.value.PathValue;
-import org.apache.jackrabbit.value.StringValue;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Set;
 
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.PropertyType;
+import javax.jcr.RangeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.Node;
-import javax.jcr.RangeIterator;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.Iterator;
+
+import org.apache.jackrabbit.name.IllegalNameException;
+import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.UnknownPrefixException;
+import org.apache.jackrabbit.value.DoubleValue;
+import org.apache.jackrabbit.value.LongValue;
+import org.apache.jackrabbit.value.PathValue;
+import org.apache.jackrabbit.value.StringValue;
 
 /**
  * Implements the {@link javax.jcr.query.RowIterator} interface returned by
@@ -169,7 +171,7 @@
         /**
          * The score for this result row
          */
-        private final float score;
+        private final double score;
 
         /**
          * The underlying <code>Node</code> of this result row.
@@ -192,7 +194,7 @@
          * @param score the score value for this result row
          * @param node  the underlying <code>Node</code> for this <code>Row</code>.
          */
-        private RowImpl(float score, Node node) {
+        private RowImpl(double score, Node node) {
             this.score = score;
             this.node = node;
         }
@@ -235,7 +237,7 @@
                         if (QName.JCR_PATH.equals(properties[i])) {
                             tmp[i] = PathValue.valueOf(node.getPath());
                         } else if (QName.JCR_SCORE.equals(properties[i])) {
-                            tmp[i] = new LongValue((int) (score * 1000f));
+                            tmp[i] = new DoubleValue(score);
                         } else {
                             tmp[i] = null;
                         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/ScoreNodeIterator.java
Fri Jan 19 07:35:38 2007
@@ -33,5 +33,5 @@
      * @return the score of the node returned by {@link #nextNode()}.
      * @throws java.util.NoSuchElementException if there is no next node.
      */
-    public float getScore();
+    public double getScore();
 }

Modified: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryInfo.java
Fri Jan 19 07:35:38 2007
@@ -18,19 +18,16 @@
 
 import org.apache.jackrabbit.name.QName;
 
-import java.io.InputStream;
-
 /**
  * QueryInfo...
  */
 public interface QueryInfo {
 
     /**
-     * @return an array of String representing the node ids present in the
-     * query result
-     * @see javax.jcr.query.QueryResult#getNodes()
+     * @return an iterator over the {@link QueryResultRow}s
+     * @see javax.jcr.query.QueryResult#getRows()
      */
-    public IdIterator getNodeIds();
+    public QueryResultRowIterator getRows();
 
     /**
      * @return an array of QName representing the column names of the query
@@ -38,21 +35,4 @@
      * @see javax.jcr.query.QueryResult#getColumnNames()
      */
     public QName[] getColumnNames();
-
-    /**
-     * @return an array of String representing the values present in a single
-     * row of the query result
-     * @see javax.jcr.query.Row#getValue(String)
-     * @see javax.jcr.query.Row#getValues()
-     */
-    public String[] getValues(NodeId nodeId);
-
-    /**
-     * todo really needed? rather use RepositoryService.getPropertyInfo(id).getValuesAsStream()
-     * @return an array of InputStream representing the values present in a single
-     * row of the query result
-     * @see javax.jcr.query.Row#getValue(String)
-     * @see javax.jcr.query.Row#getValues()
-     */
-    public InputStream[] getValuesAsStream(NodeId nodeId);
 }

Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java?view=auto&rev=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
(added)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
Fri Jan 19 07:35:38 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.spi;
+
+/**
+ * <code>QueryResultRow</code>...
+ */
+public interface QueryResultRow {
+  
+    /**
+     * Returns {@link NodeId} of node this result row represents.
+     * 
+     * @return node id 
+     */
+    public NodeId getNodeId();
+    
+    /**
+     * Returns score of this result row.
+     * 
+     * @return score
+     */
+    public double getScore();
+    
+    /**
+     * @return an array of String representing the values present in this result row
+     * @see javax.jcr.query.Row#getValue(String)
+     * @see javax.jcr.query.Row#getValues()
+     * TODO: switch type to QValue[] when available
+     */
+    public String[] getValues(); 
+}

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRow.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java?view=auto&rev=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
(added)
+++ jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
Fri Jan 19 07:35:38 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.spi;
+
+import javax.jcr.RangeIterator;
+
+/**
+ * <code>QueryResultRowIterator</code>...
+ */
+public interface QueryResultRowIterator extends RangeIterator {
+    /**
+     * Returns the next query result row in the iteration.
+     *
+     * @return the next query result row in the iteration.
+     * @throws java.util.NoSuchElementException if no more rows are left.
+     */
+    public QueryResultRow nextQueryResultRow();
+}

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/contrib/spi/spi/src/main/java/org/apache/jackrabbit/spi/QueryResultRowIterator.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IteratorHelper.java
Fri Jan 19 07:35:38 2007
@@ -24,6 +24,8 @@
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.Event;
 import org.apache.jackrabbit.spi.EventIterator;
+import org.apache.jackrabbit.spi.QueryResultRow;
+import org.apache.jackrabbit.spi.QueryResultRowIterator;
 
 import java.util.Collection;
 import java.util.Iterator;
@@ -33,7 +35,7 @@
  * <code>org.apache.jackrabbit.spi2dav.IteratorHelper</code>...
  */
 public class IteratorHelper extends org.apache.jackrabbit.util.IteratorHelper
-    implements IdIterator, QNodeTypeDefinitionIterator, EventIterator {
+    implements IdIterator, QueryResultRowIterator, QNodeTypeDefinitionIterator, EventIterator
{
 
     private static Logger log = LoggerFactory.getLogger(IteratorHelper.class);
 
@@ -59,6 +61,13 @@
      */
     public QNodeTypeDefinition nextDefinition() {
         return (QNodeTypeDefinition) next();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public QueryResultRow nextQueryResultRow() {
+        return (QueryResultRow)super.next();
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryInfoImpl.java?view=diff&rev=497844&r1=497843&r2=497844
==============================================================================
--- jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryInfoImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryInfoImpl.java
Fri Jan 19 07:35:38 2007
@@ -16,36 +16,31 @@
  */
 package org.apache.jackrabbit.spi2dav;
 
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.jcr.search.SearchResultProperty;
-import org.apache.jackrabbit.webdav.MultiStatusResponse;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.MultiStatus;
-import org.apache.jackrabbit.util.ISO9075;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import java.util.AbstractCollection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.ValueFactory;
+
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameException;
-import org.apache.jackrabbit.spi.QueryInfo;
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.spi.QueryResultRowIterator;
 import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.value.ValueFormat;
-import org.apache.jackrabbit.value.QValue;
-import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.util.ISO9075;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+import org.apache.jackrabbit.webdav.MultiStatus;
+import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.jcr.search.SearchResultProperty;
+import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.slf4j.Logger;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-import javax.jcr.PropertyType;
-import javax.jcr.ValueFactory;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.AbstractCollection;
-import java.util.NoSuchElementException;
-import java.util.Map;
-import java.util.LinkedHashMap;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>QueryInfoImpl</code>...
@@ -97,8 +92,10 @@
         }
     }
 
-    public IdIterator getNodeIds() {
-        return new IteratorHelper(new AbstractCollection() {
+    public QueryResultRowIterator getRows() {
+      // TODO: objects need to implement QueryResultRow
+      
+      return new IteratorHelper(new AbstractCollection() {
             public int size() {
                 return results.size();
             }
@@ -113,49 +110,49 @@
         return columnNames;
     }
 
-    public String[] getValues(NodeId nodeId) {
-        SearchResultProperty prop = (SearchResultProperty) results.get(nodeId);
-        if (prop == null) {
-            throw new NoSuchElementException();
-        } else {
-            Value[] values = prop.getValues();
-            String[] ret = new String[values.length];
-            for (int i = 0; i < values.length; i++) {
-                try {
-                    QValue qValue = (values[i] == null) ?  null : ValueFormat.getQValue(values[i],
nsResolver);
-                    ret[i] = qValue.getString();
-                } catch (RepositoryException e) {
-                    // should not occur
-                    log.error("malformed value: " + values[i].toString());
-                }
-            }
-            return ret;
-        }
-    }
-
-    public InputStream[] getValuesAsStream(NodeId nodeId) {
-        SearchResultProperty prop = (SearchResultProperty) results.get(nodeId);
-        if (prop == null) {
-            throw new NoSuchElementException();
-        } else {
-            Value[] values = prop.getValues();
-            InputStream[] ret = new InputStream[values.length];
-            for (int i = 0; i < ret.length; i++) {
-                try {
-                    // make sure we return the qualified value if the type is
-                    // name or path.
-                    if (values[i].getType() == PropertyType.NAME || values[i].getType() ==
PropertyType.PATH) {
-                        ret[i] = ValueFormat.getQValue(values[i], nsResolver).getStream();
-                    } else {
-                        ret[i] = values[i].getStream();
-                    }
-                } catch (RepositoryException e) {
-                    // ignore this value
-                    log.warn("unable to get stream value: " + values[i].toString());
-                }
-            }
-            return ret;
-        }
-    }
+//    public String[] getValues(NodeId nodeId) {
+//        SearchResultProperty prop = (SearchResultProperty) results.get(nodeId);
+//        if (prop == null) {
+//            throw new NoSuchElementException();
+//        } else {
+//            Value[] values = prop.getValues();
+//            String[] ret = new String[values.length];
+//            for (int i = 0; i < values.length; i++) {
+//                try {
+//                    QValue qValue = (values[i] == null) ?  null : ValueFormat.getQValue(values[i],
nsResolver);
+//                    ret[i] = qValue.getString();
+//                } catch (RepositoryException e) {
+//                    // should not occur
+//                    log.error("malformed value: " + values[i].toString());
+//                }
+//            }
+//            return ret;
+//        }
+//    }
+//
+//    public InputStream[] getValuesAsStream(NodeId nodeId) {
+//        SearchResultProperty prop = (SearchResultProperty) results.get(nodeId);
+//        if (prop == null) {
+//            throw new NoSuchElementException();
+//        } else {
+//            Value[] values = prop.getValues();
+//            InputStream[] ret = new InputStream[values.length];
+//            for (int i = 0; i < ret.length; i++) {
+//                try {
+//                    // make sure we return the qualified value if the type is
+//                    // name or path.
+//                    if (values[i].getType() == PropertyType.NAME || values[i].getType()
== PropertyType.PATH) {
+//                        ret[i] = ValueFormat.getQValue(values[i], nsResolver).getStream();
+//                    } else {
+//                        ret[i] = values[i].getStream();
+//                    }
+//                } catch (RepositoryException e) {
+//                    // ignore this value
+//                    log.warn("unable to get stream value: " + values[i].toString());
+//                }
+//            }
+//            return ret;
+//        }
+//    }
 
 }



Mime
View raw message