/** * <p>getGroupName</p> * * @return a {@link java.lang.String} object. */ public String getGroupName() { return m_thresholdGroup.getName(); }
/** * <p>delete</p> */ public void delete() { delete(getNodeResourceType()); delete(getIfResourceType()); for (final Entry<String, ThresholdResourceType> entry : getGenericResourceTypeMap().entrySet()) { final ThresholdResourceType value = entry.getValue(); delete(value); } }
/** * <p>getRrdRepository</p> * * @return a {@link java.io.File} object. */ public File getRrdRepository() { return m_thresholdGroup.getRrdRepository(); }
private ThresholdGroup get(String name, ThresholdGroup group) { boolean merge = group != null; ThresholdGroup newGroup = new ThresholdGroup(name); File rrdRepository = new File(getThresholdingConfigFactory().getRrdRepository(name)); newGroup.setRrdRepository(rrdRepository); ThresholdResourceType nodeType = getThresholdResourceType(name, "node", merge ? group.getNodeResourceType() : null); newGroup.setNodeResourceType(nodeType); ThresholdResourceType ifType = getThresholdResourceType(name, "if", merge ? group.getIfResourceType() : null); newGroup.setIfResourceType(ifType); for (Basethresholddef thresh : getThresholdingConfigFactory().getThresholds(name)) { final String id = thresh.getDsType(); if (!(id.equals("if") || id.equals("node") || newGroup.getGenericResourceTypeMap().containsKey(id))) { ThresholdResourceType genericType = getThresholdResourceType(name, id, merge ? group.getGenericResourceTypeMap().get(id) : null); if (genericType.getThresholdMap().size() > 0) { LOG.info("Adding {}::{} with {} elements", name, id, genericType.getThresholdMap().size()); newGroup.getGenericResourceTypeMap().put(id, genericType); } } } return newGroup; }
private static Map<String, Set<ThresholdEntity>> getEntityMap(ThresholdGroup thresholdGroup, String resourceType) { LOG.trace("getEntityMap: checking if the resourceType '{}' exists on threshold group {}", resourceType, thresholdGroup); Map<String, Set<ThresholdEntity>> entityMap = null; if (CollectionResource.RESOURCE_TYPE_NODE.equals(resourceType)) { entityMap = thresholdGroup.getNodeResourceType().getThresholdMap(); } else if (CollectionResource.RESOURCE_TYPE_IF.equals(resourceType)) { entityMap = thresholdGroup.getIfResourceType().getThresholdMap(); } else { Map<String, ThresholdResourceType> typeMap = thresholdGroup.getGenericResourceTypeMap(); if (typeMap == null) { LOG.error("getEntityMap: Generic Resource Type map was null (this shouldn't happen) for threshold group {}", thresholdGroup.getName()); return null; } ThresholdResourceType thisResourceType = typeMap.get(resourceType); if (thisResourceType == null) { LOG.debug("getEntityMap: No thresholds configured for resource type '{}' in threshold group {}. Skipping this group.", resourceType, thresholdGroup.getName()); return null; } entityMap = thisResourceType.getThresholdMap(); } return Collections.unmodifiableMap(entityMap); }
for (final Iterator<ThresholdGroup> i = m_thresholdGroups.iterator(); i.hasNext();) { final ThresholdGroup group = i.next(); if (!newGroupNameList.contains(group.getName())) { LOG.info("{}: deleting group {}", logHeader, group); group.delete(); i.remove(); for (final String groupName : newGroupNameList) { final Optional<ThresholdGroup> foundGroup = m_thresholdGroups.stream().filter(tg -> groupName.equals(tg.getName())).findFirst(); try { if (!foundGroup.isPresent()) {
/** * <p>setIfResourceType</p> * * @param ifResourceType a {@link org.opennms.netmgt.threshd.ThresholdResourceType} object. */ public void setIfResourceType(ThresholdResourceType ifResourceType) { m_thresholdGroup.setIfResourceType(ifResourceType); }
/** * <p>setNodeResourceType</p> * * @param nodeResourceType a {@link org.opennms.netmgt.threshd.ThresholdResourceType} object. */ public void setNodeResourceType(ThresholdResourceType nodeResourceType) { m_thresholdGroup.setNodeResourceType(nodeResourceType); }
/** * <p>setGenericResourceTypeMap</p> * * @param genericResourceTypeMap a {@link java.util.Map} object. */ public void setGenericResourceTypeMap(Map<String,ThresholdResourceType> genericResourceTypeMap) { m_thresholdGroup.setGenericResourceTypeMap(genericResourceTypeMap); }
/** * <p>getIfResourceType</p> * * @return a {@link org.opennms.netmgt.threshd.ThresholdResourceType} object. */ public ThresholdResourceType getIfResourceType() { return m_thresholdGroup.getIfResourceType(); }
/** * <p>getNodeResourceType</p> * * @return a {@link org.opennms.netmgt.threshd.ThresholdResourceType} object. */ public ThresholdResourceType getNodeResourceType() { return m_thresholdGroup.getNodeResourceType(); }
/** * <p>getGenericResourceTypeMap</p> * * @return a {@link java.util.Map} object. */ public Map<String,ThresholdResourceType> getGenericResourceTypeMap() { return Collections.unmodifiableMap(m_thresholdGroup.getGenericResourceTypeMap()); }
/** * <p>toString</p> * * @return a {@link java.lang.String} object. */ @Override public String toString() { final StringBuilder buf = new StringBuilder(); buf.append(getName() + "={node:{"); if (getNodeResourceType() != null) { buf.append(getNodeResourceType().getThresholdMap().values()); } buf.append("}; iface:{"); if (getIfResourceType() != null) { buf.append(getIfResourceType().getThresholdMap().values()); } if (getGenericResourceTypeMap() != null) { for (final Entry<String, ThresholdResourceType> entry : getGenericResourceTypeMap().entrySet()) { final String rType = entry.getKey(); buf.append("}; " + rType + ":{"); final ThresholdResourceType value = entry.getValue(); buf.append(value.getThresholdMap().values()); buf.append("}"); } } buf.append("}"); return buf.toString(); }
/** {@inheritDoc} */ @Override public ThresholdGroup merge(ThresholdGroup group) { return get(group.getName(), group); }
assertEquals(1, visitors.get(i).getThresholdGroups().size()); if (i == 5) { assertEquals("web-services", visitors.get(i).getThresholdGroups().get(0).getName());