From bb82a69e57458f1d177d57308830943025c26526 Mon Sep 17 00:00:00 2001 From: Jose Anes Date: Wed, 21 Oct 2026 14:52:08 -0400 Subject: [PATCH 1/4] NMS-14732: Remove Slack and Mattermost confd templates The Slack and Mattermost notification strategies were replaced by the Webhook strategy, and nothing reads the org.opennms.netmgt.notifd.slack.* or .mattermost.* properties these templates generated: git grep finds them only in the templates and the webhook migration table in the docs. No container entrypoint, test or other confd file refers to the templates. The matching sections of CONFD_README.md go with them. confd ignores keys that have no template, so an existing horizon-config.yaml that still sets opennms.notifd.slack or .mattermost keeps working. --- opennms-container/core/CONFD_README.md | 35 ------------------- .../confd/conf.d/mattermost.properties.toml | 6 ---- .../confd/conf.d/slack.properties.toml | 6 ---- .../templates/mattermost.properties.tmpl | 12 ------- .../confd/templates/slack.properties.tmpl | 12 ------- 5 files changed, 71 deletions(-) delete mode 100644 opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml delete mode 100644 opennms-container/core/container-fs/confd/conf.d/slack.properties.toml delete mode 100644 opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl delete mode 100644 opennms-container/core/container-fs/confd/templates/slack.properties.tmpl diff --git a/opennms-container/core/CONFD_README.md b/opennms-container/core/CONFD_README.md index f5605c3338fb..d3c017296871 100644 --- a/opennms-container/core/CONFD_README.md +++ b/opennms-container/core/CONFD_README.md @@ -9,41 +9,6 @@ specific configuration files will overwrite the corresponding config provided by ## Contents The following describes the keys that can be specified in `horizon-config.yaml` to configure Horizon via confd. -### Slack - -``` ---- -opennms: - notifd: - slack: - webhookURL: https://url.com - channel: alerting - userName: username - iconEmoji: :metal: - iconURL: https://url.com/picture - useSystemProxy: false -``` - -Config specified will be written to `etc/opennms.properties.d/_confd.slack.properties`. Check the docs for detailed information about the Slack configuration parameters. - -### Mattermost - -``` ---- -opennms: - notifd: - mattermost: - webhookURL: https://url.com - channel: alerting - userName: username - iconEmoji: :metal: - iconURL: https://url.com/picture - useSystemProxy: false -``` - -Config specified will be written to `etc/opennms.properties.d/_confd.mattermost.properties`. Check the docs for detailed information about the Mattermost configuration parameters. - - ### Newts ``` diff --git a/opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml b/opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml deleted file mode 100644 index bda8e78ebff4..000000000000 --- a/opennms-container/core/container-fs/confd/conf.d/mattermost.properties.toml +++ /dev/null @@ -1,6 +0,0 @@ -[template] -src = "mattermost.properties.tmpl" -dest = "/opt/opennms/etc/opennms.properties.d/_confd.mattermost.properties" -keys = [ - "opennms/notifd/mattermost", -] diff --git a/opennms-container/core/container-fs/confd/conf.d/slack.properties.toml b/opennms-container/core/container-fs/confd/conf.d/slack.properties.toml deleted file mode 100644 index caf6ce6af296..000000000000 --- a/opennms-container/core/container-fs/confd/conf.d/slack.properties.toml +++ /dev/null @@ -1,6 +0,0 @@ -[template] -src = "slack.properties.tmpl" -dest = "/opt/opennms/etc/opennms.properties.d/_confd.slack.properties" -keys = [ - "opennms/notifd/slack", -] diff --git a/opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl b/opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl deleted file mode 100644 index ecc00209c42e..000000000000 --- a/opennms-container/core/container-fs/confd/templates/mattermost.properties.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -# -# DON'T EDIT THIS FILE :: GENERATED WITH CONFD -# - -{{$mattermostPath := "/opennms/notifd/mattermost/" -}} - -org.opennms.netmgt.notifd.mattermost.webhookURL={{getv (print $mattermostPath "webhookURL") "Webhook URL"}} -org.opennms.netmgt.notifd.mattermost.channel={{getv (print $mattermostPath "channel") "Webhook"}} -org.opennms.netmgt.notifd.mattermost.username={{getv (print $mattermostPath "userName") "none"}} -org.opennms.netmgt.notifd.mattermost.iconEmoji={{getv (print $mattermostPath "iconEmoji") ""}} -org.opennms.netmgt.notifd.mattermost.iconURL={{getv (print $mattermostPath "iconURL") ""}} -org.opennms.netmgt.notifd.mattermost.useSystemProxy={{getv (print $mattermostPath "useSystemProxy") "true"}} diff --git a/opennms-container/core/container-fs/confd/templates/slack.properties.tmpl b/opennms-container/core/container-fs/confd/templates/slack.properties.tmpl deleted file mode 100644 index 3306ceba4e13..000000000000 --- a/opennms-container/core/container-fs/confd/templates/slack.properties.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -# -# DON'T EDIT THIS FILE :: GENERATED WITH CONFD -# - -{{$slackPath := "/opennms/notifd/slack/" -}} - -org.opennms.netmgt.notifd.slack.webhookURL={{getv (print $slackPath "webhookURL") "Webhook URL"}} -org.opennms.netmgt.notifd.slack.channel={{getv (print $slackPath "channel") "Webhook"}} -org.opennms.netmgt.notifd.slack.username={{getv (print $slackPath "userName") "none"}} -org.opennms.netmgt.notifd.slack.iconEmoji={{getv (print $slackPath "iconEmoji") ""}} -org.opennms.netmgt.notifd.slack.iconURL={{getv (print $slackPath "iconURL") ""}} -org.opennms.netmgt.notifd.slack.useSystemProxy={{getv (print $slackPath "useSystemProxy") "true"}} From 72ac784a869f08b6f04cffdb88d5de259ce5bad8 Mon Sep 17 00:00:00 2001 From: Jose Anes Date: Wed, 21 Oct 2026 14:52:31 -0400 Subject: [PATCH 2/4] NMS-14732: Remove remote-poller-gwt.css The remote poller and its GWT UI were removed in NMS-12653. The stylesheet was only built because webpack turns every file under assets/style into an entry; git grep finds no reference to remote-poller-gwt in any JSP, GWT module, webpack/package config, Java or other stylesheet. --- .../main/assets/style/remote-poller-gwt.css | 120 ------------------ 1 file changed, 120 deletions(-) delete mode 100644 core/web-assets/src/main/assets/style/remote-poller-gwt.css diff --git a/core/web-assets/src/main/assets/style/remote-poller-gwt.css b/core/web-assets/src/main/assets/style/remote-poller-gwt.css deleted file mode 100644 index acb84967ea8f..000000000000 --- a/core/web-assets/src/main/assets/style/remote-poller-gwt.css +++ /dev/null @@ -1,120 +0,0 @@ -body { - margin: 0px; - padding: 0px; - background: #FFF; - color: #000; - font-family: "Lucida Grande", Verdana, sans-serif; - height: 100%; -} -#header { - position: relative; - margin: 0; - padding: 0; - background-color: #333; - background-image: url(../images/headerbg.png); - background-repeat: repeat-x; - color: #FFF; - font-family: "Lucida Grande", Verdana, sans-serif; - font-size: 119%; -} -#header a { - color:#FFF; - text-decoration: none; -} -#header a:hover { - text-decoration: underline; -} -#header img { - border: 0 none; -} -#header hr { - clear:both; - height:0; - margin:0; - padding:0; - position:relative; - visibility:hidden; -} -#headerlogo { - position: absolute; - z-index: 2; - margin: 0; - padding: 0; - left: 15px; - top: 13px; -} -#headerinfo { - position: relative; - margin: 0; - padding: 10px; - text-align: right; - padding-bottom: 20px; -} -#headerinfo h1,h2,h3,h4,h5,h6 { - font-size: 100%; -} -#headerinfo h2 { - margin: 0; - padding: 0; -} -#headerinfo p,td,th,li { - margin: 0; - padding: 0; - font-size:70%; - line-height:1.25em; -} -#headerdate { - float: right; - text-align: right; - font-weight: bold; - vertical-align: middle; -} - -#headernavbarright { - position: relative; - float: right; - padding: 2px 0px 5px 0px; -} -.navbar ul -{ - list-style: none; - display: inline; - margin: 0; - padding: 0; -} - -.navbar li -{ - padding: 0 10px 5px 0; - list-style: none; - display: inline; - color: #999; -} - -#linkbar -{ - padding: 0 0 1em 0; -} - -#linkbar ul -{ - list-style: none; - display: inline; - padding: 0 0 0 0; -} - -#linkbar li -{ - list-style: none; - display: inline; - padding-right: 0.75em; -} -#content -{ - background-image: url("../images/mainbg.png"); - background-repeat: repeat-x; - background-color: #eeeeee; - margin:0; - padding: 0; -/* padding:15px 20px 30px; */ -} From 50b9895acf5be5ec3993d39e3f6dbc707f1cb63b Mon Sep 17 00:00:00 2001 From: Jose Anes Date: Wed, 21 Oct 2026 14:52:57 -0400 Subject: [PATCH 3/4] NMS-14732: Remove rss.jsp RSS feeds were removed long ago and rss.jsp now holds only the license header and a stray "%>", so it renders an empty page. git grep finds no link to it from web.xml, menus, other JSPs, Java, or tests; the only remaining mentions are the /rss.jsp* Basic-auth chain in applicationContext-spring-security.xml and an Acegi-era example in the Dashboard docs, both left as they are. A request for /rss.jsp now gets a 404 instead of an empty 200. --- opennms-webapp/src/main/webapp/rss.jsp | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 opennms-webapp/src/main/webapp/rss.jsp diff --git a/opennms-webapp/src/main/webapp/rss.jsp b/opennms-webapp/src/main/webapp/rss.jsp deleted file mode 100644 index bd708c6cf040..000000000000 --- a/opennms-webapp/src/main/webapp/rss.jsp +++ /dev/null @@ -1,24 +0,0 @@ -<%-- - - Licensed to The OpenNMS Group, Inc (TOG) under one or more - contributor license agreements. See the LICENSE.md file - distributed with this work for additional information - regarding copyright ownership. - - TOG licenses this file to You under the GNU Affero General - Public License Version 3 (the "License") or (at your option) - any later version. You may not use this file except in - compliance with the License. You may obtain a copy of the - License at: - - https://www.gnu.org/licenses/agpl-3.0.txt - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - either express or implied. See the License for the specific - language governing permissions and limitations under the - License. - ---%> -%> From bfed61348eb08a1b7db13b68e79cfbd40e6851f4 Mon Sep 17 00:00:00 2001 From: Jose Anes Date: Fri, 23 Oct 2026 08:47:09 -0400 Subject: [PATCH 4/4] NMS-14732: Remove the RSS feed classes and their security chain rss.jsp was the only user of the org.opennms.web.rss feed classes and the only URL matched by the BASIC-auth /rss.jsp* filter chain, so both are dead now that the page is gone. The feed classes were also the only users of ROME, so the dependency and its dependencyManagement entry go too; the webapp's runtime dependencies lose rome and rome-utils and nothing else. --- opennms-webapp/pom.xml | 14 -- .../org/opennms/web/rss/AbstractFeed.java | 182 ------------------ .../java/org/opennms/web/rss/AlarmFeed.java | 133 ------------- .../java/org/opennms/web/rss/EventFeed.java | 130 ------------- .../main/java/org/opennms/web/rss/Feed.java | 98 ---------- .../org/opennms/web/rss/NotificationFeed.java | 98 ---------- .../java/org/opennms/web/rss/OutageFeed.java | 123 ------------ .../applicationContext-spring-security.xml | 15 -- pom.xml | 5 - 9 files changed, 798 deletions(-) delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/AbstractFeed.java delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/AlarmFeed.java delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/EventFeed.java delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/Feed.java delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/NotificationFeed.java delete mode 100644 opennms-webapp/src/main/java/org/opennms/web/rss/OutageFeed.java diff --git a/opennms-webapp/pom.xml b/opennms-webapp/pom.xml index 4cbdcfc6db08..d42c4adc1de5 100644 --- a/opennms-webapp/pom.xml +++ b/opennms-webapp/pom.xml @@ -805,20 +805,6 @@ - - com.rometools - rome - - - jdom - jdom - - - org.jdom - jdom2 - - - diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/AbstractFeed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/AbstractFeed.java deleted file mode 100644 index ea1027b69713..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/AbstractFeed.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import java.io.StringWriter; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.io.SyndFeedOutput; - -/** - *

