Detail design for Bay1Temp Atom Feed (method1 shown in the last report is used here)
1. Create an atom feed document
- New a feed
Feed theFeed = new Feed();
- Add "xmlns" attribute to the feed
theFeed.addAttribute(new Attribute("xmlns","http://www.w3.org/2005/Atom"));
- Add Author
theFeed.addAuthor(new Author("Yu(Carol) Deng"));
- Set a universally unique Id for the feed
theFeed.setId(new Id("urn:uuid:" + new UID().toString()));
- Add Title
Title feedTitle = new Title("text"); // Set title type for the feed
feedTitle.setText("Bay1Temp Atom Feed"); // Set title content
theFeed.setTitle(feedTitle); // Set the title
- Add Link
Link feedLink = new Link(); // New a Link in the feed
feedLink.setRel(new Attribute("rel", "self")); // Set "rel" attribute of the link
feedLink.setType(new Attribute("type", "application/atom+xml")); //Set "type" attribute of the link
feedLink.setHref(new Attribute("href", FeedHref)); //Set "href" attribute of the link
theFeed.addLink(feedLink); //Add the link
- Set Updated to the entry
theFeed.setUpdated(new Updated(new Date()));
2. Add an entry document to the feed
- New an Entry
parcelEntry = new Entry();
- Add Author
parcelEntry.addAuthor(new Author("Yu(Carol) Deng"));
- Add Title
Title parcelTitle = new Title("text"); // Set title type for the feed
parcelTitle.setText("SensorName, TimeStamp, DoubleData"); // Set title content
parcelEntry.setTitle(parcelTitle); // Set the title
- Set a universally unique Id for the entry
parcelEntry.setId(new Id("urn:uuid:" + new UID().toString()));
- Set Updated to the entry
Calendar cal = new GregorianCalendar();
parcelEntry.setUpdated(new Updated(cal.getTime()));
- Set the current data to the Content
parcelEntry.setContent(nodeSensorName + nodeTimeStamp + nodeDoubleData);
- Add the Entry to the feed
currentFeed.addEntry(parcelEntry);
3. Atom Feed for Bay1Temp
Bay1Temp 2007-05-17 05:15:08Z 25.5
Bay1Temp 2007-05-17 05:15:28Z 25.5content>
4. Bay1Temp Atom Feed in iGoogle
Add the url of Bay1Temp Atom Feed to iGoogle, the screen shot below shows the Atom Feed in iGoogle.
Discussion & Questions
1. In iGoogle, it shows 3 links for Bay1Temp in the feed area
-- I tried to clean some cookies or cache, but they are still there.
2. In iGoogle, after refreshing the current webpage, click the content of feed which had content, is not available for the data.
-- I kept clicking the "+" button in the feed area, data is still not available.
Future work
1. Get all sensors from a lab going to individual feeds;
2. The issues described in Discussion section