On Jul 8, 2011, at 11:31 AM, Julien Viet wrote:
>> 3/ a site should not be a Container<Page> for several
reasons
>> - pragmatic : a site can have a large number pages (2000) in some case and the
default method to get children of Container#getChildren() would drain the resource of the
server
>
> This can me mediated by having automatically paged IterableResults.
thing is that ppl will do naturally "for (Page page : site.getPages()) { }
and pages will load all pages out of the box.
what we need is an explicit way like site.getPages(Range.of(0, 10))
Since we control IterableResult (it's part of the API), we can implement an Iterator
that accesses elements via pages, loading the next page only when it's needed. At
least, I think it's possible to do so. This way people don't need to bother with
explicit paging if they don't want to and we will still preserve acceptable
performance characteristics under load.
Validating this idea is one of my goals for the first pass at the implementation.
Cordialement / Best,
Chris
==
Principal Software Engineer / JBoss Enterprise Middleware Red Hat, Inc.
Follow GateIn:
http://blog.gatein.org /
http://twitter.com/gatein
Follow me:
http://metacosm.info/metacosm /
http://twitter.com/metacosm