AbstractFeed class.

- * - * @author Benjamin Reed - * @version $Id: $ - * @since 1.8.1 - */ -public abstract class AbstractFeed implements Feed { - - private static final Logger LOG = LoggerFactory.getLogger(AbstractFeed.class); - - protected int m_maxEntries = 20; - protected String m_feedType = "rss_2.0"; - protected String m_urlBase = ""; - protected ServletRequest m_servletRequest; - - private ServletContext m_servletContext; - - /** - *

Constructor for AbstractFeed.

- */ - public AbstractFeed() { - } - - /** - *

Constructor for AbstractFeed.

- * - * @param feedType a {@link java.lang.String} object. - */ - public AbstractFeed(String feedType) { - setFeedType(feedType); - } - - /** - *

getUrlBase

- * - * @return a {@link java.lang.String} object. - */ - @Override - public final String getUrlBase() { - return m_urlBase; - } - - /** {@inheritDoc} */ - @Override - public final void setUrlBase(String urlBase) { - m_urlBase = urlBase; - } - - /** - *

getFeedType

- * - * @return a {@link java.lang.String} object. - */ - @Override - public final String getFeedType() { - return m_feedType; - } - - /** {@inheritDoc} */ - @Override - public final void setFeedType(String feedType) { - m_feedType = feedType; - } - - /** - *

getMaxEntries

- * - * @return a int. - */ - @Override - public final int getMaxEntries() { - return m_maxEntries; - } - - /** {@inheritDoc} */ - @Override - public final void setMaxEntries(int maxEntries) { - m_maxEntries = maxEntries; - } - - /** - *

getRequest

- * - * @return a {@link javax.servlet.ServletRequest} object. - */ - @Override - public final ServletRequest getRequest() { - return m_servletRequest; - } - - /** {@inheritDoc} */ - @Override - public final void setRequest(ServletRequest request) { - m_servletRequest = request; - } - - /** {@inheritDoc} */ - @Override - public final ServletContext getServletContext() { - return m_servletContext; - } - - /** {@inheritDoc} */ - @Override - public final void setServletContext(ServletContext context) { - m_servletContext = context; - } - - /** - *

getFeed

- * - * @return a {@link com.rometools.rome.feed.synd.SyndFeed} object. - */ - public abstract SyndFeed getFeed(); - - /** - *

render

- * - * @return a {@link java.lang.String} object. - */ - @Override - public final String render() { - SyndFeed feed = this.getFeed(); - feed.setFeedType(this.getFeedType()); - feed.setAuthor("OpenNMS"); - - SyndFeedOutput output = new SyndFeedOutput(); - try { - StringWriter writer = new StringWriter(); - output.output(feed, writer); - return writer.toString(); - } catch (Throwable e) { - LOG.warn("unable to render feed", e); - return ""; - } - } - - /** - *

sanitizeTitle

- * - * @param title a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - protected String sanitizeTitle(String title) { - return title.replaceAll("<.*?>", ""); - } -} diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/AlarmFeed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/AlarmFeed.java deleted file mode 100644 index 6785dbc06745..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/AlarmFeed.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import java.util.ArrayList; -import java.util.List; - -import org.opennms.core.spring.BeanUtils; -import org.opennms.core.utils.WebSecurityUtils; -import org.opennms.netmgt.dao.api.AlarmRepository; -import org.opennms.netmgt.model.OnmsAlarm; -import org.opennms.netmgt.model.OnmsCriteria; -import org.opennms.netmgt.model.OnmsSeverity; -import org.opennms.web.alarm.AcknowledgeType; -import org.opennms.web.alarm.AlarmUtil; -import org.opennms.web.alarm.SortStyle; -import org.opennms.web.alarm.filter.AlarmCriteria; -import org.opennms.web.alarm.filter.NodeFilter; -import org.opennms.web.alarm.filter.SeverityFilter; -import org.opennms.web.filter.Filter; - -import com.rometools.rome.feed.synd.SyndContent; -import com.rometools.rome.feed.synd.SyndContentImpl; -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.feed.synd.SyndFeedImpl; - -/** - *

AlarmFeed class.

- * - * @author Ben Reed - * @author Tarus Balog - */ -public class AlarmFeed extends AbstractFeed { - - private AlarmRepository m_webAlarmRepository; - - public AlarmFeed() { - super(); - initialize(); - } - - public AlarmFeed(String feedType) { - super(feedType); - initialize(); - } - - private void initialize() { - m_webAlarmRepository = BeanUtils.getBean("daoContext", "alarmRepository", AlarmRepository.class); - } - - /** - *

getFeed

- * - * @return a {@link com.rometools.rome.feed.synd.SyndFeed} object. - */ - @Override - public SyndFeed getFeed() { - SyndFeed feed = new SyndFeedImpl(); - - feed.setTitle("Alarms"); - feed.setDescription("OpenNMS Alarms"); - feed.setLink(getUrlBase() + "alarm/list.htm"); - - List entries = new ArrayList<>(); - - List filters = new ArrayList<>(); - if (this.getRequest().getParameter("node") != null) { - Integer nodeId = WebSecurityUtils.safeParseInt(this.getRequest().getParameter("node")); - filters.add(new NodeFilter(nodeId, getServletContext())); - } - if (this.getRequest().getParameter("severity") != null) { - String sev = this.getRequest().getParameter("severity"); - for (OnmsSeverity severity : OnmsSeverity.values()) { - if (severity.getLabel().equalsIgnoreCase(sev)) { - filters.add(new SeverityFilter(severity)); - } - } - - } - - OnmsCriteria queryCriteria = AlarmUtil.getOnmsCriteria(new AlarmCriteria(filters.toArray(new Filter[] {}), SortStyle.FIRSTEVENTTIME, AcknowledgeType.BOTH, this.getMaxEntries(), AlarmCriteria.NO_OFFSET)); - - OnmsAlarm[] alarms = m_webAlarmRepository.getMatchingAlarms(queryCriteria); - - SyndEntry entry; - - for (OnmsAlarm alarm : alarms) { - entry = new SyndEntryImpl(); - entry.setPublishedDate(alarm.getFirstEventTime()); - if (alarm.getAckTime() != null) { - entry.setTitle(sanitizeTitle(alarm.getLogMsg()) + " (acknowledged by " + alarm.getAckUser() + ")"); - entry.setUpdatedDate(alarm.getAckTime()); - } else { - entry.setTitle(sanitizeTitle(alarm.getLogMsg())); - entry.setUpdatedDate(alarm.getFirstEventTime()); - } - entry.setLink(getUrlBase() + "alarm/detail.htm?id=" + alarm.getId()); - entry.setAuthor("OpenNMS"); - - SyndContent content = new SyndContentImpl(); - content.setType("text/html"); - content.setValue(alarm.getDescription()); - entry.setDescription(content); - - entries.add(entry); - } - - feed.setEntries(entries); - return feed; - } - -} diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/EventFeed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/EventFeed.java deleted file mode 100644 index bc3895f22f39..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/EventFeed.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.opennms.core.utils.WebSecurityUtils; -import org.opennms.netmgt.model.OnmsSeverity; -import org.opennms.web.event.AcknowledgeType; -import org.opennms.web.event.Event; -import org.opennms.web.event.EventFactory; -import org.opennms.web.event.SortStyle; -import org.opennms.web.event.filter.NodeFilter; -import org.opennms.web.event.filter.SeverityFilter; -import org.opennms.web.filter.Filter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.rometools.rome.feed.synd.SyndContent; -import com.rometools.rome.feed.synd.SyndContentImpl; -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.feed.synd.SyndFeedImpl; - - -/** - *

EventFeed class.

- * - * @author Benjamin Reed - * @version $Id: $ - * @since 1.8.1 - */ -public class EventFeed extends AbstractFeed { - - private static final Logger LOG = LoggerFactory.getLogger(EventFeed.class); - - - /** - *

getFeed

- * - * @return a {@link com.rometools.rome.feed.synd.SyndFeed} object. - */ - @Override - public SyndFeed getFeed() { - SyndFeed feed = new SyndFeedImpl(); - - feed.setTitle("Events"); - feed.setDescription("OpenNMS Events"); - feed.setLink(getUrlBase() + "event/list.htm"); - - List entries = new ArrayList<>(); - - try { - Event[] events; - - ArrayList filters = new ArrayList<>(); - if (this.getRequest().getParameter("node") != null) { - Integer nodeId = WebSecurityUtils.safeParseInt(this.getRequest().getParameter("node")); - filters.add(new NodeFilter(nodeId, getServletContext())); - } - if (this.getRequest().getParameter("severity") != null) { - String parameter = this.getRequest().getParameter("severity"); - try { - Integer severityId = WebSecurityUtils.safeParseInt(parameter); - filters.add(new SeverityFilter(severityId)); - } catch (NumberFormatException e) { - for (OnmsSeverity sev : OnmsSeverity.values()) { - if (sev.getLabel().equalsIgnoreCase(parameter)) { - filters.add(new SeverityFilter(sev)); - break; - } - } - } - } - - events = EventFactory.getEvents(SortStyle.TIME, AcknowledgeType.BOTH, filters.toArray(new Filter[] {}), this.getMaxEntries(), 0); - - SyndEntry entry; - - for (Event event : events) { - entry = new SyndEntryImpl(); - entry.setPublishedDate(event.getTime()); - if (event.getAcknowledgeTime() != null) { - entry.setTitle(sanitizeTitle(event.getLogMessage()) + " (Acknowledged by " + event.getAcknowledgeUser() + ")"); - entry.setUpdatedDate(event.getAcknowledgeTime()); - } else { - entry.setTitle(sanitizeTitle(event.getLogMessage())); - entry.setUpdatedDate(event.getTime()); - } - entry.setLink(getUrlBase() + "event/detail.jsp?id=" + event.getId()); - entry.setAuthor("OpenNMS"); - - SyndContent content = new SyndContentImpl(); - content.setType("text/html"); - content.setValue(event.getDescription()); - entry.setDescription(content); - - entries.add(entry); - } - } catch (SQLException e) { - LOG.warn("unable to get event(s)", e); - } - - feed.setEntries(entries); - return feed; - } - -} diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/Feed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/Feed.java deleted file mode 100644 index a428a70953a1..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/Feed.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; - -/** - *

Feed interface.

- * - * @author Benjamin Reed - * @version $Id: $ - * @since 1.8.1 - */ -public interface Feed { - - /** - *

getUrlBase

- * - * @return a {@link java.lang.String} object. - */ - String getUrlBase(); - /** - *

setUrlBase

- * - * @param base a {@link java.lang.String} object. - */ - void setUrlBase(String base); - - /** - *

getFeedType

- * - * @return a {@link java.lang.String} object. - */ - String getFeedType(); - /** - *

setFeedType

- * - * @param type a {@link java.lang.String} object. - */ - void setFeedType(String type); - - /** - *

getMaxEntries

- * - * @return a int. - */ - int getMaxEntries(); - /** - *

setMaxEntries

- * - * @param maxEntries a int. - */ - void setMaxEntries(int maxEntries); - - /** - *

getRequest

- * - * @return a {@link javax.servlet.ServletRequest} object. - */ - ServletRequest getRequest(); - /** - *

setRequest

- * - * @param request a {@link javax.servlet.ServletRequest} object. - */ - void setRequest(ServletRequest request); - - ServletContext getServletContext(); - - void setServletContext(ServletContext context); - - /** - *

render

- * - * @return a {@link java.lang.String} object. - */ - String render(); -} diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/NotificationFeed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/NotificationFeed.java deleted file mode 100644 index 510290f9ae4f..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/NotificationFeed.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.opennms.web.notification.Notification; -import org.opennms.web.notification.NotificationModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.feed.synd.SyndFeedImpl; - -/** - *

NotificationFeed class.

- * - * @author Benjamin Reed - * @version $Id: $ - * @since 1.8.1 - */ -public class NotificationFeed extends AbstractFeed { - - private static final Logger LOG = LoggerFactory.getLogger(NotificationFeed.class); - - - /** - *

getFeed

- * - * @return a {@link com.rometools.rome.feed.synd.SyndFeed} object. - */ - @Override - public SyndFeed getFeed() { - SyndFeed feed = new SyndFeedImpl(); - - feed.setTitle("Notifications"); - feed.setDescription("Notifications"); - feed.setLink(getUrlBase() + "notification/browse"); - - List entries = new ArrayList<>(); - - try { - NotificationModel model = new NotificationModel(); - Notification[] notifications = model.allNotifications("desc"); - - SyndEntry entry; - - int count = 0; - for (Notification notification : notifications) { - if (count++ == this.getMaxEntries()) { - break; - } - entry = new SyndEntryImpl(); - entry.setPublishedDate(notification.getTimeSent()); - if (notification.getTimeReplied() == null) { - entry.setTitle(sanitizeTitle(notification.getTextMessage())); - entry.setUpdatedDate(notification.getTimeSent()); - } else { - entry.setTitle(sanitizeTitle(notification.getTextMessage()) + " (acknowledged)"); - entry.setUpdatedDate(notification.getTimeReplied()); - } - entry.setLink(getUrlBase() + "notification/detail.jsp?notice=" + notification.getId()); - entry.setAuthor("OpenNMS"); - - entries.add(entry); - } - } catch (SQLException e) { - LOG.warn("unable to get outstanding notifications", e); - } - - feed.setEntries(entries); - return feed; - } - -} diff --git a/opennms-webapp/src/main/java/org/opennms/web/rss/OutageFeed.java b/opennms-webapp/src/main/java/org/opennms/web/rss/OutageFeed.java deleted file mode 100644 index eff32719bdd0..000000000000 --- a/opennms-webapp/src/main/java/org/opennms/web/rss/OutageFeed.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to The OpenNMS Group, Inc (TOG) under one or more - * contributor license agreements. See the LICENSE.md file - * distributed with this work for additional information - * regarding copyright ownership. - * - * TOG licenses this file to You under the GNU Affero General - * Public License Version 3 (the "License") or (at your option) - * any later version. You may not use this file except in - * compliance with the License. You may obtain a copy of the - * License at: - * - * https://www.gnu.org/licenses/agpl-3.0.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.opennms.web.rss; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.opennms.netmgt.model.outage.OutageSummary; -import org.opennms.web.outage.OutageModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.feed.synd.SyndFeedImpl; - -/** - *

OutageFeed class.

- * - * @author Benjamin Reed - * @version $Id: $ - * @since 1.8.1 - */ -public class OutageFeed extends AbstractFeed { - - private static final Logger LOG = LoggerFactory.getLogger(OutageFeed.class); - - - /** - *

Constructor for OutageFeed.

- */ - public OutageFeed() { - super(); - // date-based - setMaxEntries(Integer.MAX_VALUE); - } - - /** - *

Constructor for OutageFeed.

- * - * @param feedType a {@link java.lang.String} object. - */ - public OutageFeed(String feedType) { - super(feedType); - // date-based - setMaxEntries(Integer.MAX_VALUE); - } - - /** - *

getFeed

- * - * @return a {@link com.rometools.rome.feed.synd.SyndFeed} object. - */ - @Override - public SyndFeed getFeed() { - SyndFeed feed = new SyndFeedImpl(); - - feed.setTitle("Nodes with Outages"); - feed.setDescription("OpenNMS Nodes with Outages"); - feed.setLink(getUrlBase() + "outage/list.htm"); - - List entries = new ArrayList<>(); - - try { - Date date = new Date(); - date.setTime(date.getTime() - (1000 * 60 * 60 * 24)); - OutageSummary[] summaries = OutageModel.getAllOutageSummaries(date); - - SyndEntry entry; - - int count = 0; - for (OutageSummary summary : summaries) { - if (count++ == this.getMaxEntries()) { - break; - } - String link = getUrlBase() + "element/node.jsp?node=" + summary.getNodeId(); - - entry = new SyndEntryImpl(); - entry.setPublishedDate(summary.getTimeDown()); - - if (summary.getTimeUp() == null) { - entry.setTitle(sanitizeTitle(summary.getNodeLabel())); - entry.setUpdatedDate(summary.getTimeDown()); - } else { - entry.setTitle(sanitizeTitle(summary.getNodeLabel()) + " (Resolved)"); - entry.setUpdatedDate(summary.getTimeUp()); - } - entry.setLink(link); - entry.setAuthor("OpenNMS"); - - entries.add(entry); - } - } catch (SQLException e) { - LOG.warn("unable to get current outages", e); - } - - feed.setEntries(entries); - return feed; - } - -} diff --git a/opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml b/opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml index c9ec43976eec..3e9fd4dd6595 100644 --- a/opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml +++ b/opennms-webapp/src/main/webapp/WEB-INF/applicationContext-spring-security.xml @@ -392,21 +392,6 @@ - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 6ce272c6ffa3..4f564ba52e7a 100644 --- a/pom.xml +++ b/pom.xml @@ -5341,11 +5341,6 @@ protobuf-java ${protobufVersion}
- - com.rometools - rome - 1.18.0 - com.ximpleware vtd-xml