Hi, I'm embarking on an similar app that will have multiple data sources of varying types which will expand in the future. Data will come from feeds and services such as RSS, ATOM, SOAP as well as some bespoke APIs.
It will have many available services for the user to enable, but only a limited number can be enabled.
I was wonder what would be the best way to structure it, I was thinking something along the lines of..
Sources Definition / storage
A OPML file that defines all the possible services with url, title, poll interval, type and an enabled flag to indicate that this service is currently in use.
Then we can easily read/write/update this single file to change the sources. I think storing this in a SQLite db would be overkill?? No relational data really and would be harder to update.
A OPMLProxy to mange loading and saving of the main OPML file.
An interface IServiceProxy that defines the basic methods startPoll(), stopPoll(), pollNow(), parse() etc Or maybe an abstract that defines some more properties and private methods.
A Service class for each type of service - RssServiceProxy, AtomServiceProxy, MyApiServiceProxy -each will define parse in which ever way it needs to to extract the data required.
A ItemVO per service, RssItemVO, AtomItemVO, MyApiItemVO
The parse method of the Service class will parse to an ArrayCollection of VO's for that service. I.e RSSServiceProxy's data will be an ArrayCollection of RSSItemVO's.
An overall SerivicesProxy that has methods such as addService( service ), removeService( service ), hasService( url) that holds all the currently created services with some methods to retrieve them with some filtering perhaps getServicesByType( serviceType )
The basic set up would be load the OPML, retrieve all the enabled sources, for each instantiate an ServiceProxy based on its type (rss, atom, myApi etc), pass in a custom name for the proxy as we will have multiple instances of the same proxies as well as passing url, interval etc. Then add this instance to the main ServicesProxy and start polling it.
Does this sound ok? Is there another way without having multiple instances of the same proxies - (although i don't see this as a bad thing)
And where should the timing code that actually triggers a poll for each service live? Should this live in each ServiceProxy - the startPoll() method would create the timer for that service within the proxy (based on its individual interval value from the OPML) and obviously send a note once the data is polled a parsed.
Each service proxy would hold all the items from the last poll, the overall ServicesProxy could have methods to get everything - returning an arrayCollection containing all items from all services.
Any feedback / pointers would be much appreciated.