This struggle came up because I was trying to generically handle paging for either a relational database or LDAP repository, since the end user can choose either type to store their information.
Databases have several ways of handling paging, both within the query itself or, if it supports scrollable cursors, specifying the position of the cursor in the result set and getting a page of data from there.
I figured there must be something similar for LDAP repositories. Sadly, no. The closest in functionality was an RFC proposal for Virtual List Views. It wasn't accepted and while some Java API was developed for it in the JNDI booster back released for Java 1.4, I've been unable to find any updates for Java 5.
What there is something called Simple Paged Results (RFC 2696). The way it works is you specify the size of your page and the server will give you that many records and a cookie that you must pass in on future requests. You can't change the cookie, which means you're limited to only going forward. This seems a bit annoying when compared to database paging and I just figured there must be something that was equivalent.
Finally I started thinking about what I was using it for and why I would need bi-directional paging. The plan was to use this paging to get thousands to tens of thousands of records at a time. If there was a need to display small pages (like for a UI screen, then I'd let it worry about making smaller pages. The only reason I can see for needing to page backwards would be for a user at a UI screen.
How likely is it that someone is going to want (let alone need) to go through tens of thousands of entries and be able to page backwards? Something, tells me having a limit on the number of requests returned is just fine for the UI. For anything needing to get all of the data there's still the Simple Paged Results that will work just fine.
Glad I stopped fixating on the differences between RDB and LDAP paging and thinking about how it was going to be used...
No comments:
Post a Comment