private static void validateResourceTypes(
      final FileReloadContainer<DatacollectionConfig> container,
      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 : container.getObject().getSnmpCollectionCollection()) {
      final Groups groups = collection.getGroups();
      if (groups != null) {
        for (final Group group : groups.getGroupCollection()) {
          for (final MibObj mibObj : group.getMibObjCollection()) {
            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);
          }
        }
      }
    }
  }
  private static Map<String, Map<String, Group>> getCollectionGroupMap(
      FileReloadContainer<DatacollectionConfig> container) {
    // Build collection map which is a hash map of Collection
    // objects indexed by collection name...also build
    // collection group map which is a hash map indexed
    // by collection name with a hash map as the value
    // containing a map of the collections's group names
    // to the Group object containing all the information
    // for that group. So the associations are:
    //
    // CollectionMap
    // collectionName -> Collection
    //
    // CollectionGroupMap
    // collectionName -> groupMap
    //
    // GroupMap
    // groupMapName -> Group
    //
    // This is parsed and built at initialization for
    // faster processing at run-timne.
    //
    final Map<String, Map<String, Group>> collectionGroupMap =
        new HashMap<String, Map<String, Group>>();

    for (final SnmpCollection collection : container.getObject().getSnmpCollectionCollection()) {
      // Build group map for this collection
      final Map<String, Group> groupMap = new HashMap<String, Group>();

      final Groups groups = collection.getGroups();
      if (groups != null) {
        for (final Group group : groups.getGroupCollection()) {
          groupMap.put(group.getName(), group);
        }
      }
      collectionGroupMap.put(collection.getName(), groupMap);
    }
    return Collections.unmodifiableMap(collectionGroupMap);
  }