/** * <p>getNodeResourceType</p> * * @return a {@link org.opennms.netmgt.threshd.ThresholdResourceType} object. */ public ThresholdResourceType getNodeResourceType() { return m_thresholdGroup.getNodeResourceType(); }
/** * <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(); }
/** * <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); } }
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); }
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; }