PageRenderTime 30ms CodeModel.GetById 10ms app.highlight 15ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 29package org.opennms.netmgt.alarmd.northbounder.syslog;
 30
 31import java.io.Serializable;
 32import java.util.List;
 33
 34import javax.xml.bind.annotation.XmlAccessType;
 35import javax.xml.bind.annotation.XmlAccessorType;
 36import javax.xml.bind.annotation.XmlElement;
 37import javax.xml.bind.annotation.XmlRootElement;
 38
 39/**
 40 * Configuration for Syslog NBI implementation.
 41 * FIXME: This needs lots of work.
 42 * 
 43 * @author <a mailto:david@opennms.org>David Hustace</a>
 44 */
 45@XmlRootElement(name="syslog-northbounder-config")
 46@XmlAccessorType(XmlAccessType.FIELD)
 47public class SyslogNorthbounderConfig implements Serializable {
 48
 49    private static final long serialVersionUID = 1L;
 50
 51    @XmlElement(name="enabled", required=false, defaultValue="false")
 52	private Boolean m_enabled;
 53    
 54    @XmlElement(name="nagles-delay", required=false, defaultValue="1000")
 55    private Integer m_naglesDelay = 1000;
 56    
 57    @XmlElement(name="batch-size", required=false, defaultValue="100")
 58    private Integer m_batchSize = 100;
 59    
 60    @XmlElement(name="queue-size", required=false, defaultValue="300000")
 61    private Integer m_queueSize = 300000;
 62    
 63    @XmlElement(name="message-format", required=false, defaultValue="ALARM ID:${alarmId} NODE:${nodeLabel} ${logMsg}")
 64    private String m_messageFormat = "ALARM ID:${alarmId} NODE:${nodeLabel} ${logMsg}";
 65    
 66    @XmlElement(name="destination")
 67    private List<SyslogDestination> m_destinations;
 68    
 69    @XmlElement(name="uei", required = false)
 70    private List<String> m_ueis;
 71
 72    //Getters & Setters
 73    public List<SyslogDestination> getDestinations() {
 74    	return m_destinations;
 75    }
 76    public void setDestinations(List<SyslogDestination> destinations) {
 77    	m_destinations = destinations;
 78    }
 79    
 80    public List<String> getUeis() {
 81    	return m_ueis;
 82    }
 83    public void setUeis(List<String> ueis) {
 84    	m_ueis = ueis;
 85    }
 86    
 87	public String getMessageFormat() {
 88		return m_messageFormat;
 89	}
 90	
 91	public void setMessageFormat(String messageFormat) {
 92		m_messageFormat = messageFormat;
 93	}
 94	
 95	public Integer getNaglesDelay() {
 96		return m_naglesDelay;
 97	}
 98	
 99	public void setNaglesDelay(Integer naglesDelay) {
100		m_naglesDelay = naglesDelay;
101	}
102	
103	public Integer getBatchSize() {
104		return m_batchSize;
105	}
106	
107	public void setBatchSize(Integer batchSize) {
108		m_batchSize = batchSize;
109	}
110	
111	public Integer getQueueSize() {
112		return m_queueSize;
113	}
114	
115	public void setQueueSize(Integer alarmQueueSize) {
116		m_queueSize = alarmQueueSize;
117	}
118	public Boolean isEnabled() {
119		return m_enabled;
120	}
121	public void setEnabled(Boolean enabled) {
122		m_enabled = enabled;
123	}
124	
125	public SyslogDestination getDestination(String destinationName) {
126		SyslogDestination destination = null;
127		for (SyslogDestination dest : m_destinations) {
128			if (dest.getName().equals(destinationName)) {
129				destination = dest;
130			}
131		}
132		return destination;
133	}
134
135}