@Override public Object generateCell(Table source, Object itemId, Object columnId) { return container.getItem(itemId).getBean().getMibObjs().size(); } });
@Override public Object generateCell(Table source, Object itemId, Object columnId) { return container.getItem(itemId).getBean().getMibObjs().size(); } });
private void doVisit(Group group, DataCollectionVisitor visitor) { visitor.visitGroup(group); // mibObj for (Iterator<MibObj> it = group.getMibObjs().iterator(); it.hasNext();) { MibObj mibObj = it.next(); doVisit(mibObj, visitor); } // subGroups for (Iterator<String> it = group.getIncludeGroups().iterator(); it.hasNext();) { String subGroup = it.next(); doVisitSubGroup(subGroup, visitor); } visitor.completeGroup(group); }
private void validateResourceTypes(final Collection<SnmpCollection> snmpCollections, final Set<String> allowedResourceTypes) { final String configuredString; if (allowedResourceTypes.size() == 0) { configuredString = "(none)"; } else { configuredString = StringUtils.join(allowedResourceTypes, ", "); } final String allowableValues = "any positive number, 'ifIndex', or any of the configured resourceTypes: " + configuredString; for (final SnmpCollection collection : snmpCollections) { final Groups groups = collection.getGroups(); if (groups != null) { for (final Group group : groups.getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { final String instance = mibObj.getInstance(); if (instance == null) continue; if (MibObject.INSTANCE_IFINDEX.equals(instance)) continue; if (allowedResourceTypes.contains(instance)) continue; try { // Check to see if the value is a non-negative integer if (Integer.parseInt(instance.trim()) >= 0) { continue; } } catch (NumberFormatException e) {} // XXX this should be a better exception throw new IllegalArgumentException("instance '" + instance + "' invalid in mibObj definition for OID '" + mibObj.getOid() + "' in collection '" + collection.getName() + "' for group '" + group.getName() + "'. Allowable instance values: " + allowableValues); } } } } }
/** * Gets the parent groups. * <p>The list of groups per SNMP collection that are referencing a given resourceTypeName</p> * * @param dataCollectionConfigDao the data collection configuration DAO * @param resourceTypeName the resource type name * @return the parent groups. */ private Set<String> getParentGroups(final DataCollectionConfigDao dataCollectionConfigDao, String resourceTypeName) { Set<String> groupMap = new TreeSet<>(); for (final SnmpCollection collection : dataCollectionConfigDao.getRootDataCollection().getSnmpCollections()) { for (final Group group : collection.getGroups().getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { if (mibObj.getInstance().equals(resourceTypeName)) { groupMap.add(group.getName() + '@' + collection.getName()); } } } } return groupMap; }
/** * Gets the parent groups. * <p>The list of groups per SNMP collection that are referencing a given resourceTypeName</p> * * @param dataCollectionConfigDao the data collection configuration DAO * @param resourceTypeName the resource type name * @return the parent groups. */ private Set<String> getParentGroups(final DataCollectionConfigDao dataCollectionConfigDao, String resourceTypeName) { Set<String> groupMap = new TreeSet<>(); for (final SnmpCollection collection : dataCollectionConfigDao.getRootDataCollection().getSnmpCollections()) { for (final Group group : collection.getGroups().getGroups()) { for (final MibObj mibObj : group.getMibObjs()) { if (mibObj.getInstance().equals(resourceTypeName)) { groupMap.add(group.getName() + '@' + collection.getName()); } } } } return groupMap; }
processObjectList(groupName, groupIfType, group.getMibObjs(), mibObjectList); } else { LOG.debug("processGroupName: OIDs from group '{}:{}' are excluded for ifType: {}", group.getName(), group.getIfType(), ifType);