RuleCriterion criterion = (RuleCriterion)criteria.next();
if (criterion.getType() == null)
{
log.warn("Invalid criterion provided - type null on rule " + this);
}
RuleCriterionResolver resolver = getResolver(criterion.getType());
if (resolver == null)
{
resolver = getDefaultResolver();
}
String value = resolver.resolve(context, criterion);
if (value != null && (resolver instanceof RoleCriterionResolver ||
resolver instanceof GroupCriterionResolver))
{
StringTokenizer tokenizer = new StringTokenizer(value, StandardResolver.VALUE_DELIMITER);
while (tokenizer.hasMoreTokens())
{
String token = (String)tokenizer.nextToken();
key.append(criterion.getName());
key.append(ProfileLocator.PATH_SEPARATOR);
key.append(token);
if (tokenizer.hasMoreTokens())
{
key.append(ProfileLocator.PATH_SEPARATOR);
}
}
}
else
{
key.append(criterion.getName());
key.append(ProfileLocator.PATH_SEPARATOR);
key.append(value);
}
if (criteria.hasNext())
{
key.append(ProfileLocator.PATH_SEPARATOR);
}
count++;
}
// try to get the profile locator from the cache,
// request path and key sufficient to generate unique key
String requestPath = context.getPath();
String locatorKey = ((requestPath != null) ? requestPath : "/") + ProfileLocator.PATH_SEPARATOR + key.toString();
ProfileLocator locator = getLocatorFromCache(locatorKey);
if (locator != null)
{
return locator;
}
// second pass, build the locator object
locator = service.createLocator(context);
criteria = this.getRuleCriteria().iterator();
while (criteria.hasNext())
{
RuleCriterion criterion = (RuleCriterion)criteria.next();
if (criterion.getType() == null)
{
log.warn("Invalid criterion provided - name or type null on rule " + this);
}
RuleCriterionResolver resolver = getResolver(criterion.getType());
if (resolver != null)
{
String value = resolver.resolve(context, criterion);
boolean isControl = resolver.isControl(criterion);
boolean isNavigation = resolver.isNavigation(criterion);
if (value != null && (resolver instanceof RoleCriterionResolver ||
resolver instanceof GroupCriterionResolver))
{
StringTokenizer tokenizer = new StringTokenizer(value, StandardResolver.VALUE_DELIMITER);
while (tokenizer.hasMoreTokens())