int pos = 0;
for ( Value<?> value:attr )
{
MatchingRuleDescription desc = null;
try
{
desc = matchingRuleParser.parseMatchingRuleDescription( value.getString() );
}
catch ( ParseException e )
{
LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
"The following does not conform to the matchingRuleDescription syntax: " + value.getString(),
ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
iave.setRootCause( e );
throw iave;
}
if ( ! dao.hasSyntax( desc.getSyntax() ) )
{
throw new LdapOperationNotSupportedException(
"Cannot create a matchingRule that depends on non-existant syntax: " + desc.getSyntax(),
ResultCodeEnum.UNWILLING_TO_PERFORM );
}
MatchingRuleImpl mr = new MatchingRuleImpl( desc.getNumericOid(), desc.getSyntax(), globalRegistries );
setSchemaObjectProperties( desc, mr );
matchingRules[pos++] = mr;
}