/opennms-alarms/syslog-northbounder/src/main/java/org/opennms/netmgt/alarmd/northbounder/syslog/SyslogNorthbounderConfig.java

https://github.com/ajakubo1/opennms · Java · 135 lines · 77 code · 24 blank · 34 comment · 2 complexity · 6757067e40182c924c8eee82f875dd8e MD5 · raw file

  1. /*******************************************************************************
  2. * This file is part of OpenNMS(R).
  3. *
  4. * Copyright (C) 2013 The OpenNMS Group, Inc.
  5. * OpenNMS(R) is Copyright (C) 1999-2013 The OpenNMS Group, Inc.
  6. *
  7. * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
  8. *
  9. * OpenNMS(R) is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published
  11. * by the Free Software Foundation, either version 3 of the License,
  12. * or (at your option) any later version.
  13. *
  14. * OpenNMS(R) is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with OpenNMS(R). If not, see:
  21. * http://www.gnu.org/licenses/
  22. *
  23. * For more information contact:
  24. * OpenNMS(R) Licensing <license@opennms.org>
  25. * http://www.opennms.org/
  26. * http://www.opennms.com/
  27. *******************************************************************************/
  28. package org.opennms.netmgt.alarmd.northbounder.syslog;
  29. import java.io.Serializable;
  30. import java.util.List;
  31. import javax.xml.bind.annotation.XmlAccessType;
  32. import javax.xml.bind.annotation.XmlAccessorType;
  33. import javax.xml.bind.annotation.XmlElement;
  34. import javax.xml.bind.annotation.XmlRootElement;
  35. /**
  36. * Configuration for Syslog NBI implementation.
  37. * FIXME: This needs lots of work.
  38. *
  39. * @author <a mailto:david@opennms.org>David Hustace</a>
  40. */
  41. @XmlRootElement(name="syslog-northbounder-config")
  42. @XmlAccessorType(XmlAccessType.FIELD)
  43. public class SyslogNorthbounderConfig implements Serializable {
  44. private static final long serialVersionUID = 1L;
  45. @XmlElement(name="enabled", required=false, defaultValue="false")
  46. private Boolean m_enabled;
  47. @XmlElement(name="nagles-delay", required=false, defaultValue="1000")
  48. private Integer m_naglesDelay = 1000;
  49. @XmlElement(name="batch-size", required=false, defaultValue="100")
  50. private Integer m_batchSize = 100;
  51. @XmlElement(name="queue-size", required=false, defaultValue="300000")
  52. private Integer m_queueSize = 300000;
  53. @XmlElement(name="message-format", required=false, defaultValue="ALARM ID:${alarmId} NODE:${nodeLabel} ${logMsg}")
  54. private String m_messageFormat = "ALARM ID:${alarmId} NODE:${nodeLabel} ${logMsg}";
  55. @XmlElement(name="destination")
  56. private List<SyslogDestination> m_destinations;
  57. @XmlElement(name="uei", required = false)
  58. private List<String> m_ueis;
  59. //Getters & Setters
  60. public List<SyslogDestination> getDestinations() {
  61. return m_destinations;
  62. }
  63. public void setDestinations(List<SyslogDestination> destinations) {
  64. m_destinations = destinations;
  65. }
  66. public List<String> getUeis() {
  67. return m_ueis;
  68. }
  69. public void setUeis(List<String> ueis) {
  70. m_ueis = ueis;
  71. }
  72. public String getMessageFormat() {
  73. return m_messageFormat;
  74. }
  75. public void setMessageFormat(String messageFormat) {
  76. m_messageFormat = messageFormat;
  77. }
  78. public Integer getNaglesDelay() {
  79. return m_naglesDelay;
  80. }
  81. public void setNaglesDelay(Integer naglesDelay) {
  82. m_naglesDelay = naglesDelay;
  83. }
  84. public Integer getBatchSize() {
  85. return m_batchSize;
  86. }
  87. public void setBatchSize(Integer batchSize) {
  88. m_batchSize = batchSize;
  89. }
  90. public Integer getQueueSize() {
  91. return m_queueSize;
  92. }
  93. public void setQueueSize(Integer alarmQueueSize) {
  94. m_queueSize = alarmQueueSize;
  95. }
  96. public Boolean isEnabled() {
  97. return m_enabled;
  98. }
  99. public void setEnabled(Boolean enabled) {
  100. m_enabled = enabled;
  101. }
  102. public SyslogDestination getDestination(String destinationName) {
  103. SyslogDestination destination = null;
  104. for (SyslogDestination dest : m_destinations) {
  105. if (dest.getName().equals(destinationName)) {
  106. destination = dest;
  107. }
  108. }
  109. return destination;
  110. }
  111. }