use of com.rometools.rome.feed.synd.SyndFeedImpl in project onebusaway-application-modules by camsys.
the class AgencyMessagesUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway General Notices");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("General Notices");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Agency Messages
SyndEntry agencyMsgEntry = new SyndEntryImpl();
StatusGroup agencyMsgGroup = _statusProvider.getAgencyMetadataStatus();
if (agencyMsgGroup.getItems().size() == 0) {
agencyMsgEntry = new SyndEntryImpl();
agencyMsgEntry.setTitle("No General Notices");
entries.add(agencyMsgEntry);
} else {
for (StatusItem agencyMsgItem : agencyMsgGroup.getItems()) {
agencyMsgEntry = new SyndEntryImpl();
agencyMsgEntry.setTitle(agencyMsgItem.getTitle());
entries.add(agencyMsgEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of com.rometools.rome.feed.synd.SyndFeedImpl in project onebusaway-application-modules by camsys.
the class MonitoringAlertsUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway System Monitoring");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("System Monitoring");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Icinga Alerts
SyndEntry icingaEntry = new SyndEntryImpl();
SyndContent icingaContent = new SyndContentImpl();
StatusGroup icingaGroup = _statusProvider.getIcingaStatus();
StatusGroup icingaProblems = new StatusGroup();
icingaProblems.setTitle(icingaGroup.getTitle());
// Only report items where status is not "OK"
for (StatusItem icingaItem : icingaGroup.getItems()) {
if (icingaItem.getStatus() != StatusItem.Status.OK) {
icingaProblems.addItem(icingaItem);
}
}
if (icingaProblems.getItems().size() == 0) {
icingaEntry = new SyndEntryImpl();
icingaEntry.setTitle("All systems operational");
entries.add(icingaEntry);
} else {
for (StatusItem icingaItem : icingaProblems.getItems()) {
icingaEntry = new SyndEntryImpl();
icingaEntry.setTitle(icingaItem.getTitle());
icingaContent = new SyndContentImpl();
icingaContent.setValue(icingaItem.getStatus() + ": " + icingaItem.getDescription());
icingaEntry.setDescription(icingaContent);
entries.add(icingaEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of com.rometools.rome.feed.synd.SyndFeedImpl in project onebusaway-application-modules by camsys.
the class ServiceAlertsUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway Agency Advisories");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("Service Alerts");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Service Alerts
SyndEntry serviceAlertEntry = new SyndEntryImpl();
SyndContent saContent = new SyndContentImpl();
StatusGroup saGroup = _statusProvider.getAgencyServiceAlertStatus();
if (saGroup.getItems().size() == 0) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle("All systems operational");
entries.add(serviceAlertEntry);
} else {
for (StatusItem saItem : saGroup.getItems()) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle(saItem.getTitle());
saContent = new SyndContentImpl();
saContent.setValue(saItem.getDescription());
serviceAlertEntry.setDescription(saContent);
entries.add(serviceAlertEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of com.rometools.rome.feed.synd.SyndFeedImpl in project onebusaway-application-modules by camsys.
the class StatusUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway System Status");
String baseUrl = createBaseUrl(ServletActionContext.getRequest());
_feed.setTitle(title.toString());
// _feed.setLink(baseUrl);
_feed.setLink("");
_feed.setDescription("System Status");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
setIcingaAlerts(entries, baseUrl);
setAgencyServiceAlerts(entries, baseUrl);
setAgencyMessages(entries, baseUrl);
_feed.setEntries(entries);
return SUCCESS;
}
use of com.rometools.rome.feed.synd.SyndFeedImpl in project asterixdb by apache.
the class RSSFeedServlet method getFeed.
protected SyndFeed getFeed(IServletRequest req) throws IOException, FeedException, ParseException {
SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Sample Feed (created with ROME)");
feed.setLink("http://rome.dev.java.net");
feed.setDescription("This feed has been created using ROME (Java syndication utilities");
List<SyndEntry> entries = new ArrayList<>();
SyndEntry entry;
SyndContent description;
entry = new SyndEntryImpl();
entry.setTitle("AsterixDB 0.8.7");
entry.setLink("http://http://asterixdb.apache.org/docs/0.8.7-incubating/index.html");
entry.setPublishedDate(DATE_PARSER.parse("2012-06-08"));
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("AsterixDB 0.8.7 Release");
entry.setDescription(description);
entries.add(entry);
entry = new SyndEntryImpl();
entry.setTitle("Couchbase 4.1");
entry.setLink("http://blog.couchbase.com/2015/december/introducing-couchbase-server-4.1");
entry.setPublishedDate(DATE_PARSER.parse("2015-12-09"));
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("Couchbase Server 4.1 Release. Bug fixes, minor API changes and some new features");
entry.setDescription(description);
entries.add(entry);
entry = new SyndEntryImpl();
entry.setTitle("ROME v0.3");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/rome03");
entry.setPublishedDate(DATE_PARSER.parse("2004-07-27"));
description = new SyndContentImpl();
description.setType("text/html");
description.setValue("<p>Bug fixes, API changes, some new features and some Unit testing</p>" + "<p>For details check the <a href=\"https://rometools.jira.com/wiki/display/ROME/Change+Log#" + "ChangeLog-Changesmadefromv0.3tov0.4\">Changes Log for 0.3</a></p>");
entry.setDescription(description);
entries.add(entry);
entry = new SyndEntryImpl();
entry.setTitle("ROME v0.4");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/rome04");
entry.setPublishedDate(DATE_PARSER.parse("2004-09-24"));
description = new SyndContentImpl();
description.setType("text/html");
description.setValue("<p>Bug fixes, API changes, some new features, Unit testing completed</p>" + "<p>For details check the <a href=\"https://rometools.jira.com/wiki/display/ROME/Change+Log#" + "ChangeLog-Changesmadefromv0.4tov0.5\">Changes Log for 0.4</a></p>");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries);
return feed;
}
Aggregations