[ 
https://issues.apache.org/jira/browse/JCR-1740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632668#action_12632668
 ] 

Sergey Nebolsin commented on JCR-1740:
--------------------------------------

Hmm, trying to implement this feature correctly and writing the unit test for 
it, I discovered that the problem is not so simple.

And the problem is: ObjectIterator just skips nodes from query result which it 
cannot convert to objects. And we cannot determine if node is convertible 
without actually retrieving this node and trying to convert it. So we cannot 
determine result's size and cannot implement skip() method cheaply.

Two possible solutions:
1. Make ObjectIterator throw an exception if node is not convertible and add 
"@ocm_classname" clause to every query to ensure that query will return only 
nodes which are saved with OCM.
2. Leave things as they are but describe inconsistent behavior in the javadocs 
for skip(), getSize() and getPosition() methods if there are nonconvertible 
nodes in the query result

I prefer option 1, since this behavior is consistent, and I believe that 
nonconvertible nodes in the query results means "error in the query" in 99,9% 
cases, and the user should be notified about this error more strongly than just 
log at info level. 

> Make ObjectIterator implement RangeIterator interface
> -----------------------------------------------------
>
>                 Key: JCR-1740
>                 URL: https://issues.apache.org/jira/browse/JCR-1740
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-ocm
>    Affects Versions: 1.4
>         Environment: All environments
>            Reporter: Sergey Nebolsin
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: JCR-1740.patch
>
>
> Currently, it's not possible to skip a part of results returned in the form 
> of ObjectIterator (for example, to implement db-like pagination feature with 
> offset/max parameters).
> It would be great if ObjectIterator implement RangeIterator interface, and 
> it's trivial enough since underlying NodeIterator implements this interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to