class RangerPolicyValidator extends RangerValidator {

	boolean isValidResourceValues(Map<String, RangerPolicyResource> resourceMap, List<ValidationFailureDetails> failures, RangerServiceDef serviceDef) {
		if(LOG.isDebugEnabled()) {
			LOG.debug(String.format("==> RangerPolicyValidator.isValidResourceValues(%s, %s, %s)", resourceMap, failures, serviceDef));
		}

		boolean valid = true;
		Map<String, String> validationRegExMap = getValidationRegExes(serviceDef);
		for (Map.Entry<String, RangerPolicyResource> entry : resourceMap.entrySet()) {
			String name = entry.getKey();
			RangerPolicyResource policyResource = entry.getValue();
			if(policyResource != null && CollectionUtils.isNotEmpty(policyResource.getValues())){
				Set<String> resources = new HashSet<String>(policyResource.getValues());
				for (String aValue : resources) {
					if (StringUtils.isBlank(aValue)) {
						policyResource.getValues().remove(aValue);
					}
				}
			}
			if(CollectionUtils.isEmpty(policyResource.getValues())){
				ValidationErrorCode error = ValidationErrorCode.POLICY_VALIDATION_ERR_MISSING_RESOURCE_LIST;
				if(LOG.isDebugEnabled()) {
					LOG.debug(String.format("Resource list was empty or contains null: value[%s], resource-name[%s], service-def-name[%s]", policyResource.getValues(), name, serviceDef.getName()));
				}
				failures.add(new ValidationFailureDetailsBuilder()
					.field("resource-values")
					.subField(name)
					.isMissing()
					.becauseOf(error.getMessage(name))
					.errorCode(error.getErrorCode())
					.build());
				valid=false;
			}
			if (validationRegExMap.containsKey(name) && policyResource != null && CollectionUtils.isNotEmpty(policyResource.getValues())) {
				String regEx = validationRegExMap.get(name);
				for (String aValue : policyResource.getValues()) {
					if (StringUtils.isBlank(aValue)) {
						LOG.debug("resource value was blank");
					} else if (!aValue.matches(regEx)) {
						if (LOG.isDebugEnabled()) {
							LOG.debug(String.format("Resource failed regex check: value[%s], resource-name[%s], regEx[%s], service-def-name[%s]", aValue, name, regEx, serviceDef.getName()));
						}
						ValidationErrorCode error = ValidationErrorCode.POLICY_VALIDATION_ERR_INVALID_RESOURCE_VALUE_REGEX;
						failures.add(new ValidationFailureDetailsBuilder()
							.field("resource-values")
							.subField(name)
							.isSemanticallyIncorrect()
							.becauseOf(error.getMessage(aValue, name))
							.errorCode(error.getErrorCode())
							.build());
						valid = false;
					}
				}
			}
		}

		if(LOG.isDebugEnabled()) {
			LOG.debug(String.format("<== RangerPolicyValidator.isValidResourceValues(%s, %s, %s): %s", resourceMap, failures, serviceDef, valid));
		}
		return valid;
	}

	public  RangerPolicyValidator(ServiceStore store);

}