#6991 closed enhancement (fixed)
[patch][cla] New dojox.data.WikipediaStore (plus near-trivial SMD)
Reported by: | guest | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | DojoX Data | Version: | 1.1.1 |
Keywords: | Cc: | [email protected]…, [email protected]…, alex | |
Blocked By: | Blocking: |
Description
This patch provides two interfaces to Wikipedia:
- via SMD, for use with dojox.rpc.Service
- dojox.data.WikipediaStore, for higher level access
The SMD is dead simple; it just lets us talk to the API provided by the MediaWiki software, and does little other parameter checking. It gives us a fairly "raw" interface to the API.
The dojo data store provides two basic operations: 1) retrieve titles of articles containing a given text string, and 2) retrieve details for a page by title. It's basically just a customized dojox.data.ServiceStore, with some extra processing to make it easier to deal with the data returned.
The patch also contains supporting documentation and tests:
- DOH test suite for the RPC/SMD version
- A simple page grabber demo for the RPC version
- DOH test suite for the data store
- A simple page grabber demo for the data store
- Patch written & submitted under CLA by Revin Guillen
Attachments (1)
Change History (13)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Cc: | [email protected]… added |
---|
comment:4 Changed 13 years ago by
Cc: | alex added |
---|
comment:5 Changed 13 years ago by
Actually, please hold off on the review until I get a second version in; I've been in communication with kriszyp about changing up the ServiceStore? to make this implmentation simpler, so I have a replacement path in development. I'll try to submit it today.
- Revin
comment:6 Changed 13 years ago by
I can take ownership of this since I did the first review with Revin, is that all right?
comment:7 Changed 13 years ago by
OK, with Kris' recent changes to the ServiceStore in trunk, we've got a much leaner WikipediaStore in the (newly replaced) attached patch. Have at it.
comment:8 Changed 13 years ago by
I have reviewed it and it looks good to me. I can commit it in unless someone else wants to review it as well. Kris
comment:9 Changed 13 years ago by
Kris: have at. Please ensure that unit tests have full coverage before committing.
Revin, Kris: nice work = )
comment:10 Changed 13 years ago by
Owner: | changed from Jared Jurkiewicz to kriszyp |
---|
Changed 13 years ago by
Attachment: | wikipedia-store-and-tests.patch added |
---|
Wikipedia data store & SMD
comment:11 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:12 Changed 11 years ago by
Owner: | changed from kriszyp to Kris Zyp |
---|
I think this looks really cool, a few though though: First, I would think you could use the ServiceStore? paradigm of lazy loading item as instances of dojo.Deferred. If you did this, then I don't think you would need to override isItemLoaded, loadItem, and getValue, ServiceStore? would handle all of those correctly for you. In order to create a Deferred version of the lazy loaded item (that only loads once), I do something like:
for each of the stub/title only items results[i] = dojo.mixin(new dojo.Deferred(),results[i]); create a Deferred object (function(item){
})(results[i]);
Although seeing the awkwardness of this, perhaps it would be helpful if I provided a "createLazyItem" function in the ServiceStore?, something you could create lazy items with like this:
results[i] = this.createLazyItem(results[i],function(item){
});
Also, your code seems to be begging the ServiceStore? for a labelAttribute property for getLabel and getLabelAttributes :). I can certainly add that.
Last, I wonder if _fixupStarElements is worth it's weight. Is it that bad to write item*? instead of item.data? You can keep it if you want, just doesn't seem worth it to me.
Anyway, I think this looks really great, and thanks for using my ServiceStore?!