[Yanel-dev] [Yarep] Introduce an iterator to access child nodes
Michael Wechner
michael.wechner at wyona.com
Mon Nov 29 15:50:35 CET 2010
On 11/29/10 2:48 PM, Michael Wechner wrote:
> Hi
>
> In order to make Yarep more scalable re number of numbers
sorry, I mean "number of nodes"
Thanks
Michael
> per "collection" I would like to introduce a method like:
>
> Index: src/core/java/org/wyona/yarep/core/Node.java
> ===================================================================
> --- src/core/java/org/wyona/yarep/core/Node.java (revision 55016)
> +++ src/core/java/org/wyona/yarep/core/Node.java (working copy)
>
> +
> + /**
> + * Get an iterator in order to access all child nodes without
> scalability issues
> + *
> + * There is no guarantee that the nodes in the iterator will
> appear in any specific order; they are not, in particular, guaranteed
> to appear in alphabetical order.
> + *
> + * @return iterator of child nodes or empty iterator if there are
> no child nodes.
> + * @throws RepositoryException if node is not a collection or if
> a repository error occurs
> + */
> + public Iterator getIteratorOfNodes() throws RepositoryException;
>
> because the existing method
>
> public Node[] getNodes() throws RepositoryException;
>
> returning an array just doesn't scale that well.
>
> I have three questions:
>
> 1) Do think this actually makes sense?
>
> 2) What do you think about the method name and arguments? For example
> JCR is using:
>
> http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html#getNodes%28%29
>
> http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html#getNodes%28java.lang.String%29
>
>
> 3) This will break backwards compatibility in a sense that custom Node
> implementations won't compile anymore
> , whereas nobody will be forced to do an actual implementation and one
> could fix this quickly with something like:
>
> /**
> * @see org.wyona.yarep.core.Node#getIteratorOfNodes()
> */
> public Iterator getIteratorOfNodes() throws RepositoryException {
> throw new UnsupportedOperationException("TODO: Implement this
> method"); // TODO
> }
>
> Are there any objections re backwards compatibility?
>
> Thanks
>
> Michael
>
More information about the Yanel-development
mailing list