class ExternalResourceUtils {

	public static Map<String, Long> getExternalResourceAmountMap(Configuration config) {
		final Set<String> resourceSet = getExternalResourceSet(config);
		LOG.info("Enabled external resources: {}", resourceSet);

		if (resourceSet.isEmpty()) {
			return Collections.emptyMap();
		}

		final Map<String, Long> externalResourceAmountMap = new HashMap<>();
		for (String resourceName: resourceSet) {
			final ConfigOption<Long> amountOption =
				key(ExternalResourceOptions.getAmountConfigOptionForResource(resourceName))
					.longType()
					.noDefaultValue();
			final Optional<Long> amountOpt = config.getOptional(amountOption);
			if (!amountOpt.isPresent()) {
				LOG.warn("The amount of the {} should be configured. Will ignore that resource.", resourceName);
			} else if (amountOpt.get() <= 0) {
				LOG.warn("The amount of the {} should be positive while finding {}. Will ignore that resource.", amountOpt.get(), resourceName);
			} else {
				externalResourceAmountMap.put(resourceName, amountOpt.get());
			}
		}

		return externalResourceAmountMap;
	}

	private  ExternalResourceUtils();

}