in src/main/java/org/apache/cxf/cwiki/SiteExporter.java [396:441]
public boolean checkRSS() throws Exception {
if (forceAll || pages == null || pages.isEmpty()) {
return false;
}
URL url = new URL(ROOT + "/createrssfeed.action?types=page&types=blogpost&types=mail&"
//+ "types=comment&" //cannot handle comment updates yet
+ "types=attachment&statuses=created&statuses=modified"
+ "&spaces=" + spaceKey + "&rssType=atom&maxResults=20&timeSpan=2"
+ "&publicFeed=true");
InputStream ins = url.openStream();
Document doc = StaxUtils.read(ins);
ins.close();
List<Element> els = DOMUtils.getChildrenWithName(doc.getDocumentElement(),
"http://www.w3.org/2005/Atom",
"entry");
// XMLUtils.printDOM(doc);
for (Element el : els) {
Element e2 = DOMUtils.getFirstChildWithName(el, "http://www.w3.org/2005/Atom", "updated");
String val = DOMUtils.getContent(e2);
XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(val);
e2 = DOMUtils.getFirstChildWithName(el, "http://www.w3.org/2005/Atom", "title");
String title = DOMUtils.getContent(e2);
Page p = findPage(title);
if (p != null) {
//found a modified page - need to rebuild
if (cal.compare(p.getModifiedTime()) > 0) {
System.out.println("(" + spaceKey + ") Changed page found: " + title);
return false;
}
} else {
BlogEntrySummary entry = findBlogEntry(title);
if (entry != null) {
// we don't have modified date so just assume it's modified
// we'll use version number to actually figure out if page is modified or not
System.out.println("(" + spaceKey + ") Possible changed blog page found: " + title);
return false;
} else {
System.out.println("(" + spaceKey + ") Did not find page for: " + title);
return false;
}
}
}
return true;
}